EntityDamageEvent
EntityDamageEvent
=> org.bukkit.event.Event
=> org.bukkit.event.entity.EntityEvent
=> org.bukkit.event.entity.EntityDamageEvent
Stores data for damage events本事件存储了实体伤害的有关数据。译注:事件不是用来完成数据的持久化存储的。此处所谓“存储”意为事件的字段中含有一些与伤害有关的信息,该事件从服务端底层得到这些信息,存储于一些字段中,再给插件进行读取。当插件处理完毕以后,事件对象应该被销毁。不能使用事件对象来对数据进行保存。
方法声明: public boolean isCancelled()
方法签名: ()Z
方法声明: public void setCancelled(boolean cancel)
方法签名: (Z)V
方法声明: public double getOriginalDamage(@NotNull DamageModifier type) throws IllegalArgumentException
方法签名: (Lorg/bukkit/event/entity/EntityDamageEvent/DamageModifier;)D
Gets the original damage for the specified modifier, as defined at thisevent's construction.@param type the modifier@return the original damage@throws IllegalArgumentException if type is null该方法已过时。请勿使用DamageModifier
枚举。
方法声明: public void setDamage(@NotNull DamageModifier type, double damage) throws IllegalArgumentException, UnsupportedOperationException
方法签名: (Lorg/bukkit/event/entity/EntityDamageEvent/DamageModifier;D)V
Sets the damage for the specified modifier.@param type the damage modifier@param damage the scalar value of the damage's modifier@throws IllegalArgumentException if type is null@throws UnsupportedOperationException if the caller does not supportthe particular DamageModifier, or to rephrase, when {@link#isApplicable(DamageModifier)} returns false@see #getFinalDamage()该方法已过时。请勿使用DamageModifier
枚举。
方法声明: public double getDamage(@NotNull DamageModifier type) throws IllegalArgumentException
方法签名: (Lorg/bukkit/event/entity/EntityDamageEvent/DamageModifier;)D
Gets the damage change for some modifier@param type the damage modifier@return The raw amount of damage caused by the event@throws IllegalArgumentException if type is null@see DamageModifier#BASE该方法已过时。请勿使用DamageModifier
枚举。
方法声明: public boolean isApplicable(@NotNull DamageModifier type) throws IllegalArgumentException
方法签名: (Lorg/bukkit/event/entity/EntityDamageEvent/DamageModifier;)Z
This checks to see if a particular modifier is valid for this event'scaller, such that, {@link #setDamage(DamageModifier, double)} will notthrow an {@link UnsupportedOperationException}.{@link DamageModifier#BASE} is always applicable.@param type the modifier@return true if the modifier is supported by the caller, false otherwise@throws IllegalArgumentException if type is null该方法已过时。请勿使用DamageModifier
枚举。
方法声明: public double getDamage()
方法签名: ()D
Gets the raw amount of damage caused by the event@return The raw amount of damage caused by the event@see DamageModifier#BASE该方法用于获取涉事攻击者造成的原始伤害。@return 涉事攻击者造成的原始伤害。@see 参见DamageModifier#BASE
字段。
方法声明: public final double getFinalDamage()
方法签名: ()D
Gets the amount of damage caused by the event after all damagereduction is applied.@return the amount of damage caused by the event该方法用于获取受伤的涉事实体将要承受的最终伤害 。最终伤害是经过各种减伤机制计算而得的。@return 受伤的涉事实体将要承受的最终伤害。
方法声明: public void setDamage(double damage)
方法签名: (D)V
Sets the raw amount of damage caused by the event.For compatibility this also recalculates the modifiers and scalesthem by the difference between the modifier for the previous damagevalue and the new one.@param damage The raw amount of damage caused by the event该方法用于设置涉事攻击者造成的原始伤害。(译注:与DamageModifier
相关的过时内容不译)。@param damage 涉事攻击者造成的原始伤害。
方法声明: public DamageCause getCause()
方法签名: ()Lorg/bukkit/event/entity/EntityDamageEvent/DamageCause;
Gets the cause of the damage.@return A DamageCause value detailing the cause of the damage.该方法用于获取实体受伤的原 因。@return 一个DamageCause
枚举字段,用于确定实体受伤的详细原因。
方法声明: public HandlerList getHandlers()
方法签名: ()Lorg/bukkit/event/HandlerList;
方法声明: public static HandlerList getHandlerList()
方法签名: ()Lorg/bukkit/event/HandlerList;
An enum to specify the types of modifier@deprecated This API is responsible for a large number of implementation problems and is in general unsustainable to maintain. It is likely to be removed very soon in a subsequent release. Please see https://www.spigotmc.org/threads/194446/ for more information.用于确定伤害修改操作的枚举。@deprecated 本API
在实现上出现了大量问题,已经无法维护。在随后的版本中它将会被尽快移除。如欲获知更多信息,请参见 https://www.spigotmc.org/threads/194446/ 页面。
This represents the amount of damage being done, also known as theraw {@link EntityDamageEvent#getDamage()}.本字段已过时。
This represents the damage reduced by a wearing a helmet when hitby a falling block.本字段已过时。
This represents the damage reduction caused by blocking, only present for{@link Player Players}.本字段已过时。
This represents the damage reduction caused by wearing armor.本字段已过时。
This represents the damage reduction caused by the Resistance potion effect.本字段已过时。
This represents the damage reduction caused by the combination of:
Armor enchantments Witch's potion resistance本字段已过时。
This represents the damage reduction caused by the absorption potioneffect.本字段已过时。
An enum to specify the cause of the damage用于确定伤害原因的枚举。
Damage caused when an entity contacts a block such as a Cactus,Dripstone (Stalagmite) or Berry Bush.Damage: variable由于实体接触了方块(如仙人掌、浆果丛等)而受伤。伤害值:因方块而异。
Damage caused when an entity attacks another entity.Damage: variable由于实体遭到攻击而受伤。伤害值:因攻击情况而异。
Damage caused when an entity attacks another entity in a sweep attack.Damage: variable由于实体遭到横扫攻击而受伤。伤害值:因攻击情况而异。
Damage caused when attacked by a projectile.Damage: variable由于实体被抛射物击中而受伤。伤害值:因抛射物而异。
Damage caused by being put in a blockDamage: 1由于实体卡在方块内部,窒息而受伤。伤害值:一。
Damage caused when an entity falls a distance greater than 3 blocksDamage: fall height - 3.0由于实体自三格以上高度坠落而受伤。伤害值:坠落高度减三。
Damage caused by direct exposure to fireDamage: 1由于实体处于火焰方块中而受伤。伤害值:一。
Damage caused due to burns caused by fireDamage: 1由于实体正在燃烧而受伤。伤害值:一。
Damage caused due to a snowman meltingDamage: 1雪傀儡由于正在融化而受伤。伤害值:一。
Damage caused by direct exposure to lavaDamage: 4由于实体处于岩浆中而受伤。伤害值:四。
Damage caused by running out of air while in waterDamage: 2由于实体处于水中且没有氧气值而受伤。伤害值:二。
Damage caused by being in the area when a block explodes.Damage: variable由于实体被方块爆炸波及而受伤。伤害值:因爆炸情况而异。
Damage caused by being in the area when an entity, such as aCreeper, explodes.Damage: variable由于实体被另一实体爆炸波及而受伤(如苦力怕爆炸)。伤害值:因爆炸情况而异。
Damage caused by falling into the voidDamage: 4 for players由于实体坠入虚空而受伤。伤害值:对玩家而言为四。
Damage caused by being struck by lightningDamage: 5由于实体被闪电劈中而受伤。伤害值:五。
Damage caused by committing suicide.Note: This is currently only used by plugins, default commandslike /minecraft:kill use {@link #VOID} to damage players.Damage: variable由于实体自杀而受伤。目前而言仅有插件会采用本字段所描述的情况造成伤害。原版指令如/minecraft:kill
所造成的伤害系落入虚空的伤害,归入VOID
字段。伤害值:因情况而异。
Damage caused by starving due to having an empty hunger barDamage: 1由于实体饥饿值为零,过度饥饿而受伤。伤害值:一。
Damage caused due to an ongoing poison effectDamage: 1由于实体携带中毒药水效果而受伤。伤害值:一。
Damage caused by being hit by a damage potion or spellDamage: variable由于实体被伤害药水或咒语所波及而受伤。伤害值:因情况而异。
Damage caused by Wither potion effect由于实体携带凋零药水效果而受伤。
Damage caused by being hit by a falling block which deals damageNote: Not every block deals damageDamage: variable由于实体被下落的方块砸中而受伤。注意,不是每种坠落的方块都会对玩家造成伤害。伤害值:因方块而异。
Damage caused in retaliation to another attack by the Thornsenchantment.Damage: 1-4 (Thorns)由于实体攻击了某个盔甲含有“荆棘”附魔的实体,被该附魔反弹了伤害。伤害值:一至四。
Damage caused by a dragon breathing fire.Damage: variable由于实体被龙息 波及而受伤。伤害值:因情况而异。
Custom damage.Damage: variable插件造成的自定义伤害。伤害值:自定义。
Damage caused when an entity runs into a wall.Damage: variable由于实体在使用鞘翅滑翔时撞上墙壁而受伤。伤害值:视飞行速度而定。
Damage caused when an entity steps on {@link Material#MAGMA_BLOCK}.Damage: 1由于实体踩在岩浆块上而受伤。伤害值:一。
Damage caused when an entity is colliding with too many entities dueto the maxEntityCramming game rule.Damage: 6由 于涉事实体与过多实体相碰撞而挤压受伤,该情况与maxEntityCramming
这一GameRule
有关。伤害值:六。
Damage caused when an entity that should be in water is not.Damage: 1水生生物由于离开水体而受伤。伤害值:一。
Last modified 1mo ago