Tab Commands Help

Discussion in 'Plugin Development' started by Minecraft Server Network, Jun 11, 2015.

Thread Status:
Not open for further replies.

  1. MAUX GAMES // INNOVATOR //


    Hello! I am currently developing a plugin and I came to a stumble. I will need some help!
    So here is the problem, the plugin I am trying to develop is an essential core plugin for all the other plugins in the Maux Games network. I understand what I have to make, but I do not know how to make it. All I know is how to start. Here is the quote of the script:


    " Make an event on which when a player tries to tab out a command, it will show them the base commands for Bukkit. As well as when the player tries to do /bukkit:help, /bukkit:?, /help, or /? "

    Then he lists server examples:


    " Server Examples: Mineplex Network (us.mineplex.com), MCGamer Network (us.mcgamer.net) "
    Finally, he lists the commands he wants the players to see:

    " /?, /bukkit:?, bukkit:help, /bukkit:kill, /bukkit:me, /bukkit:msg, /bukkit:tell, /bukkit:w, /help, /kill, /me, /msg, /tell, /w "
    I already started on the item with this:

    ••••••••••••••••••••••••••••••

    Code:

    package net.MauxGames.Maux.Listeners;

    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerChatTabCompleteEvent;

    public class ListenerCommandTabber implements Listener {

    @EventHandler

    public void onPlayerListTabComplete(PlayerChatTabCompleteEvent e) {
    e.getTabCompletions().clear();
    }

    }

    ••••••••••••••••••••••••••••••

    I just do not know how to carry on from here, I need help! Please help me!
     
  2. 1. Check if the player doesn't have the permission if you want ops and other players with a higher rank be able to use all tab completions
    2. e.getTabCompletions().addAll(Arrays.asList("/?", "/bukkit:?", "/bukkit:me");
     
  3. Thanks! So is this what it would look like :

    ••••••••••••••••••••••••••••••


    Code:

    package net.MauxGames.Maux.Listeners;

    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerChatTabCompleteEvent;

    public class ListenerCommandTabber implements Listener {

    @EventHandler

    public void onPlayerListTabComplete(PlayerChatTabCompleteEvent e) {

    Player p = e.getPlayer();

    if (p.hasPermission("maux.tablist")) {

    e.getTabCompletions();

    } else if (!p.hasPermission("maux.tablist")) {

    e.getTabCompletions().addAll(Arrays.asList("/?", "/bukkit:?", "/bukkit:me"));

    }

    }
    }

    ••••••••••••••••••••••••••••••
     
Thread Status:
Not open for further replies.

Share This Page