24.08.2014, 12:35
That part I did. But when will their body be defined? I mean, it's an interface - I don't create those methods. So how will it actually know what to do in my added methods?
@Command
public boolean kill(Player p)
{
p.setHealth(0F);
return true;
}
@CustomCommand
public boolean customHandler(Player p, String cmd, String params)
{
p.sendMessage(new Color(-1), "Unknown command.");
return true;
}
eventManagerNode.registerHandler(PlayerCommandEvent.class, HandlerPriority.BOTTOM, (e) -> { Player player = e.getPlayer(); player.sendMessage(Color.RED, "Unknown command. Type /help to see help."); e.setProcessed(); });
Thanks for your answers, guys!
And I have new question: how I can connect Pawn script and Shoebill gamemode? I have administration system with 3k+ lines of code and I too lazy to rewrite it in Java. Maybe exists analogue of CallRemoteFunction? I saw SampCallbackManager class in javadoc, but I don't know what it is and how I can use it if this is what I need. |
commandManager.setUsageMessageSupplier((player, command, prefix, params, help) -> {
String message = prefix + command;
for (String param : params) {
message += " [" + param + "]";
}
return message;
});
commandManager.installCommandHandler(HandlerPriority.NORMAL);
commandManager.registerCommands(new MyCommands());
adminCommands = new CommandGroup();
adminCommands.registerCommands(new AdminCommands());
commandManager.registerChildGroup(adminCommands, "admin");