Clear inventory only when storing, fixes #57

We shouldn't be clearing a prisoner's inventory on getting released from
jail if we aren't supposed to be storing it.

And update the readme file
This commit is contained in:
graywolf336 2015-05-26 16:16:30 -05:00
parent ab10bc9a4d
commit 25835a1702
2 changed files with 41 additions and 26 deletions

View File

@ -14,6 +14,14 @@ Beta 5 Changes
===
*Changes since Beta 4*
* Added the ability to show `reason`, `jail`, and `cell` to the broadcast messages. [#53](https://github.com/graywolf336/Jail/issues/53)
* Changed how we handle inventory when storing is set to false. Don't remove their inventory when they are unjailed and we don't store it. [#57](https://github.com/graywolf336/Jail/issues/57)
* Changed the jail api, see [#72's comment](https://github.com/graywolf336/Jail/issues/72#issuecomment-104757472) for some details
* Changed the format of the jail check command, thanks to stevoh6. [#65](https://github.com/graywolf336/Jail/pull/65)
* Changed the explanation of why the gamemode setting was problematic and give the available options. [#73](https://github.com/graywolf336/Jail/issues/73)
* Fixed an issue where cell data was being duplicated (or more) in the database [#74](https://github.com/graywolf336/Jail/issues/74)
* Fixed jail sticks not putting players into cells. [#68](https://github.com/graywolf336/Jail/issues/68)
* Fixed respawning after dying not placing players back into their cells when another plugin sets their respawn point. [#55](https://github.com/graywolf336/Jail/issues/55)
* Fixed time being added/subtracted from a player's time when they were jailed forever, resulting in them being able to get out. [#69](https://github.com/graywolf336/Jail/issues/69)
[Beta 4](https://github.com/graywolf336/Jail/releases/tag/v3.0.0-beta.4) Changes
===

View File

@ -465,15 +465,19 @@ public class PrisonerManager {
player.setGameMode(prisoner.getPreviousGameMode());
}
//Now, let's restore their inventory
//First up, clear their inventory
//Now, let's restore their inventory if we can store it but
//first up is clearing their inventory...if we can store it
boolean store = pl.getConfig().getBoolean(Settings.JAILEDSTOREINVENTORY.getPath(), true);
if(store) {
player.closeInventory();
player.getInventory().setArmorContents(null);
player.getInventory().clear();
}
//if the cell isn't null, let's check if the cell has a chest and if so then try out best to restore
//the prisoner's inventory from that
if(cell != null) {
if(store) {
if(cell.hasChest()) {
Inventory chest = cell.getChest().getInventory();
@ -499,11 +503,14 @@ public class PrisonerManager {
}else {
Util.restoreInventory(player, prisoner);
}
}else {
if(cell.hasChest()) cell.getChest().getInventory().clear();
}
pl.getJailIO().removePrisoner(jail, cell == null ? null : (Cell)cell, prisoner);
pl.getJailIO().removePrisoner(jail, (Cell)cell, prisoner);
cell.removePrisoner();
}else {
Util.restoreInventory(player, prisoner);
if(store) Util.restoreInventory(player, prisoner);
pl.getJailIO().removePrisoner(jail, prisoner);
jail.removePrisoner(prisoner);