summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJerom van der Sar <jerom.sar@hotmail.com>2014-07-31 02:58:06 +0200
committerturt2live <travpc@gmail.com>2014-08-17 11:40:42 -0600
commit1c220ddc6e03804837ab71e341a2bac6a7f6b1ce (patch)
tree97971e17514490b91e933335136d358dacad86d4 /src/main
parentf0ab5b0aec4f74859fa18029f99030530c4090c5 (diff)
downloadbukkit-1c220ddc6e03804837ab71e341a2bac6a7f6b1ce.tar
bukkit-1c220ddc6e03804837ab71e341a2bac6a7f6b1ce.tar.gz
bukkit-1c220ddc6e03804837ab71e341a2bac6a7f6b1ce.tar.lz
bukkit-1c220ddc6e03804837ab71e341a2bac6a7f6b1ce.tar.xz
bukkit-1c220ddc6e03804837ab71e341a2bac6a7f6b1ce.zip
Add ability to keep items on death via plugins. Adds BUKKIT-5724
When a player dies their inventory is normally scattered over the the area in which they died. Plugins should be able to modify this behaviour by defining whether or not the player's inventory will be dropped on the ground or waiting for the player when they eventually respawn. This commit adds the methods required to the PlayerDeathEvent for plugins to be able to incorporate the behaviour mentioned as a simple boolean flag.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index b773d6e5..6c9b7942 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -14,6 +14,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private int newLevel = 0;
private int newTotalExp = 0;
private boolean keepLevel = false;
+ private boolean keepInventory = false;
public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final String deathMessage) {
this(player, drops, droppedExp, 0, deathMessage);
@@ -135,4 +136,22 @@ public class PlayerDeathEvent extends EntityDeathEvent {
public void setKeepLevel(boolean keepLevel) {
this.keepLevel = keepLevel;
}
+
+ /**
+ * Sets if the Player keeps inventory on death.
+ *
+ * @param keepInventory True to keep the inventory
+ */
+ public void setKeepInventory(boolean keepInventory) {
+ this.keepInventory = keepInventory;
+ }
+
+ /**
+ * Gets if the Player keeps inventory on death.
+ *
+ * @return True if the player keeps inventory on death
+ */
+ public boolean getKeepInventory() {
+ return keepInventory;
+ }
}