Let's try to remove people from the storage system this way.

This commit is contained in:
graywolf336 2013-12-28 15:39:14 -06:00
parent 04d65088e3
commit 05b15cc9b8
2 changed files with 34 additions and 2 deletions

View File

@ -352,4 +352,35 @@ public class JailIO {
break;
}
}
/**
* Removes the prisoner from the storage system.
*
* @param j the jail which the prisoner is in.
* @param p the prisoner data
*/
public void removePrisoner(Jail j, Prisoner p) {
this.removePrisoner(j, null, p);
}
/**
* Removes the prisoner from the storage system.
*
* @param j the jail which the prisoner is in.
* @param c the cell which the prisoner is in, null if none
* @param p the prisoner data
*/
public void removePrisoner(Jail j, Cell c, Prisoner p) {
switch(storage) {
case 1:
case 2:
break;
default:
if(c == null)
flat.set("jails." + j.getName() + ".prisoners." + p.getName(), null);
else
flat.set("jails." + j.getName() + "." + c.getName() + ".prisoner", null);
break;
}
}
}

View File

@ -336,13 +336,14 @@ public class PrisonerManager {
restoreInventory(player, prisoner);
}
pl.getJailIO().removePrisoner(jail, cell, prisoner);
cell.removePrisoner();
}else {
restoreInventory(player, prisoner);
pl.getJailIO().removePrisoner(jail, prisoner);
jail.removePrisoner(prisoner);
}
pl.getJailIO().saveJail(jail);
}
private void restoreInventory(Player player, Prisoner prisoner) {