EntityPotionEffectEvent
EntityPotionEffectEvent
=> org.bukkit.event.Event
=> org.bukkit.event.entity.EntityEvent
=> org.bukkit.event.entity.EntityPotionEffectEvent
Called when a potion effect is modified on an entity.If the event is cancelled, no change will be made on the entity.当实体所携带的药水效果变化时触发。如果本事件被取消,则涉事实体身上的药水效果保持不变。
方法声明: public PotionEffect getOldEffect()
方法签名: ()Lorg/bukkit/potion/PotionEffect;
Gets the old potion effect of the changed type, which will be removed.@return The old potion effect or null if the entity did not have thechanged effect type.该方法用于获取将被覆盖的旧药水效果对象。@return 旧药水效果对象。如果实体身上原先没有涉事药水效果类型,则返回null
。译注:比如玩家在某信标的作用范围内,则该信标会不断更新玩家身上药水效果的时长。这种情况下本方法的返回值不是null
。而如果没有相应药水效果的玩家初次踏足信标作用范围,则本方法会返回null
。
方法声明: public PotionEffect getNewEffect()
方法签名: ()Lorg/bukkit/potion/PotionEffect;
Gets new potion effect of the changed type to be applied.@return The new potion effect or null if the effect of the changed typewill be removed.该方法用于获取涉事实体将得到的新药水效果对象。@return 新的药水效果对象。如果本事件发生时涉事实体身上的该种药水效果将被移除,则返回null
。译注:比如玩家在某信标的作用范围内,则该信标会不断更新玩家身上药水效果的时长。这种情况下本方法的返回值不是null
。而如果该玩家离开了信标作用范围,一段时间后药水效果消失,则本方法会返回null
。
方法声明: public Cause getCause()
方法签名: ()Lorg/bukkit/event/entity/EntityPotionEffectEvent/Cause;
Gets the cause why the effect has changed.@return A Cause value why the effect has changed.该方法用于获取实体所携带的药水效果变化的原因。@return 一个Cause
枚举字段,用于确定实体所携带的药水效果变化的原因。
方法声明: public Action getAction()
方法签名: ()Lorg/bukkit/event/entity/EntityPotionEffectEvent/Action;
Gets the action which will be performed on the potion effect type.@return An action to be performed on the potion effect type.该方法用于获取对涉事药水效果对象将采取的操作。@return 一个Action
枚举字段,用于确定对涉事药水效果对象将采取的操作。
方法声明: public PotionEffectType getModifiedType()
方法签名: ()Lorg/bukkit/potion/PotionEffectType;
Gets the modified potion effect type.@return The effect type which will be modified on the entity.该方法用于获取涉事实体将得到的新药水效果类型。@return 涉事实体将得到的新药水效果类型。
方法声明: public boolean isOverride()
方法签名: ()Z
Returns if the new potion effect will override the old potion effect(Only applicable for the CHANGED Action).@return If the new effect will override the old one.该方法用于获取新药水效果是否会覆盖旧药水效果。(只有getAction()
方法返回Action#CHANGED
字段时,本方法才有意义)。@return 新药水效果是否会覆盖旧药水效果。
方法声明: public void setOverride(boolean override)
方法签名: (Z)V
Sets if the new potion effect will override the old potion effect (Onlyapplicable for the CHANGED action).@param override If the new effect will override the old one.该方法用于设置新药水效果是否会覆盖旧药水效果。(只有getAction()
方法返回Action#CHANGED
字段时,本方法才有意义)。@param override 新药水效果是否会覆盖旧药水效果。
方法声明: 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;
An enum to specify the action to be performed.用于确定将对原有药水效果对象采取何种操作的枚举。
When the potion effect is added because the entity didn't have it'stype.原先没有这种类型的药水效果对象,直接添加药水效果。
When the entity already had the potion effect type, but the effect ischanged.原先已有这种类型的药水效果对象,改变原有药水效果。译注:比如改变时长等。
When the effect is removed due to all effects being removed.原先的全部药水效果都被清除。
When the potion effect type is completely removed.原先已有这种类型的药水效果对象,将其清除。
An enum to specify the cause why an effect was changed.用于确定药水效果改变原因的枚举。
When the entity stands inside an area effect cloud.实体步入某一药水云中,获得药水效果。
When the entity is hit by an spectral or tipped arrow.实体被一支光灵箭或药水箭射中,获得药水效果。
When the entity is inflicted with a potion effect due to an entityattack (e.g. a cave spider or a shulker bullet).由于承受了攻击(如洞穴蜘蛛的攻击、如潜影贝导弹等),受伤害的实体被施加了药水效果。
When beacon effects get applied due to the entity being nearby.激活的信标给周遭实体施加药水效果。
When a potion effect is changed due to the /effect command.由于原版指令/effect
,实体身上的药水效果发生改变。
When the entity gets the effect from a conduit.激活的潮涌核心给周遭实体施加药水效果。
When a conversion from a villager zombie to a villager is started orfinished.在僵尸村民被治愈过程的始末,僵尸村民获得力量效果。
When all effects are removed due to death (Note: This is called onrespawn, so it's player only!)由于实体死亡,其所携带的全部药水效果被清空(清空药水效果这一过程是重生时发生的,所以本字段专指玩家复活的情况)。
When the entity gets the effect from a dolphin.海豚给周遭实体施加海豚的恩惠药水效果。
When the effect was removed due to expiration.药水效果持续时长减为零,自然失效。
When an effect is inflicted due to food (e.g. when a player eats or acookie is given to a parrot).服用食物带来药水效果(如玩家吃下食物,或给鹦鹉喂食曲奇饼干等)。
When an illusion illager makes himself disappear.幻术师释放咒语,令自己隐身。
When all effects are removed due to a bucket of milk.玩家饮用牛奶,清空全部药水效果。
When a player gets bad omen after killing a patrol captain.玩家杀死袭击队长,获得不祥之兆效果。
When a potion effect is modified through the plugin methods.插件改变实体所携带的药水效果 。
When the entity drinks a potion.实体喝下药水,获得药水效果。
When the entity is inflicted with an effect due to a splash potion.实体被掷出的喷溅型药水击中,获得药水效果。
When a spider gets effects when spawning on hard difficulty.困难难度下,蜘蛛生成时即携带药水效果。
When the entity gets effects from a totem item saving it's life.实体在濒死时消 耗不死图腾,获得抗火、生命恢复和伤害吸收效果。
When the entity gets water breathing by wearing a turtle helmet.实体在头盔槽位装备海龟壳,获得水下呼吸效果。
When the Cause is missing.未知原因。
When a villager gets regeneration after a trade.村民在完成交易后获得生命恢复效果。
When an entity comes in contact with a wither rose.实体接触 凋零玫瑰,获得凋零效果。
Last modified 1mo ago