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;
import java.util.HashSet;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@ -38,6 +40,12 @@ public class JailListCommand implements Command {
if(j == null) {
//No jail was found
sender.sendMessage(" " + jm.getPlugin().getJailIO().getLanguageString(LangString.NOJAIL, args[1]));
}else {
HashSet<Prisoner> 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)
@ -47,6 +55,7 @@ public class JailListCommand implements Command {
}
}
}
}
sender.sendMessage(ChatColor.AQUA + "-------------------------");
return true;

View File

@ -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. */

View File

@ -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.'