Package io.papermc.paper.event.entity
Class EntityAttemptSmashAttackEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
io.papermc.paper.event.entity.EntityAttemptSmashAttackEvent
Called when an entity attempts to perform a smash attack.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Field Summary
Fields inherited from class org.bukkit.event.entity.EntityEvent
entity -
Constructor Summary
ConstructorsConstructorDescriptionEntityAttemptSmashAttackEvent(LivingEntity attacker, LivingEntity target, ItemStack weapon, boolean originalResult) -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerListbooleanYields the original result the server computed.Yields the effective result of this event.Yields the target of the attempted smash attack.Yields a copy of the itemstack used in the smash attack attempt.voidsetResult(Event.Result result) Configures a new result for this event.Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntity, getEntityTypeMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
EntityAttemptSmashAttackEvent
@Internal public EntityAttemptSmashAttackEvent(LivingEntity attacker, LivingEntity target, ItemStack weapon, boolean originalResult)
-
-
Method Details
-
getTarget
Yields the target of the attempted smash attack.- Returns:
- the target entity
-
getWeapon
Yields a copy of the itemstack used in the smash attack attempt.- Returns:
- the itemstack
-
getOriginalResult
public boolean getOriginalResult()Yields the original result the server computed.- Returns:
trueif this attempt would have been successful by vanilla's logic,falseotherwise.
-
getResult
Yields the effective result of this event. The result may take one of three values:Event.Result.ALLOW: The attempt will succeed.Event.Result.DENY: The attempt will fail.Event.Result.DEFAULT: The attempt will succeed ifgetOriginalResult()istrueand fail otherwise.
- Returns:
- the result.
-
setResult
Configures a new result for this event. The passes result may take one of three values:Event.Result.ALLOW: The attempt will succeed.Event.Result.DENY: The attempt will fail.Event.Result.DEFAULT: The attempt will succeed ifgetOriginalResult()istrueand fail otherwise.
- Parameters:
result- the new result of the event.
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-