Custom Commands
Creating Custom Commands
Allows you to register and handle custom commands in scripts
Method
Parameters:
commandName
(String
) The name of the command (without/
)commandHandler
(Object
) Contains methods likeonCommand
and optionallyonTabComplete
permission
(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)
commandHandler
Methods
commandHandler
MethodsonCommand(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.
🛡️ Players without
openjs.command.adminhello
will not see the command in suggestions or tab-complete. Ops do have all permission by default, unless restricted by permission plugins.
Last updated