Stop Command:Command showing in tab

Discussion in 'Spigot Plugin Development' started by Jonnyo101, Oct 6, 2019.

  1. Hi when adding a command in 1.13 and typing the command the command shows like this in the tab popup box.
    https://prnt.sc/pfo37d
    How do i make the second line not show up ?
     
  2. That's completely normal. It's pluginname:command. (the same applies for minecraft:.. commands). That only happens if your plugin name is the same as your command. Don't think there is a real need to turn it off, but the PlayerCommandSendEvent is where you would do so.

    EDIT: Linked the wrong event. Oopsie.
     
  3. drives_a_ford

    Moderator

    Set a permission in plugin.yml. Define that permission in plugin.yml with a default (i.e false or op). Make sure you don't have said permission.

    No. That event is depracated. Due to changes in MC, it's never fired. It's handled client side.
     
  4. Yeah you quoted me before I remembered and edited ^^'
     
  5. I do not use the plugin.yml to add commands. So i can not really add a permission.
    Here is how i register the commands.
    Code (Java):
            try {
                final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
                bukkitCommandMap.setAccessible(true);
                final CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());

                final Constructor<PluginCommand> constructor = (Constructor<PluginCommand>) PluginCommand.class.getDeclaredConstructors()[0];
                constructor.setAccessible(true);
                final PluginCommand obj = constructor.newInstance(command, Core.getPlugin());

                obj.setAliases(aliases);
                obj.setUsage("-");
                obj.setExecutor(this);
                obj.setTabCompleter(this);

                commandMap.register(command, obj);
            } catch (final Exception e) {    
                e.printStackTrace();
            }
     
  6. drives_a_ford

    Moderator

    And why are you doing it this way exactly?
     
  7. It works better with my command builder.
    And also allows the plugin to control what commands are added !

    Also you said about adding a permission for the player to not see the command
    Wouldn't that block the player form seeing both ?
    Eg Adding /woo

    You would see
    Woo
    PluginName:Woo

    I just want to stop the pop up box from showing the PluginName:Woo and only show Woo
     
  8. drives_a_ford

    Moderator

    Short of removing the alias from the command map, that's not possible.
    EDIT: If you do want to do that this is where it gets added.