Skip to content

Handling player senders

Dalton edited this page Apr 24, 2022 · 4 revisions

Handling Player senders is done via functional interface method like so:

@CommandName(name = "help")
public class HelpCommand extends ApiCommand {
    public HelpCommand(YourJavaPluginClass pluginInstance) { // If you dont want Dependency Injection, make the constructor empty
        this.onPlayerSender((playerSent) -> {
            Player player = playerSent.player();
            List<String> args = playerSent.args();
        }); // You can change onConsoleSender and onTabComplete here, check usages on the sidebar
    }
}
Clone this wiki locally