diff --git a/src/main/java/com/graywolf336/jail/beans/Cell.java b/src/main/java/com/graywolf336/jail/beans/Cell.java index 11bd985..65882a3 100644 --- a/src/main/java/com/graywolf336/jail/beans/Cell.java +++ b/src/main/java/com/graywolf336/jail/beans/Cell.java @@ -42,6 +42,7 @@ public class Cell { return this.p; } + /** Nullifies the prisoner data. */ public void removePrisoner() { this.p = null; } diff --git a/src/main/java/com/graywolf336/jail/command/commands/JailCommand.java b/src/main/java/com/graywolf336/jail/command/commands/JailCommand.java index b31de48..f9a545f 100644 --- a/src/main/java/com/graywolf336/jail/command/commands/JailCommand.java +++ b/src/main/java/com/graywolf336/jail/command/commands/JailCommand.java @@ -94,6 +94,17 @@ public class JailCommand implements Command { if(!params.cell().isEmpty()) { if(jm.getJail(params.jail()).getCell(params.cell()) == null) { sender.sendMessage(ChatColor.RED + "The cell provided does not exist."); + return true; + }else if(jm.getJail(params.jail()).getCell(params.cell()).hasPrisoner()) { + //If the cell has a prisoner, don't allow jailing them to that particular cell + sender.sendMessage(ChatColor.RED + "The destination cell already has a prisoner in it."); + Cell suggestedCell = jm.getJail(params.jail()).getFirstEmptyCell(); + if(suggestedCell != null) { + sender.sendMessage(ChatColor.RED + "We found an empty cell in the same jail (" + params.jail() + ") with the name: " + suggestedCell.getName()); + }else { + sender.sendMessage(ChatColor.RED + "We didn't find any empty cells, this jail's (" + params.jail() + ") cells appear to be full"); + } + return true; } }