Class PlayerUseUnknownEntityEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent

public class PlayerUseUnknownEntityEvent extends PlayerEvent
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.
  • Constructor Details

  • 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

      @NotNull public @NotNull EquipmentSlot getHand()
      Returns the hand used to perform this interaction.
      Returns:
      the hand used to interact
    • getClickedRelativePosition

      @Nullable public @Nullable Vector getClickedRelativePosition()
      Returns the position relative to the entity that was clicked, or null if not available. See PlayerInteractAtEntityEvent for more details.
      Returns:
      the position relative to the entity that was clicked, or null if not available
      See Also:
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()