diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java index 08a9e81..5f0bf80 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/TabCompleterWorldGuardRegion.java @@ -1,18 +1,49 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.commands; +import java.util.ArrayList; import java.util.List; +import java.util.Set; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; +import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + +/** + * Permet le l'autosuggestion des nom des cubos (qui sont compliqués et souvent long) + * @author Marc Baloup + * + */ public class TabCompleterWorldGuardRegion implements TabCompleter { @Override - public List onTabComplete(CommandSender paramCommandSender, - Command paramCommand, String paramString, - String[] paramArrayOfString) { - // TODO Auto-generated method stub + public List onTabComplete(CommandSender sender, + Command cmd, String alias, + String[] args) { + + World w = null; + + if (sender instanceof Player) + w = ((Player)sender).getWorld(); + else + return null; + + + + + + + if (args.length == 2) { + + Set regionList = WorldGuardPlugin.inst().getRegionManager(w).getRegions().keySet(); + + return AbstractCommandExecutor.getTabProposalFromToken(args[1], new ArrayList(regionList)); + + } + return null; }