Solved Create '?' command

Discussion in 'Spigot Plugin Development' started by Paulatic, Nov 22, 2016.

Thread Status:
Not open for further replies.
  1. Hi,
    I wanted to register a question mark (?) as a command, but it didn't worked.
    How can I solve this? Is this possible at all?
    Thanks in advance.

    btw I'm not english, so excuse my mistakes, please :)
     
  2. Code (Text):
        @EventHandler
        public void onPlayerCommandExecuted(PlayerCommandPreprocessEvent event) {
            Player player = event.getPlayer();
           
            String command = event.getMessage();
            command = command.toLowerCase();
           
            if (command.startsWith("/?")) {
                event.setCancelled(true);
               
                //Add what ever you want
            }
        }
     
    • Like Like x 1
  3. Mas

    Mas

    Of you want to override the default /? command you may have to use PlayerCommandPreprocessEvent
     
    • Like Like x 1
  4. Thank you very much. It works fine now :)
     
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.