Only try to jail in a cell if that jail has cells, resolves #51
This commit is contained in:
parent
7e2df93add
commit
0d9ed022f3
@ -154,6 +154,11 @@ public class Jail {
|
||||
this.nocellPrisoners.remove(p.getUUID());
|
||||
}
|
||||
|
||||
/** Returns if there are any cells or not. */
|
||||
public boolean hasCells() {
|
||||
return !this.cells.isEmpty();
|
||||
}
|
||||
|
||||
/** Adds a cell to the Jail. */
|
||||
public void addCell(Cell cell, boolean save) {
|
||||
if(save) plugin.getJailIO().saveCell(this, cell);
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user