onCommand

open override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean

Main command execution handler for the /core command.

This method processes all incoming command executions and routes them to the appropriate subcommand handlers based on the first argument provided. If no arguments are provided, it displays the help message.

Command Flow:

  1. Validates that arguments are provided (shows help if empty)

  2. Normalizes the subcommand to lowercase for case-insensitive matching

  3. Routes to appropriate handler based on subcommand

  4. Returns appropriate success/failure status

Supported Subcommands:

  • info - Shows plugin and server information

  • reload - Reloads plugin configuration (permission required)

  • testplugin - Runs system diagnostics (permission required, player-only)

Return

true if the command was handled successfully, false if there was an error or if the command usage should be displayed to the sender

Parameters

sender

The CommandSender who executed the command (can be player or console)

command

The Command object representing the executed command

label

The actual command label used (could be an alias)

args

Array of command arguments provided by the sender

See also

CoreCommand.sendHelpMessage
CoreCommand.showPluginInfo
CoreCommand.reloadPlugin
CoreCommand.testAllFunctionality