类 PlayerDeathEvent
玩家
死亡时触发本事件-
嵌套类概要
从类继承的嵌套类/接口 org.bukkit.event.Event
Event.Result
-
字段概要
从类继承的字段 org.bukkit.event.entity.EntityEvent
entity
-
构造器概要
构造器说明PlayerDeathEvent
(@NotNull Player player, @NotNull DamageSource damageSource, @NotNull List<ItemStack> drops, int droppedExp, int newExp, int newTotalExp, int newLevel, @Nullable String deathMessage) PlayerDeathEvent
(@NotNull Player player, @NotNull DamageSource damageSource, @NotNull List<ItemStack> drops, int droppedExp, int newExp, @Nullable String deathMessage) PlayerDeathEvent
(@NotNull Player player, @NotNull DamageSource damageSource, @NotNull List<ItemStack> drops, int droppedExp, @Nullable String deathMessage) -
方法概要
修饰符和类型方法说明获取广播给所有人的死亡提示.返回这个事件所涉及的实体.boolean
获取玩家在死亡时是否保留物品栏。boolean
获取玩家在重生时是否应该保留所有经验值。int
获取玩家重生时有多少经验.int
获取玩家在重生时应该拥有的等级。int
获取玩家在重生时应该拥有的总经验值。void
setDeathMessage
(@Nullable String deathMessage) 设置广播给所有人的死亡提示.void
setKeepInventory
(boolean keepInventory) 设置玩家在死亡时是否保留物品栏。void
setKeepLevel
(boolean keepLevel) 设置玩家在重生时是否应该保留所有经验值。void
setNewExp
(int exp) 设置玩家在重生时应该拥有多少经验值。void
setNewLevel
(int level) 设置玩家在重生时应该拥有的等级。void
setNewTotalExp
(int totalExp) 设置玩家在重生时应该拥有的总经验值。从类继承的方法 org.bukkit.event.entity.EntityDeathEvent
getDamageSource, getDroppedExp, getDrops, getHandlerList, getHandlers, setDroppedExp
从类继承的方法 org.bukkit.event.entity.EntityEvent
getEntityType
从类继承的方法 org.bukkit.event.Event
getEventName, isAsynchronous
-
构造器详细资料
-
PlayerDeathEvent
-
PlayerDeathEvent
-
PlayerDeathEvent
-
-
方法详细资料
-
getEntity
从类复制的说明:EntityEvent
返回这个事件所涉及的实体.原文: Returns the Entity involved in this event
- 覆盖:
getEntity
在类中EntityDeathEvent
- 返回:
- 涉及这个事件的实体
-
setDeathMessage
设置广播给所有人的死亡提示.原文: Set the death message that will appear to everyone on the server.
- 参数:
deathMessage
- 死亡提示
-
getDeathMessage
获取广播给所有人的死亡提示.原文:Get the death message that will appear to everyone on the server.
- 返回:
- 死亡提示
-
getNewExp
public int getNewExp()获取玩家重生时有多少经验.不包含多少经验会掉落,要做到这点请看
EntityDeathEvent.getDroppedExp()
.原文: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.- 返回:
- 重生后的玩家有多少经验
-
setNewExp
public void setNewExp(int exp) 设置玩家在重生时应该拥有多少经验值。这并不表示应该掉落多少经验值,请参见
EntityDeathEvent.setDroppedExp(int)
。原文: 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.- 参数:
exp
- 重生玩家的新经验值
-
getNewLevel
public int getNewLevel()获取玩家在重生时应该拥有的等级。原文: Gets the Level the Player should have at respawn.
- 返回:
- 重生玩家的新等级
-
setNewLevel
public void setNewLevel(int level) 设置玩家在重生时应该拥有的等级。原文: Sets the Level the Player should have at respawn.
- 参数:
level
- 重生玩家的新等级
-
getNewTotalExp
public int getNewTotalExp()获取玩家在重生时应该拥有的总经验值。原文: Gets the Total EXP the Player should have at respawn.
- 返回:
- 重生玩家的新总经验值
-
setNewTotalExp
public void setNewTotalExp(int totalExp) 设置玩家在重生时应该拥有的总经验值。原文: Sets the Total EXP the Player should have at respawn.
- 参数:
totalExp
- 重生玩家的新总经验值
-
getKeepLevel
public boolean getKeepLevel()获取玩家在重生时是否应该保留所有经验值。此标志会覆盖其他经验值设置。
原文: Gets if the Player should keep all EXP at respawn.
This flag overrides other EXP settings
- 返回:
- 如果玩家应该保留所有死亡前的经验值,则返回 true
-
setKeepLevel
public void setKeepLevel(boolean keepLevel) 设置玩家在重生时是否应该保留所有经验值。这会覆盖所有其他经验值设置。
这并不会阻止经验值掉落。应使用
EntityDeathEvent.setDroppedExp(int)
来阻止经验值掉落。原文: 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.- 参数:
keepLevel
- 如果为 true,则保留所有当前经验值
-
setKeepInventory
public void setKeepInventory(boolean keepInventory) 设置玩家在死亡时是否保留物品栏。这并不会阻止物品掉落。应使用
getDrops().clear()
来阻止物品掉落。原文: 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.- 参数:
keepInventory
- 如果为 true,则保留物品栏
-
getKeepInventory
public boolean getKeepInventory()获取玩家在死亡时是否保留物品栏。原文: Gets if the Player keeps inventory on death.
- 返回:
- 如果玩家在死亡时保留物品栏,则返回 true
-