From 20273315408aa04498c962375dd16643d700a99e Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Thu, 6 Mar 2014 11:33:24 -0600 Subject: [PATCH] When forcefully removing a prisoner, check for a cell. This closes #17 --- src/main/java/com/graywolf336/jail/JailIO.java | 2 ++ src/main/java/com/graywolf336/jail/PrisonerManager.java | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/graywolf336/jail/JailIO.java b/src/main/java/com/graywolf336/jail/JailIO.java index bf58701..4961715 100644 --- a/src/main/java/com/graywolf336/jail/JailIO.java +++ b/src/main/java/com/graywolf336/jail/JailIO.java @@ -886,6 +886,8 @@ public class JailIO { PreparedStatement pp = con.prepareStatement("delete from `" + prefix + "prisoners` where name = ? limit 1;"); pp.setString(1, p.getName()); + pl.debug("Removing " + p.getName() + " from MySQL database."); + pp.executeUpdate(); pp.close(); } catch (SQLException e) { diff --git a/src/main/java/com/graywolf336/jail/PrisonerManager.java b/src/main/java/com/graywolf336/jail/PrisonerManager.java index 33231a2..01013e5 100644 --- a/src/main/java/com/graywolf336/jail/PrisonerManager.java +++ b/src/main/java/com/graywolf336/jail/PrisonerManager.java @@ -417,7 +417,12 @@ public class PrisonerManager { if(player == null) { //Player is offline, we just forcefully remove them from the database pl.getJailIO().removePrisoner(jail, cell, prisoner); - jail.removePrisoner(prisoner); + + if(cell == null) { + jail.removePrisoner(prisoner); + }else { + cell.removePrisoner(); + } }else { try { unJail(jail, cell, player, prisoner);