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

@ -15,6 +15,7 @@ import com.graywolf336.jail.command.commands.JailCheckCommand;
import com.graywolf336.jail.command.commands.JailClearCommand;
import com.graywolf336.jail.command.commands.JailCommand;
import com.graywolf336.jail.command.commands.JailCreateCommand;
import com.graywolf336.jail.command.commands.JailListCommand;
import com.graywolf336.jail.command.commands.JailRemoveCellCommand;
import com.graywolf336.jail.command.commands.JailStopCommand;
import com.graywolf336.jail.command.commands.JailVersionCommand;
@ -139,6 +140,7 @@ public class CommandHandler {
load(JailClearCommand.class);
load(JailCommand.class);
load(JailCreateCommand.class);
load(JailListCommand.class);
load(JailRemoveCellCommand.class);
load(JailStopCommand.class);
load(JailVersionCommand.class);

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;
}
}