类 EntityDamageEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityDamageEvent
- 所有已实现的接口:
Cancellable
储存伤害事件的数据
原文:
Stores data for damage events
-
嵌套类概要
修饰符和类型类说明static enum
An enum to specify the cause of the damagestatic enum
已过时。这个API被废弃了,具体见后面的网址,很快就要被移除了,就不深入解释了.This API is responsible for a large number of implementation problems and is in general unsustainable to maintain.从类继承的嵌套类/接口 org.bukkit.event.Event
Event.Result
-
字段概要
从类继承的字段 org.bukkit.event.entity.EntityEvent
entity
-
构造器概要
构造器说明EntityDamageEvent
(Entity damagee, EntityDamageEvent.DamageCause cause, double damage) 已过时。EntityDamageEvent
(Entity damagee, EntityDamageEvent.DamageCause cause, Map<EntityDamageEvent.DamageModifier, Double> modifiers, Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) -
方法概要
修饰符和类型方法说明getCause()
Gets the cause of the damage.double
返回本次事件收到伤害的值double
返回伤害值final double
返回此次事件最终的伤害值 (经过护甲等的修改)static HandlerList
double
获取指定伤害类型的原始伤害,作为本次事件的结构定义 ?boolean
该方法将检查特定的伤害原因是否是本次触发的原因, 例如setDamage(DamageModifier, double)
将不会抛出UnsupportedOperationException
异常boolean
获取这个事件是否被取消.一个被取消的事件不会在服务器里被执行,但是仍然会传递事件到其他插件。void
setCancelled
(boolean cancel) 取消这个事件.void
setDamage
(double damage) Sets the raw amount of damage caused by the event.void
setDamage
(EntityDamageEvent.DamageModifier type, double damage) 设置指定伤害类型的伤害从类继承的方法 org.bukkit.event.entity.EntityEvent
getEntity, getEntityType
从类继承的方法 org.bukkit.event.Event
getEventName, isAsynchronous
-
构造器详细资料
-
EntityDamageEvent
@Deprecated public EntityDamageEvent(Entity damagee, EntityDamageEvent.DamageCause cause, double damage) 已过时。 -
EntityDamageEvent
public EntityDamageEvent(Entity damagee, EntityDamageEvent.DamageCause cause, Map<EntityDamageEvent.DamageModifier, Double> modifiers, Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions)
-
-
方法详细资料
-
isCancelled
public boolean isCancelled()从接口复制的说明:Cancellable
获取这个事件是否被取消.一个被取消的事件不会在服务器里被执行,但是仍然会传递事件到其他插件。原文:Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
- 指定者:
isCancelled
在接口中Cancellable
- 返回:
- 如果事件已经被取消,则为true
-
setCancelled
public void setCancelled(boolean cancel) 从接口复制的说明:Cancellable
取消这个事件. 一个被取消的事件不会在 服务器里被执行,但是仍然会传递事件到其他插件。原文:Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
- 指定者:
setCancelled
在接口中Cancellable
- 参数:
cancel
- 如果你想取消这个事件,则为true
-
getOriginalDamage
public double getOriginalDamage(EntityDamageEvent.DamageModifier type) throws IllegalArgumentException 获取指定伤害类型的原始伤害,作为本次事件的结构定义 ?- 参数:
type
- (DamageModifier) 伤害类型type
- the modifier- 返回:
- 原始伤害
- 抛出:
IllegalArgumentException
- 如果参数(DamageModifier)是null时 原文: Gets the original damage for the specified modifier, as defined at this event's construction.IllegalArgumentException
- if type is null
-
setDamage
public void setDamage(EntityDamageEvent.DamageModifier type, double damage) throws IllegalArgumentException, UnsupportedOperationException 设置指定伤害类型的伤害- 参数:
type
- 伤害类型damage
- 伤害值type
- the damage modifierdamage
- the scalar value of the damage's modifier- 抛出:
IllegalArgumentException
- 如果类型是null时UnsupportedOperationException
- 如果触发该事件的实体不支持该伤害类型, 或者受到修改,当isApplicable(DamageModifier)
返回false 原文: Sets the damage for the specified modifier.IllegalArgumentException
- if type is nullUnsupportedOperationException
- if the caller does not support the particular DamageModifier, or to rephrase, whenisApplicable(DamageModifier)
returns false- 另请参阅:
-
getDamage
返回伤害值- 参数:
type
- 伤害类型type
- the damage modifier- 返回:
- 引起该事件的原始伤害
- 抛出:
IllegalArgumentException
- 如果类型是nullIllegalArgumentException
- if type is null- 另请参阅:
-
isApplicable
该方法将检查特定的伤害原因是否是本次触发的原因, 例如setDamage(DamageModifier, double)
将不会抛出UnsupportedOperationException
异常- 参数:
type
- 伤害原因type
- the modifier- 返回:
- 当伤害原因与事件触发的原因相同时返回true 反之返回false
- 抛出:
IllegalArgumentException
- 如何传入的参数是null时 原文: This checks to see if a particular modifier is valid for this event's caller, such that,setDamage(DamageModifier, double)
will not throw anUnsupportedOperationException
.EntityDamageEvent.DamageModifier.BASE
is always applicable.IllegalArgumentException
- if type is null
-
getDamage
public double getDamage()返回本次事件收到伤害的值- 返回:
- 一个没有进过别的处理的 伤害值
- 另请参阅:
-
getFinalDamage
public final double getFinalDamage()返回此次事件最终的伤害值 (经过护甲等的修改)- 返回:
- 此次事件最终的伤害值 Gets the amount of damage caused by the event after all damage reduction is applied.
-
setDamage
public void setDamage(double damage) Sets the raw amount of damage caused by the event.For compatibility this also recalculates the modifiers and scales them by the difference between the modifier for the previous damage value and the new one.
- 参数:
damage
- The raw amount of damage caused by the event
-
getCause
Gets the cause of the damage.- 返回:
- A DamageCause value detailing the cause of the damage.
-
getHandlers
- 指定者:
getHandlers
在类中Event
-
getHandlerList
-