Skip to content

Handling console senders

Dalton edited this page Apr 24, 2022 · 2 revisions

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

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