More work on tab completion, see details.. #77
Completed: - Jail check - jail clear - jail createcell - jail deletecell - Jail list - jail listcells - jail mute
This commit is contained in:
@ -1,6 +1,12 @@
|
||||
package com.graywolf336.jail.command.subcommands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
@ -35,4 +41,19 @@ public class JailMuteCommand implements Command {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<String> provideTabCompletions(JailManager jm, CommandSender sender, String... args) throws Exception {
|
||||
switch(args.length) {
|
||||
case 2:
|
||||
List<String> results = new ArrayList<String>();
|
||||
for(Player p : jm.getPlugin().getServer().getOnlinePlayers())
|
||||
if(StringUtil.startsWithIgnoreCase(p.getName(), args[1].toLowerCase()))
|
||||
results.add(p.getName());
|
||||
|
||||
Collections.sort(results);
|
||||
return results;
|
||||
default:
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user