06.04.2016, 21:34
I'm really sorry if I am doing this by the wrong way, but it continues showing the default message (I have already updated everything):
And the next code is being called twice, it shows me both messages when I press SPRINT key. What are the reason for this behavior so I could fix it?
"Main" class:
Код:
CommandGroup group= new CommandGroup(); group.registerCommands(new BasicCmds(event, commandManager)); group.registerCommands(new ModCmds()); group.registerCommands(new AdminCmds(controladorVehiculos)); group.registerCommands(new DevCmds(vehicleController, event)); group.registerCommands(new LogCmds()); group.registerCommands(new EventCmds()); group.setUsageMessageSupplier((player, prefix, command) -> { StringBuilder stringBuilder = new StringBuilder("» Type: " + prefix + command.getCommand()); if(command.getParameters().length > 0) { for(int i = 0; i < command.getParameters().length; i++) { stringBuilder.append(" <").append(command.getParameters()[i].name()).append(">"); } } if(command.getHelpMessage() != null) stringBuilder.append(" - ").append(command.getHelpMessage()); return stringBuilder.toString(); }); commandManager.registerGroup(group); commandManager.installCommandHandler(HandlerPriority.NORMAL);
Код:
event.registerHandler(PlayerKeyStateChangeEvent.class, e -> { Player player = e.getPlayer(); if(player.getKeyState().isKeyPressed(PlayerKey.SPRINT)) { player.sendMessage(Color.GREEN, "* You pressed SPRINT!"); } else { player.sendMessage(Color.RED, "* You didn't press SPRINT!"); } });
Код:
new PlayerController(getEventManager(), vehicleController); new SpecManager(getEventManager());