From b75f12c23c06cda3793b4fe2913ddbcd96c09eda Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Sat, 28 Dec 2013 12:53:07 -0600 Subject: [PATCH] General bug work, there's a small bug in here I can't find...grrr --- .../java/com/graywolf336/jail/PrisonerManager.java | 5 ++++- src/main/java/com/graywolf336/jail/beans/Cell.java | 13 +++++++++---- .../graywolf336/jail/steps/CellCreationSteps.java | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/graywolf336/jail/PrisonerManager.java b/src/main/java/com/graywolf336/jail/PrisonerManager.java index 4568f9a..ff8131e 100644 --- a/src/main/java/com/graywolf336/jail/PrisonerManager.java +++ b/src/main/java/com/graywolf336/jail/PrisonerManager.java @@ -71,7 +71,7 @@ public class PrisonerManager { //Get a message ready for broadcasting or logging. String msg = ""; - if(prisoner.getRemainingTime() < 0) + if(prisoner.getRemainingTime() < 0L) msg = pl.getJailIO().getLanguageString(LangString.BROADCASTMESSAGEFOREVER, new String[] { prisoner.getName() }); else// msg = pl.getJailIO().getLanguageString(LangString.BROADCASTMESSAGEFOREVER, new String[] { prisoner.getName(), String.valueOf(prisoner.getRemainingTimeInMinutes()) }); @@ -213,6 +213,9 @@ public class PrisonerManager { String[] inv = Util.playerInventoryToBase64(player.getInventory()); prisoner.setInventory(inv[0]); prisoner.setArmor(inv[1]); + + player.getInventory().setArmorContents(null); + player.getInventory().clear(); } } diff --git a/src/main/java/com/graywolf336/jail/beans/Cell.java b/src/main/java/com/graywolf336/jail/beans/Cell.java index 41df277..87ec380 100644 --- a/src/main/java/com/graywolf336/jail/beans/Cell.java +++ b/src/main/java/com/graywolf336/jail/beans/Cell.java @@ -115,13 +115,18 @@ public class Cell { * @return true if there is a chest, false if there isn't. */ public boolean hasChest() { - if(getChest() != null) { - if(getChest().getInventory().getSize() >= 40) return true; - else { + Chest c = getChest(); + if(c != null) { + if(c.getInventory().getSize() >= 40) { + Bukkit.getLogger().info("The cell " + this.name + " has a chest."); + return true; + }else { Bukkit.getLogger().severe("The cell " + this.name + " has chest that isn't a double chest, please fix."); return false; } - }else + }else { + Bukkit.getLogger().info("The cell " + this.name + " doesn't have a chest."); return false; + } } } diff --git a/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java b/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java index 998a358..98f8122 100644 --- a/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java +++ b/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java @@ -26,7 +26,7 @@ public class CellCreationSteps { /** Sends the Cell Creation message for starting out. */ public void startStepping(Player player){ - player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------"); + player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation (tp) ----------"); player.sendMessage(ChatColor.GREEN + "First, you must select a teleport point for the cell! Move to the teleport point and then click anywhere with your wooden sword to set it."); player.sendMessage(ChatColor.AQUA + "----------------------------------------"); @@ -75,14 +75,14 @@ public class CellCreationSteps { Vector point = player.getLocation().toVector().clone(); if(Util.isInsideAB(point, v1, v2)) { - player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------"); + player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation (signs) ----------"); player.sendMessage(ChatColor.GREEN + "Teleport point selected. Now select signs associated with this cell. You may select multiple signs. After you are done with the sign selection, right click on any non-sign block."); player.sendMessage(ChatColor.AQUA + "----------------------------------------"); cp.setTeleportIn(player.getLocation()); cp.nextStep(); }else { - player.sendMessage(ChatColor.RED + "---------- Jail Cell Creation ----------"); + player.sendMessage(ChatColor.RED + "---------- Jail Cell Creation (tp) ----------"); player.sendMessage(ChatColor.RED + "Teleport point NOT selected. Please make sure that you are setting the teleport point inside the Jail's corners."); player.sendMessage(ChatColor.RED + "----------------------------------------"); } @@ -94,7 +94,7 @@ public class CellCreationSteps { cp.addSign(new SimpleLocation(block.getLocation())); player.sendMessage(ChatColor.GREEN + "Sign added, if you want to select another go ahead otherwise right click on any non-sign block."); }else { - player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------"); + player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation (chest) ----------"); player.sendMessage(ChatColor.GREEN + (cp.getSigns().size() != 0 ? "Sign selection completed. " : "") + "Now select a double chest associated with this cell. If there is no chest click on any non-chest block. (Please note that having no chest may result in players items being lost.)"); player.sendMessage(ChatColor.AQUA + "----------------------------------------"); cp.nextStep(); @@ -120,7 +120,7 @@ public class CellCreationSteps { player.sendMessage(ChatColor.GREEN + "Chest selected."); player.sendMessage(ChatColor.AQUA + "----------------------------------------"); }else { - player.sendMessage(ChatColor.RED + "---------- Jail Cell Creation ----------"); + player.sendMessage(ChatColor.RED + "---------- Jail Cell Creation (chest) ----------"); player.sendMessage(ChatColor.RED + "Chest must be a double chest, chest not selected"); player.sendMessage(ChatColor.RED + "----------------------------------------"); return;