Command Tabbing

Discussion in 'Plugin Development' started by Minecraft Server Network, Oct 18, 2015.

Thread Status:
Not open for further replies.
  1. Hello, Spigot/Bukkit Developers and randies!

    Today, I have been searching through the Bukkit and Spigot forums all together to find how to disable a command from showing on tab. I heard rumours about it being a thing without using any dependencies. However, I could not find it.

    If you are not clear on what I am trying to say, let me give you an example!

    So, I have a command called "/rank" and, obviously, it changes the rank of another player! Now, if you do have permission to use "/rank," it will show in tab like so:

    Tab (for the player with permission for /rank) (open)
    Code:
    /quest, /question, /r, /rank, /reload, /reset, /rl


    Now, let's say if I don't have the permission to do "/rank," it should not show "/rank" on the tab, neither should the aliases appear also:
    Tab (for the player with no permission for /rank) (open)
    Code:
    /quest, /question, /reset, /rl


    Now, if possible, and if you understand what I am trying to say, how do I make it where they cannot see the command on tab?
     
  2. Offline

    PixelBeaver

    I think I understand what you're saying. Try making a PlayerChatTabCompleteEvent in a Listener class, then cancel the event if the chatted words are equal to "rank."
     
    Zombie_Striker likes this.
  3. Offline

    Scimiguy

  4. Offline

    boomboompower

  5. Offline

    I Al Istannen

    @Minecraft Server Network If you declare the permission in the plugin.yml with your command, it should be hidden if the user doesn't have it. At least that is what I got (tested with PEX).

    Code:
    commands:
      test:
        description: The main command
        permission: testCommand.test
    
     
    Last edited: Oct 20, 2015
  6. @I Al Istannen Okay! Thanks, I will test it out right now! I will give you the results!

    @I Al Istannen Hey guess what! It actually works! The problem is that when I try doing a "/rank" it gives me the default permission error message:

    Default Error Message (open)
    Code:
    I'm sorry, but you do not have permission to preform this command. Please contact the server administrators if you believe that this is in error.



    I want to put in my error message instead!:

    Custom Error Message (open)
    Code:
    Lol, just stop trying!


    How do I override the default error message into putting my custom error message?

    EDIT by Timtower: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 20, 2015
  7. Offline

    rbrick

  8. I shall, thank you! I will give you my input on the outcome!
    @rbrick
     
Thread Status:
Not open for further replies.

Share This Page