1.12.2 tab

Discussion in 'Spigot Plugin Development' started by maxcom1, Nov 22, 2020.

  1. Hi!
    I'd like to remove /bukkit: and some other commands from /<tab>.
    I have code:
    Code (Java):
        @EventHandler
        public void x(TabCompleteEvent e) {
            List<String> gt = e.getCompletions();
            gt.remove("bukkit:?");
            gt.remove("bukkit:plugins");
            gt.remove("bukkit:pl");
            gt.remove("bukkit:help");
            gt.remove("bukkit:rl");
            gt.remove("bukkit:ver");
            gt.remove("bukkit:version");
            gt.remove("bukkit:about");
            gt.remove("bukkit:timings");
            gt.remove("bukkit:reload");
            e.setCompletions(gt);
        }
    but it remove only commands from tab complete in console ;/
    Is there any way to remove this on the player side?
    please help...
     
  2. This is not a resource
     
  3. but when I don't set any prefix it won't accept me
     
  4. then set a prefix? What version are you coding on that's what it's asking you for.

    Anyway there is no reason to even code a plugin for this purpose specifically you can easily block these bukkit: commands within the commands.yml file. If they don't have permission for them you can't tab them right?

    If you can still tab them after that then it may not be possible to remove vanilla commands from tab completions since those commands will always exist?
     
  5. how i can disable it in command.yml?
     
  6. Well you can disable the command but not being able to stop it from being tabbed is what I meant.
     
  7. Try starting commands with a forward-slash (/)
     
  8. Thanks, now it's working in minecraft but not in the console. I wish it would block here and here.
    What better way than a 2 times longer list?
     
  9. remove the slashes from the start of the commands. after the code where you added all the commands, loop through the list and add a new entry with a slash in front of the command too.
    if you need help with this I am happy to provide it :)
     
  10. nevermind. here you are. :)
    i haven't tested this code, written in good old notepad. just FYI.

    also make sure you name your methods properly.

    Code (Java):
    @EventHandler
    public void onTabComplete(final TabCompleteEvent event) {
      ArrayList<String> removals = Arrays.asList("bukkit:?", "bukkit:plugins", "bukkit:pl", "bukkit:help", "bukkit:?", "bukkit:version", "bukkit:ver", "bukkit:about", "bukkit:reload", "bukkit:rl", "bukkit:timings");
      event.setCompletions(event.getCompletions().removeAll(removals));
    }
     
  11. Ok.
    I set up a tab list and have a problem:
    When i write e.g. /mine and press tab, what I typed in clears.
    can i repair this?
     
  12. Please send your current code.
     
  13. Main:
    Code (Java):
        @EventHandler
        public void x(TabCompleteEvent e) {
            e.setCompletions(CompleteList.registerComplete(e.getCompletions()));
        }
    CompleteList:
    Code (Java):
        public static List<String> registerComplete(List<String> gt) {
                gt.remove("bukkit:?");
                gt.remove("bukkit:plugins");
                gt.remove("bukkit:pl");
                gt.remove("bukkit:help");
                gt.remove("bukkit:rl");
                gt.remove("bukkit:ver");
                gt.remove("bukkit:version");
                gt.remove("bukkit:about");
                gt.remove("bukkit:timings");
                gt.remove("bukkit:reload");
                gt.remove("about");
                gt.remove("pl");
                gt.remove("plugins");
                gt.remove("ver");
                gt.remove("version");
                gt.remove("/bukkit:?");
                gt.remove("/bukkit:plugins");
                gt.remove("/bukkit:pl");
                gt.remove("/bukkit:help");
                gt.remove("/bukkit:rl");
                gt.remove("/bukkit:ver");
                gt.remove("/bukkit:version");
                gt.remove("/bukkit:about");
                gt.remove("/bukkit:timings");
                gt.remove("/bukkit:reload");
                gt.remove("/about");
                gt.remove("/pl");
                gt.remove("/plugins");
                gt.remove("/ver");
                gt.remove("/version");
            return gt;
        }
     
  14. Try my code, it's far better than your current setup