diff --git a/src/main/java/com/graywolf336/jail/JailIO.java b/src/main/java/com/graywolf336/jail/JailIO.java index fdbf6b3..84347e9 100644 --- a/src/main/java/com/graywolf336/jail/JailIO.java +++ b/src/main/java/com/graywolf336/jail/JailIO.java @@ -378,7 +378,6 @@ public class JailIO { //that doesn't exist anymore List cellsToRemove = new LinkedList(); - int cs = 0; try { if(con == null) this.prepareStorage(false); PreparedStatement ps = con.prepareStatement("SELECT * FROM " + prefix + "cells"); @@ -405,7 +404,6 @@ public class JailIO { j.addCell(c, false); - cs++; }else { cellsToRemove.add(set.getInt("cellid")); } @@ -444,8 +442,6 @@ public class JailIO { } } - pl.getLogger().info("Loaded " + cs + (cs == 1 ? " cell." : " cells.")); - //This list contains a string which refers to the name of the prisoner in sql //this list only gets populated if there are prisoners which reference a jail //that doesn't exist anymore @@ -538,6 +534,9 @@ public class JailIO { int js = pl.getJailManager().getJails().size(); pl.getLogger().info("Loaded " + js + (js == 1 ? " jail." : " jails.")); + int cs = pl.getJailManager().getAllCells().size(); + pl.getLogger().info("Loaded " + cs + (cs == 1 ? " cell." : " cells.")); + int ps = pl.getJailManager().getAllPrisoners().size(); pl.getLogger().info("Loaded " + ps + (ps == 1 ? " prisoner." : " prisoners.")); } diff --git a/src/main/java/com/graywolf336/jail/JailManager.java b/src/main/java/com/graywolf336/jail/JailManager.java index 4631136..005278d 100644 --- a/src/main/java/com/graywolf336/jail/JailManager.java +++ b/src/main/java/com/graywolf336/jail/JailManager.java @@ -155,6 +155,20 @@ public class JailManager { return this.jails.get(name) != null; } + /** + * Gets all the {@link Cell cells} in the jail system, best for system wide count of the cells or touching each cell. + * + * @return HashSet of all the Cells. + */ + public HashSet getAllCells() { + HashSet cells = new HashSet(); + + for(Jail j : jails.values()) + cells.addAll(j.getCells()); + + return cells; + } + /** * Gets all the prisoners in the system, best for a system wide count of the prisoners or accessing all the prisoners at once. * @@ -163,9 +177,8 @@ public class JailManager { public HashSet getAllPrisoners() { HashSet prisoners = new HashSet(); - for(Jail j : jails.values()) { + for(Jail j : jails.values()) prisoners.addAll(j.getAllPrisoners()); - } return prisoners; }