TabCompleteEvent

Discussion in 'Spigot Plugin Development' started by Sirenum, May 9, 2015.

  1. Having problems on a project to disable /<tab> to open up the list of completions.

    I've already heard that you can only do it with ProtocalLib... But what about this method...?

    PHP:
    public class TabEvent implements Listener
    {
        @EventHandler (priority = EventPriority.HIGHEST)
        public void chat(PlayerChatTabCompleteEvent event)
        {
            Player p = event.getPlayer();

            String msg = event.getChatMessage();

            if(msg.contains("/"))
            {
                event.getTabCompletions().clear();
            }
        }
    }
    For some reason it isn't working. I must be missing something.

    Any help appreciated.

    Thanks, ES
     
  2. You don't need ProtocolLib to do that. Many command blocking plugin's do that.

    EDIT: ofc, if you use ProrotocolLib, that would make your life little bit easier.
     
    #2 vk2gpz, May 9, 2015
    Last edited: May 9, 2015
    • Like Like x 1
    • Agree Agree x 1
  3. Debug your code to see, whether the event is called at all, whether the tab completions are cleared etc.