Showing only Command in AutoCompletion the Player has Pemission for

Discussion in 'Plugin Development' started by MiniDigger, May 31, 2014.

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

    MiniDigger

    Hello guys,
    I have a little problem. I don't want my players to see all commands via the auto completion, but the still should be able to use it for the commands they have the permission for.
    I am using the
    Code:
    Play.Client.TAB_COMPLETE
    Packet, provied by ProtocolLib, to modify the autocompletion.
    The problem is that I can't check if the player has permission to the command in the autocompletion list. Do you have any ideas to achieve this?
     
  2. Offline

    MiniDigger

    CreeperExplosion thats cool but don't solves my problem. I need to remove the commands the player has no permission for
     
  3. MiniDigger Why, .setCancelled(true) of course.
     
  4. Offline

    AronTheGamer

    This alreay does this from itself, I guess. When you do /help you can only see the commands you have permission for and the commands where no permission role is defined in the plugin.yml. As far my known is concerned this is true for the TabCompletion too.

    You can always use PlayerChatTabCompletionEvent.getTabCompletions().clear() to get rid of them all.
     
  5. Offline

    MiniDigger

    AronTheGamer if it would does it automaticly I wouldn't ask :D.

    I don't want to clear them, I just want to remove commands players don't have permission for.
    Example: Player one doesnt have the permission to the command "commandName". He should not be able to see the command in the tab completion. Player two has the permissions to the comman. He should be able to autocomplete the command
     
  6. bukkit does this by default if the plugin coder does include it inside plugin.yml, you can try this with commands like /op and /enchant
     
  7. Offline

    MiniDigger

    well, I don't register my commands in the plugin.yml, I am t lazy :D. Just putting them directly into the simplecommandmap. Should maybe rethink that. But isn't there a method to get the permission for a command?
     
Thread Status:
Not open for further replies.

Share This Page