Block /? command

Discussion in 'Plugin Development' started by kevinspl2000, Oct 15, 2013.

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

    kevinspl2000

    Okay so I was wondering how do I block the /? command?? I tried doing the usual methords but it still shows up. Help??
     
  2. Offline

    Chinwe

    What are the usual methods that you've tried? Try listening to PlayerCommandPreprocessEvent and cancelling it if event.getMessage().equals("/?") :)
     
  3. Offline

    TeddyTheTeddy

    You could also in the plugin.yml override it just by adding it into your commands, for example
    Code:
    commands:
      ?:
    but Chinwe's way sounds much better
     
  4. Offline

    KombustorLP

    If you use a permission plugin you can give the user the permission: -bukkit.command.help

    Then he can't use /help or /?

    =)
     
  5. Offline

    kevinspl2000

    Chinwe
    That is the methord I used. It won't block it. And also I only want /? to be blocked not /help
     
  6. Offline

    Blah1

    Just do if cmd.getname.equals("?") and just send them a message saying you cant do that
     
  7. Offline

    kevinspl2000

    Blah1
    But it still displays the message...
     
  8. Offline

    Chinwe

    kevinspl2000
    It should work - have you registered your listener, and are you actually cancelling the event? :confused:
     
  9. Offline

    kevinspl2000

    Chinwe
    Yes I am! Try it yourself if you don't believe

    Same with /ver and /version :( Doesn't block it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  10. Offline

    1Rogue

    If I remember correctly there are certain commands that can't be overwritten. One second.
     
    spoljo666 likes this.
  11. Offline

    Chinwe

    Works for me :confused:
    [​IMG]
     
  12. Offline

    kevinspl2000

    o.o

    Hm if I do
    if (event.getMessage() == "/?")
    Should work too right?

    Hmm I fixed the issue! It doesn't work with the == idk why but :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  13. Offline

    deathknife

    No, "/?" is a string. You can't use '==' operator to compare something to string. You have to use .equals.
     
    Chinwe and 1Rogue like this.
Thread Status:
Not open for further replies.

Share This Page