diff --git a/src/main/java/com/graywolf336/jail/command/subcommands/JailListCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailListCommand.java index c671f86..d436dbc 100644 --- a/src/main/java/com/graywolf336/jail/command/subcommands/JailListCommand.java +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailListCommand.java @@ -1,5 +1,7 @@ package com.graywolf336.jail.command.subcommands; +import java.util.HashSet; + import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -39,10 +41,17 @@ public class JailListCommand implements Command { //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() + ")"); + HashSet pris = j.getAllPrisoners(); + + if(pris.isEmpty()) { + //If there are no prisoners, then send that message + sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOPRISONERS, j.getName())); + }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() + ")"); + } } } } diff --git a/src/main/java/com/graywolf336/jail/enums/LangString.java b/src/main/java/com/graywolf336/jail/enums/LangString.java index 33e9bd8..7c6b533 100644 --- a/src/main/java/com/graywolf336/jail/enums/LangString.java +++ b/src/main/java/com/graywolf336/jail/enums/LangString.java @@ -48,6 +48,8 @@ public enum LangString { MUTED ("jailing"), /** The message sent when the sender tries to jail someone in a cell and there aren't any cells to suggest. */ NOEMPTYCELLS ("jailing"), + /** The message sent to the sender when they list all the prisoners in a jail which has no prisoners. */ + NOPRISONERS ("jailing"), /** The message sent when a player is not jailed and the sender is trying to see/do something about it. */ NOTJAILED ("jailing"), /** The message sent to the sender when they mute a prisoner. */ diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index 5cae086..3512606 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -39,6 +39,7 @@ language: jailedwithreason: '&cYou have been jailed for: %0%' muted: '&cStop talking, you are in jail.' noemptycells: '&cNo empty cells were found for %0%, all them appear to be full.' + noprisoners: '&9%0% is empty and contains no prisoners.' notjailed: '&c%0% is not jailed.' nowmuted: '&9%0% is now muted.' nowunmuted: '&9%0% is now unmuted.'