TabCompleter pour la commande /region
le précédent commit du même nom ne contenait pas l'implémentation de la classe TabCompleterWorldGuardRegion
This commit is contained in:
parent
72370b6a38
commit
3d6a970196
@ -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<String> onTabComplete(CommandSender paramCommandSender,
|
||||
Command paramCommand, String paramString,
|
||||
String[] paramArrayOfString) {
|
||||
// TODO Auto-generated method stub
|
||||
public List<String> 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<String> regionList = WorldGuardPlugin.inst().getRegionManager(w).getRegions().keySet();
|
||||
|
||||
return AbstractCommandExecutor.getTabProposalFromToken(args[1], new ArrayList<String>(regionList));
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user