List all the prisoners in a jail if the jail is provided on /jail list
This commit is contained in:
parent
05695ce969
commit
508366468a
@ -5,28 +5,47 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.graywolf336.jail.JailManager;
|
import com.graywolf336.jail.JailManager;
|
||||||
import com.graywolf336.jail.beans.Jail;
|
import com.graywolf336.jail.beans.Jail;
|
||||||
|
import com.graywolf336.jail.beans.Prisoner;
|
||||||
import com.graywolf336.jail.command.Command;
|
import com.graywolf336.jail.command.Command;
|
||||||
import com.graywolf336.jail.command.CommandInfo;
|
import com.graywolf336.jail.command.CommandInfo;
|
||||||
import com.graywolf336.jail.enums.LangString;
|
import com.graywolf336.jail.enums.LangString;
|
||||||
|
|
||||||
@CommandInfo(
|
@CommandInfo(
|
||||||
maxArgs = 0,
|
maxArgs = 1,
|
||||||
minimumArgs = 0,
|
minimumArgs = 0,
|
||||||
needsPlayer = false,
|
needsPlayer = false,
|
||||||
pattern = "list|l",
|
pattern = "list|l",
|
||||||
permission = "jail.command.jaillist",
|
permission = "jail.command.jaillist",
|
||||||
usage = "/jail list"
|
usage = "/jail list <jail>"
|
||||||
)
|
)
|
||||||
public class JailListCommand implements Command {
|
public class JailListCommand implements Command {
|
||||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||||
sender.sendMessage(ChatColor.AQUA + "----------Jails----------");
|
sender.sendMessage(ChatColor.AQUA + "----------Jails----------");
|
||||||
|
|
||||||
if(!jm.getJails().isEmpty()) {
|
//Check if there are any jails
|
||||||
|
if(jm.getJails().isEmpty()) {
|
||||||
|
sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAILS));
|
||||||
|
}else {
|
||||||
|
//Check if they have provided a jail to list or not
|
||||||
|
if(args.length == 1) {
|
||||||
|
//No jail provided, so give them a list of the jails
|
||||||
for(Jail j : jm.getJails()) {
|
for(Jail j : jm.getJails()) {
|
||||||
sender.sendMessage(ChatColor.BLUE + " " + j.getName() + " (" + j.getAllPrisoners().size() + ")");
|
sender.sendMessage(ChatColor.BLUE + " " + j.getName() + " (" + j.getAllPrisoners().size() + ")");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAILS));
|
Jail j = jm.getJail(args[1]);
|
||||||
|
|
||||||
|
if(j == null) {
|
||||||
|
//No jail was found
|
||||||
|
sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[1]));
|
||||||
|
}else {
|
||||||
|
for(Prisoner p : j.getAllPrisoners()) {
|
||||||
|
//graywolf663: Being gray's evil twin; CONSOLE (10)
|
||||||
|
//prisoner: reason; jailer (time in minutes)
|
||||||
|
sender.sendMessage(ChatColor.BLUE + " " + p.getName() + ": " + p.getReason() + "; " + p.getJailer() + "(" + p.getRemainingTimeInMinutes() + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.AQUA + "-------------------------");
|
sender.sendMessage(ChatColor.AQUA + "-------------------------");
|
||||||
|
Loading…
Reference in New Issue
Block a user