Get a server-wide command and change its Tab Executor?

Discussion in 'Plugin Development' started by TheEnderCrafter9, Jun 21, 2017.

Thread Status:
Not open for further replies.
  1. How can I change a command's Tab Executor? I can get the Bukkit command but I do not know how to set the Tab Executor
     
  2. Offline

    Zombie_Striker

    @TheEnderCrafter9
    1. Get the other plugin's instance.
    2. Get the command's instance.
    3. If a tab executor has been set, set it equal to a new tab executor that you want.
     
  3. @Zombie_Striker I successfully have a plugin instance and command instance. How would I get the tab executor that has been and how would I write a new tab executor for it which I can apply onto the command?
     
  4. Offline

    Zombie_Striker

    @TheEnderCrafter9
    1. Plugin#getCommand(...).getTabCompleter();
    2. Create a new class. Let it implement TabCompleter. Add un-implemented methods. Then, write what the player should see.
    3. Plugin#getCommand(...)setTabCompleter(new #2 )
     
  5. @Zombie_Striker to get the JavaPlugin of a command, would I just find the Plugin and cast it to a JavaPlugin?


    Code:
    JavaPlugin plug = (JavaPlugin) Bukkit.getServer().getPluginCommand("String.yml").getPlugin();
    
     
  6. Offline

    Zombie_Striker

    @TheEnderCrafter9
    No.
    Code:
    JavaPlugin plug = Bukkit.getPluginManager().getPlugin("MyPlugin");
     
  7. @Zombie_Striker that returns a plugin, so I am assuming I should cast that. Also, to get the name of the plugin, can I use
    Code:
     Bukkit.getServer().getPluginCommand.getPluginCommand("example").getPlugin().getName()
    in order to provide the proper name?
     
Thread Status:
Not open for further replies.

Share This Page