Only try to jail in a cell if that jail has cells, resolves #51

This commit is contained in:
graywolf336
2015-02-16 15:00:14 -06:00
parent 7e2df93add
commit 0d9ed022f3
2 changed files with 13 additions and 1 deletions

View File

@ -152,7 +152,14 @@ public class JailCommand implements Command {
//If they want just any open cell or automatic jailing in cells is turned on
//and a cell wasn't already found, then find try to find a cell
if((params.isAnyCell() || jm.getPlugin().getConfig().getBoolean(Settings.AUTOMATICCELL.getPath(), true)) && c == null) {
if(params.isAnyCell() && c == null) {
c = jm.getJail(jailName).getFirstEmptyCell();
if(c == null) {
//If there wasn't an empty cell, then tell them so.
sender.sendMessage(Lang.NOEMPTYCELLS.get(jailName));
return true;
}
}else if(jm.getPlugin().getConfig().getBoolean(Settings.AUTOMATICCELL.getPath(), true) && j.hasCells() && c == null) {
c = jm.getJail(jailName).getFirstEmptyCell();
if(c == null) {
//If there wasn't an empty cell, then tell them so.