Send a message when there are no prisoners in a jail.

This commit is contained in:
graywolf336 2014-02-10 14:50:41 -06:00
parent 508366468a
commit 7ce81c774f
3 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,7 @@
package com.graywolf336.jail.command.subcommands; package com.graywolf336.jail.command.subcommands;
import java.util.HashSet;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -39,10 +41,17 @@ public class JailListCommand implements Command {
//No jail was found //No jail was found
sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[1])); sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[1]));
}else { }else {
for(Prisoner p : j.getAllPrisoners()) { HashSet<Prisoner> pris = j.getAllPrisoners();
//graywolf663: Being gray's evil twin; CONSOLE (10)
//prisoner: reason; jailer (time in minutes) if(pris.isEmpty()) {
sender.sendMessage(ChatColor.BLUE + " " + p.getName() + ": " + p.getReason() + "; " + p.getJailer() + "(" + p.getRemainingTimeInMinutes() + ")"); //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() + ")");
}
} }
} }
} }

View File

@ -48,6 +48,8 @@ public enum LangString {
MUTED ("jailing"), MUTED ("jailing"),
/** The message sent when the sender tries to jail someone in a cell and there aren't any cells to suggest. */ /** The message sent when the sender tries to jail someone in a cell and there aren't any cells to suggest. */
NOEMPTYCELLS ("jailing"), 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. */ /** The message sent when a player is not jailed and the sender is trying to see/do something about it. */
NOTJAILED ("jailing"), NOTJAILED ("jailing"),
/** The message sent to the sender when they mute a prisoner. */ /** The message sent to the sender when they mute a prisoner. */

View File

@ -39,6 +39,7 @@ language:
jailedwithreason: '&cYou have been jailed for: %0%' jailedwithreason: '&cYou have been jailed for: %0%'
muted: '&cStop talking, you are in jail.' muted: '&cStop talking, you are in jail.'
noemptycells: '&cNo empty cells were found for %0%, all them appear to be full.' 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.' notjailed: '&c%0% is not jailed.'
nowmuted: '&9%0% is now muted.' nowmuted: '&9%0% is now muted.'
nowunmuted: '&9%0% is now unmuted.' nowunmuted: '&9%0% is now unmuted.'