[Help] Cancelling Default Help Command

Discussion in 'Plugin Development' started by WhaleAnarchy, Aug 23, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    WhaleAnarchy

    Hey Bukkit Forums,

    I have been searching around and I have found nothing about this, so if anyone could help I would be very, very greatful! I am trying to cancel the default help command as the title says, and I have had no luck finding anything about it.

    - WhaleAnarchy
     
  2. WhaleAnarchy
    Code:
    @EventHandler
    public void onCommandPreprocess(PlayerCommandPreprocessEvent event) {
        if(event.getMessage().equals("help")) {
            event.setCancelled(true);
        }
    }
    You might want to have to add a "/" to the start of "help".
     
  3. Offline

    WhaleAnarchy

    Assist Thanks, testing now

    Edit: Ok, that worked, but now I tried to add in my own /help command and everything crashed. Now the Event and the command doesn't work :/
     
  4. WhaleAnarchy
    Maybe try blocking /? too, because this is practically the same as /help
     
  5. Offline

    WhaleAnarchy

  6. WhaleAnarchy
    That code will cancel all "/help" commands, therefore yours will be cancelled too. Just add code below this line:
    Code:
    event.setCancelled(true);
    So if you want to send them a custom message when they type "/help", do:
    Code:
    event.setCancelled(true);
    event.getPlayer().sendMessage("This is what the player will see when they type /help");
     
  7. Offline

    WhaleAnarchy

    Assist Still does not work.
     
Thread Status:
Not open for further replies.

Share This Page