addCommand
Create custom commands with scripts.
Overview:
Functions:
API Reference
addCommand()
addCommand()Creates a custom command
addCommand("commandName", {
onCommand: function(sender, args) {},
onTabComplete: function(sender, args) {}
}, "permission.example");Parameters:
commandName(String) The name of the command (without/)handler(Object) Contains methods likeonCommandand optionallyonTabCompletepermission(optional) (String) The permission string required to execute or tab-complete this command. If there is no permission given, the command is available to all players (and ops by default)
Methods:
onCommand(sender, args)(required) Called when the command is executed.sender: The player or console who executed the command.args: A Java array of arguments.
onTabComplete(sender, args)(optional) Called to provide tab-completion suggestions. Must return a Java List.
Example:
Last updated
Was this helpful?