27.08.2014, 11:29
@DrumYum: If you destroy a EventManagerNode / PlayerCommandManager, you will destroy all the events that are attached to it. So, if you add a PlayerConnectEvent to a Node, it won't be called anymore if you destroy it.
HandlerPriority defines the Priority of a Event. If you add a PlayerConnectEvent with High priority, and one with low priority, the one with the high priority will be called first.
The .setUsageMessageSupplier defines the message that appears if a person enters wrong arguments. If you have a command like this -> /mycmd [name] [level] you can display a custom message when the players enters wrong args.
You can make one like this:
You don't need to split your admin commands. Just create a new CommandGroup, for example:
with this method, you can access your admin commands like /admin -command- (/admin kick)
HandlerPriority defines the Priority of a Event. If you add a PlayerConnectEvent with High priority, and one with low priority, the one with the high priority will be called first.
The .setUsageMessageSupplier defines the message that appears if a person enters wrong arguments. If you have a command like this -> /mycmd [name] [level] you can display a custom message when the players enters wrong args.
You can make one like this:
PHP код:
commandManager.setUsageMessageSupplier((player, command, prefix, params, help) -> {
String message = prefix + command;
for (String param : params) {
message += " [" + param + "]";
}
return message;
});
PHP код:
commandManager.installCommandHandler(HandlerPriority.NORMAL);
commandManager.registerCommands(new MyCommands());
adminCommands = new CommandGroup();
adminCommands.registerCommands(new AdminCommands());
commandManager.registerChildGroup(adminCommands, "admin");