Let's try to remove people from the storage system this way.
This commit is contained in:
parent
04d65088e3
commit
05b15cc9b8
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user