Class PlayerUseUnknownEntityEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent
Represents an event that is called when a player right-clicks an unknown entity.
Useful for plugins dealing with virtual entities (entities that don't actually spawned on the server).
This event may be called multiple times per interaction with different interaction hands and with or without the clicked position.
This event may be called multiple times per interaction with different interaction hands and with or without the clicked position.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
-
Constructor Summary
ConstructorDescriptionPlayerUseUnknownEntityEvent
(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand, @Nullable Vector clickedPosition) -
Method Summary
Modifier and TypeMethodDescriptionReturns the position relative to the entity that was clicked, or null if not available.int
Returns the entity id of the unknown entity that was interacted with.getHand()
Returns the hand used to perform this interaction.static @NotNull HandlerList
boolean
isAttack()
Returns whether the interaction was an attack.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
PlayerUseUnknownEntityEvent
-
-
Method Details
-
getEntityId
public int getEntityId()Returns the entity id of the unknown entity that was interacted with.- Returns:
- the entity id of the entity that was interacted with
-
isAttack
public boolean isAttack()Returns whether the interaction was an attack.- Returns:
- true if the player is attacking the entity, false if the player is interacting with the entity
-
getHand
Returns the hand used to perform this interaction.- Returns:
- the hand used to interact
-
getClickedRelativePosition
Returns the position relative to the entity that was clicked, or null if not available. SeePlayerInteractAtEntityEvent
for more details.- Returns:
- the position relative to the entity that was clicked, or null if not available
- See Also:
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-