diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-01-14 17:54:03 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2012-01-14 17:54:03 +0000 |
commit | d36385d28fc77130119dd64777cc608c79289ca5 (patch) | |
tree | 0fc8ccaacefd6163466ee30cc872f61ba7348f5d | |
parent | 2c1cd77cdca435e855fa5cd1844c697b029cad32 (diff) | |
download | bukkit-d36385d28fc77130119dd64777cc608c79289ca5.tar bukkit-d36385d28fc77130119dd64777cc608c79289ca5.tar.gz bukkit-d36385d28fc77130119dd64777cc608c79289ca5.tar.lz bukkit-d36385d28fc77130119dd64777cc608c79289ca5.tar.xz bukkit-d36385d28fc77130119dd64777cc608c79289ca5.zip |
Added new methods to set a players respawned level/exp/totalExp in PlayerDeathEvent. Thanks to Feildmaster for the PR.
-rw-r--r-- | src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java index 46c650d7..a06359ae 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -12,10 +12,23 @@ import org.bukkit.inventory.ItemStack; public class PlayerDeathEvent extends EntityDeathEvent { private int newExp = 0; private String deathMessage = ""; + private int newLevel = 0; + private int newTotalExp = 0; + private boolean keepLevel = false; + public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, String deathMessage) { + this(player, drops, droppedExp, 0, deathMessage); + } + public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, String deathMessage) { + this(player, drops, droppedExp, newExp, 0, 0, deathMessage); + } + + public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, int newTotalExp, int newLevel, String deathMessage) { super(player, drops, droppedExp); this.newExp = newExp; + this.newTotalExp = newTotalExp; + this.newLevel = newLevel; this.deathMessage = deathMessage; } @@ -34,7 +47,7 @@ public class PlayerDeathEvent extends EntityDeathEvent { * @return Message to appear to other players on the server. */ public String getDeathMessage() { - return this.deathMessage; + return deathMessage; } /** @@ -58,6 +71,64 @@ public class PlayerDeathEvent extends EntityDeathEvent { * @get exp New EXP of the respawned player */ public void setNewExp(int exp) { - this.newExp = exp; + newExp = exp; + } + + /** + * Gets the Level the Player should have at respawn. + * + * @return New Level of the respawned player + */ + public int getNewLevel() { + return newLevel; + } + + /** + * Sets the Level the Player should have at respawn. + * + * @get level New Level of the respawned player + */ + public void setNewLevel(int level) { + newLevel = level; + } + + /** + * Gets the Total EXP the Player should have at respawn. + * + * @return New Total EXP of the respawned player + */ + public int getNewTotalExp() { + return newTotalExp; + } + + /** + * Sets the Total EXP the Player should have at respawn. + * + * @get totalExp New Total EXP of the respawned player + */ + public void setNewTotalExp(int totalExp) { + newTotalExp = totalExp; + } + + /** + * Gets if the Player should keep all EXP at respawn. + * <p> + * This flag overrides other EXP settings + * + * @return True if Player should keep all pre-death exp + */ + public boolean getKeepLevel() { + return keepLevel; + } + + /** + * Sets if the Player should keep all EXP at respawn. + * <p> + * This overrides all other EXP settings + * + * @param keepLevel True to keep all current value levels + */ + public void setKeepLevel(boolean keepLevel) { + this.keepLevel = keepLevel; } } |