Correctly log how many prisoners were loaded.
This commit is contained in:
parent
998c7bd824
commit
0981fe659f
@ -450,7 +450,6 @@ public class JailIO {
|
||||
//that doesn't exist anymore
|
||||
List<String> prisonersToRemove = new LinkedList<String>();
|
||||
|
||||
int pc = 0;
|
||||
try {
|
||||
if(con == null) this.prepareStorage(false);
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM " + prefix + "prisoners");
|
||||
@ -481,8 +480,6 @@ public class JailIO {
|
||||
//the prisoner is assigned to a cell which doesn't exist, so just put them into the jail
|
||||
j.addPrisoner(p);
|
||||
}
|
||||
|
||||
pc++;
|
||||
} else {
|
||||
//if the jail doesn't exist, do the same as the cells
|
||||
prisonersToRemove.add(set.getString("name"));
|
||||
@ -522,8 +519,6 @@ public class JailIO {
|
||||
}
|
||||
}
|
||||
|
||||
pl.getLogger().info("Loaded " + pc + (pc == 1 ? " prisoner." : " prisoners."));
|
||||
|
||||
pl.debug("Took " + (System.currentTimeMillis() - st) + " millis.");
|
||||
break;
|
||||
default:
|
||||
@ -541,6 +536,9 @@ public class JailIO {
|
||||
|
||||
int js = pl.getJailManager().getJails().size();
|
||||
pl.getLogger().info("Loaded " + js + (js == 1 ? " jail." : " jails."));
|
||||
|
||||
int ps = pl.getJailManager().getAllPrisoners().size();
|
||||
pl.getLogger().info("Loaded " + ps + (ps == 1 ? " prisoner." : " prisoners."));
|
||||
}
|
||||
|
||||
private void loadJailFromFlatFile(String name) {
|
||||
|
@ -154,6 +154,21 @@ public class JailManager {
|
||||
return this.jails.get(name) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the prisoners in the system, best for a system wide count of the prisoners or accessing all the prisoners at once.
|
||||
*
|
||||
* @return HashSet of Prisoners.
|
||||
*/
|
||||
public HashSet<Prisoner> getAllPrisoners() {
|
||||
HashSet<Prisoner> prisoners = new HashSet<Prisoner>();
|
||||
|
||||
for(Jail j : jails.values()) {
|
||||
prisoners.addAll(j.getAllPrisoners());
|
||||
}
|
||||
|
||||
return prisoners;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link Jail jail} the given prisoner is in.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user