Bukkit/CraftBukkit — pull request #1403 by JeromSar (2014-07-31 11:51:53+00:00)
Title: [B+C] Add keepInventory API. Adds BUKKIT-5724

**The Issue:**
There is currently no easy way to designate that a player's inventory should be kept when a player dies through an `PlayerDeathEvent`.

**Justification for this PR:**
This PR adds functionality to PlayerDeathEvent. Plugins can now use `event.setKeepInventory(true)` to designate that a player's inventory is to be kept at respawn.

**PR Breakdown:*
Plugins will now be able to use `PlayerDeathEvent.setKeepInventory(boolean)` and `PlayerDeathEvent.getKeepInventory()`. `getKeepInventory()` will return the value that would occur if the event is left unchanged as defined by the appropriate GameRule. When a player dies (`EntityPlayer.die()`), the event will be instantiated with the value of its default behaviour. Plugins may then modify this result when the event is handled. The result dictates if

**Testing Results and Materials:**
A simple test can be found here: https://github.com/JeromSar/KeepInventoryTest
A compiled binary can be found here: https://github.com/JeromSar/KeepInventoryTest/releases

The plugin in question demonstrates the new functionality by keeping the inventory for operators whilst keeping the default behaviour for non-operators. This way, the newly added functionality can be easily tested. It also displays the default value before modifying it, thus the default `keepInventory` behaviour as defined by its designated GameRule can be verify.

**Relevant PR(s)**
https://github.com/Bukkit/Bukkit/pull/1090

**JIRA Tickets:**
https://bukkit.atlassian.net/browse/BUKKIT-5724