类 PlayerDeathEvent


public class PlayerDeathEvent extends EntityDeathEvent
当一个玩家死亡时触发本事件
  • 构造器详细资料

  • 方法详细资料

    • getEntity

      @NotNull public @NotNull Player getEntity()
      从类复制的说明: EntityEvent
      返回这个事件所涉及的实体.

      原文: Returns the Entity involved in this event

      覆盖:
      getEntity 在类中 EntityDeathEvent
      返回:
      涉及这个事件的实体
    • setDeathMessage

      public void setDeathMessage(@Nullable @Nullable String deathMessage)
      设置广播给所有人的死亡提示.

      原文: Set the death message that will appear to everyone on the server.

      参数:
      deathMessage - 死亡提示
    • getDeathMessage

      @Nullable public @Nullable String 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)
      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 - New EXP of the respawned player
    • getNewLevel

      public int getNewLevel()
      Gets the Level the Player should have at respawn.
      返回:
      New Level of the respawned player
    • setNewLevel

      public void setNewLevel(int level)
      Sets the Level the Player should have at respawn.
      参数:
      level - New Level of the respawned player
    • getNewTotalExp

      public int getNewTotalExp()
      Gets the Total EXP the Player should have at respawn.
      返回:
      New Total EXP of the respawned player
    • setNewTotalExp

      public void setNewTotalExp(int totalExp)
      Sets the Total EXP the Player should have at respawn.
      参数:
      totalExp - New Total EXP of the respawned player
    • getKeepLevel

      public boolean getKeepLevel()
      Gets if the Player should keep all EXP at respawn.

      This flag overrides other EXP settings

      返回:
      True if Player should keep all pre-death exp
    • setKeepLevel

      public 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.

      参数:
      keepLevel - True to keep all current value levels
    • setKeepInventory

      public 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.

      参数:
      keepInventory - True to keep the inventory
    • getKeepInventory

      public boolean getKeepInventory()
      Gets if the Player keeps inventory on death.
      返回:
      True if the player keeps inventory on death