EntityExhaustionEvent
EntityExhaustionEvent
=> org.bukkit.event.Event
=> org.bukkit.event.entity.EntityEvent
=> org.bukkit.event.entity.EntityExhaustionEvent
Called when a human entity experiences exhaustion.An exhaustion level greater than 4.0 causes a decrease in saturation by 1.当玩家的饥饿等级(Exhaustion level)增加时触发。如果饥饿等级累积至四或以上,则饱和度会减少一。译注:参见Minecraft Wiki
中的相关页面 https://minecraft.fandom.com/wiki/Hunger#Exhaustion_level_increase 可知,玩家在完成特定操作(如疾跑、如挖掘方块等)时,会累积饥饿等级(Exhaustion level),该值一旦大于等于四,则自减四,并扣除一点饱和度(Saturation)。如果饱和度为零则扣除一点饥饿值(Food Level)。如欲监听玩家饥饿值变化,可参见FoodLevelChangeEvent
。
方法声明: public ExhaustionReason getExhaustionReason()
方法签名: ()Lorg/bukkit/event/entity/EntityExhaustionEvent/ExhaustionReason;
Gets the {@link ExhaustionReason} for this event@return the exhaustion reason该方法用于获取饥饿等级增加的原因。@return 一个ExhaustionReason
枚举字段,用于确定饥饿等级增加的原因。
方法声明: public float getExhaustion()
方法签名: ()F
Get the amount of exhaustion to add to the player's current exhaustion.@return amount of exhaustion该方法用于获取饥饿等级的增加量。@return 饥饿等级的增加量。
方法声明: public void setExhaustion(float exhaustion)
方法签名: (F)V
Set the exhaustion to apply to the player.The maximum exhaustion that a player can have is 40. No error will bethrown if this limit is hit. This value may be negative, but there isunknown behavior for when exhaustion is below 0.@param exhaustion new exhaustion to add该方法用于设置饥饿等级的增加量。玩家所能拥有的最大饥饿等级是四十。但如果超出了这一上限,也不会抛出错误。饥饿等级可以被设为负值,但这样做后果未知。@param exhaustion 饥饿等级的增加量。
方法声明: public HumanEntity getEntity()
方法签名: ()Lorg/bukkit/entity/HumanEntity;
译注:无文档。该方法用于获取涉事玩家。
方法声明: public boolean isCancelled()
方法签名: ()Z
方法声明: public void setCancelled(boolean cancel)
方法签名: (Z)V
方法声明: public HandlerList getHandlers()
方法签名: ()Lorg/bukkit/event/HandlerList;
方法声明: public static HandlerList getHandlerList()
方法签名: ()Lorg/bukkit/event/HandlerList;
The reason for why a PlayerExhaustionEvent takes place用于确定玩家饥饿等级增加的枚举。
Player mines a block玩家挖掘了方块。
Player has the hunger potion effect玩家拥有饥饿药水效果。
Player takes damage玩家受到伤害。
Player attacks another entity玩家攻击某个实体。
Player is sprint jumping玩家在疾跑状态下跳跃。
Player jumps玩家跳跃。
Player swims one centimeter玩家游泳。
Player walks underwater one centimeter玩家在水下行走。
Player moves on the surface of water one centimeter玩家漂浮在水面附近移动。
Player sprints one centimeter玩家疾跑。
Player crouches one centimeter (does not effect exhaustion, but firesnonetheless)玩家潜行(潜行不会影响饥饿等级,但仍然致使本事件被触发)。
Player walks one centimeter (does not effect exhaustion, but firesnonetheless)玩家行走(行走不会影响饥饿等级,但仍然致使本事件被触发)。
Player regenerated health玩家回复血量。
Unknown exhaustion reason未知原因。
Last modified 1mo ago