From 6e7594ed872888e6fba5cae09b041aac7e28df1b Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Thu, 14 May 2015 02:08:22 +0200 Subject: [PATCH] TabCompleter pour la commande /region MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Création d'une classe d'auto completion pour la commande /region de worldguard Elle permet exclusivement de simplifier l'écriture des identifiants des cubos, qui sont bien trop long à taper --- .../commands/AbstractCommandExecutor.java | 2 +- .../PandacraftUtilsCommandsManager.java | 5 +++++ .../TabCompleterWorldGuardRegion.java | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java index 122e74d..26ff8a2 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java @@ -49,7 +49,7 @@ public abstract class AbstractCommandExecutor implements CommandExecutor, TabCom * @param allProposal * @return */ - public List getTabProposalFromToken(String token, List allProposal) { + public static List getTabProposalFromToken(String token, List allProposal) { List ret = new ArrayList(); for (String s : allProposal) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/PandacraftUtilsCommandsManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/PandacraftUtilsCommandsManager.java index 7e28c08..ea82180 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/PandacraftUtilsCommandsManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/PandacraftUtilsCommandsManager.java @@ -2,6 +2,8 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.commands; import java.util.HashMap; +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + /** * Initialise et stoque toutes les instances des classes exécutant les commandes Minecraft, géré par le plugin */ @@ -61,6 +63,9 @@ public class PandacraftUtilsCommandsManager { add(new CommandMail()); add(new CommandReply()); + // complétion des commandes des autres plugins + PandacraftUtils.getInstance().getServer().getPluginCommand("region").setTabCompleter(new TabCompleterWorldGuardRegion()); + } diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java new file mode 100644 index 0000000..08a9e81 --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java @@ -0,0 +1,19 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.commands; + +import java.util.List; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; + +public class TabCompleterWorldGuardRegion implements TabCompleter { + + @Override + public List onTabComplete(CommandSender paramCommandSender, + Command paramCommand, String paramString, + String[] paramArrayOfString) { + // TODO Auto-generated method stub + return null; + } + +}