Add jail list command, outputs the amount of prisoners in there.

This commit is contained in:
graywolf336
2013-12-07 14:27:41 -06:00
parent 11f9e94f40
commit b3ccf5e82a
2 changed files with 195 additions and 157 deletions

View File

@ -0,0 +1,36 @@
package com.graywolf336.jail.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.graywolf336.jail.JailManager;
import com.graywolf336.jail.beans.Jail;
import com.graywolf336.jail.command.Command;
import com.graywolf336.jail.command.CommandInfo;
@CommandInfo(
maxArgs = 0,
minimumArgs = 0,
needsPlayer = false,
pattern = "jaillist|jc",
permission = "jail.command.jaillist",
usage = "/jaillist"
)
public class JailListCommand implements Command {
@Override
public boolean execute(JailManager jm, CommandSender sender, String... args) {
sender.sendMessage(ChatColor.AQUA + "----------Jails----------");
if(!jm.getJails().isEmpty()) {
for(Jail j : jm.getJails()) {
sender.sendMessage(ChatColor.BLUE + " " + j.getName() + " (" + j.getAllPrisoners().size() + ")");
}
}else {
sender.sendMessage(ChatColor.RED + " There are no jails.");
}
sender.sendMessage(ChatColor.AQUA + "-------------------------");
return true;
}
}