Package org.bukkit.event.entity
Class PlayerDeathEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityDeathEvent
org.bukkit.event.entity.PlayerDeathEvent
Thrown whenever a 
Player dies- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.entity.EntityEvententity
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, int newTotalExp, int newLevel, String deathMessage)PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, String deathMessage)PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, String deathMessage)
- 
Method SummaryModifier and TypeMethodDescriptionGet the death message that will appear to everyone on the server.Returns the Entity involved in this eventbooleanGets if the Player keeps inventory on death.booleanGets if the Player should keep all EXP at respawn.intGets how much EXP the Player should have at respawn.intGets the Level the Player should have at respawn.intGets the Total EXP the Player should have at respawn.voidsetDeathMessage(String deathMessage)Set the death message that will appear to everyone on the server.voidsetKeepInventory(boolean keepInventory)Sets if the Player keeps inventory on death.voidsetKeepLevel(boolean keepLevel)Sets if the Player should keep all EXP at respawn.voidsetNewExp(int exp)Sets how much EXP the Player should have at respawn.voidsetNewLevel(int level)Sets the Level the Player should have at respawn.voidsetNewTotalExp(int totalExp)Sets the Total EXP the Player should have at respawn.Methods inherited from class org.bukkit.event.entity.EntityDeathEventgetDroppedExp, getDrops, getHandlerList, getHandlers, setDroppedExpMethods inherited from class org.bukkit.event.entity.EntityEventgetEntityTypeMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
PlayerDeathEvent
- 
PlayerDeathEvent
- 
PlayerDeathEvent
 
- 
- 
Method Details- 
getEntityDescription copied from class:EntityEventReturns the Entity involved in this event- Overrides:
- getEntityin class- EntityDeathEvent
- Returns:
- Entity who is involved in this event
 
- 
setDeathMessageSet the death message that will appear to everyone on the server.- Parameters:
- deathMessage- Message to appear to other players on the server.
 
- 
getDeathMessageGet the death message that will appear to everyone on the server.- Returns:
- Message to appear to other players on the server.
 
- 
getNewExppublic int getNewExp()Gets how much EXP the Player should have at respawn.This does not indicate how much EXP should be dropped, please see EntityDeathEvent.getDroppedExp()for that.- Returns:
- New EXP of the respawned player
 
- 
setNewExppublic void setNewExp(int exp)Sets how much EXP the Player should have at respawn.This does not indicate how much EXP should be dropped, please see EntityDeathEvent.setDroppedExp(int)for that.- Parameters:
- exp- New EXP of the respawned player
 
- 
getNewLevelpublic int getNewLevel()Gets the Level the Player should have at respawn.- Returns:
- New Level of the respawned player
 
- 
setNewLevelpublic void setNewLevel(int level)Sets the Level the Player should have at respawn.- Parameters:
- level- New Level of the respawned player
 
- 
getNewTotalExppublic int getNewTotalExp()Gets the Total EXP the Player should have at respawn.- Returns:
- New Total EXP of the respawned player
 
- 
setNewTotalExppublic void setNewTotalExp(int totalExp)Sets the Total EXP the Player should have at respawn.- Parameters:
- totalExp- New Total EXP of the respawned player
 
- 
getKeepLevelpublic boolean getKeepLevel()Gets if the Player should keep all EXP at respawn.This flag overrides other EXP settings - Returns:
- True if Player should keep all pre-death exp
 
- 
setKeepLevelpublic void setKeepLevel(boolean keepLevel)Sets if the Player should keep all EXP at respawn.This overrides all other EXP settings This doesn't prevent the EXP from dropping. EntityDeathEvent.setDroppedExp(int)should be used stop the EXP from dropping.- Parameters:
- keepLevel- True to keep all current value levels
 
- 
setKeepInventorypublic void setKeepInventory(boolean keepInventory)Sets if the Player keeps inventory on death.This doesn't prevent the items from dropping. getDrops().clear()should be used stop the items from dropping.- Parameters:
- keepInventory- True to keep the inventory
 
- 
getKeepInventorypublic boolean getKeepInventory()Gets if the Player keeps inventory on death.- Returns:
- True if the player keeps inventory on death
 
 
-