Class PlayerInteractEntityListener

java.lang.Object
com.ranull.graves.listener.integration.nexo.PlayerInteractEntityListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class PlayerInteractEntityListener extends Object implements org.bukkit.event.Listener
Listens for PlayerInteractEntityEvent and cancels the event if the player interacts with an ItemFrame associated with a grave.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Nexo
     
    private final Graves
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new PlayerInteractEntityListener with the specified Graves and Nexo instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    handleFurnitureInteraction(org.bukkit.event.player.PlayerInteractEntityEvent event, org.bukkit.entity.Entity entity)
    Handles the interaction with the furniture.
    private boolean
    isItemFrame(org.bukkit.entity.Entity entity)
    Checks if the entity is an ItemFrame.
    void
    onFurnitureInteract(org.bukkit.event.player.PlayerInteractEntityEvent event)
    Handles PlayerInteractEntityEvent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
    • nexo

      private final Nexo nexo
  • Constructor Details

    • PlayerInteractEntityListener

      public PlayerInteractEntityListener(Graves plugin, Nexo nexo)
      Constructs a new PlayerInteractEntityListener with the specified Graves and Nexo instances.
      Parameters:
      plugin - The Graves instance to use.
      nexo - The Nexo instance to use.
  • Method Details

    • onFurnitureInteract

      public void onFurnitureInteract(org.bukkit.event.player.PlayerInteractEntityEvent event)
      Handles PlayerInteractEntityEvent. If the player interacts with an ItemFrame associated with a grave, it cancels the event and opens the grave for the player.
      Parameters:
      event - The PlayerInteractEntityEvent to handle.
    • isItemFrame

      private boolean isItemFrame(org.bukkit.entity.Entity entity)
      Checks if the entity is an ItemFrame.
      Parameters:
      entity - The entity to check.
      Returns:
      True if the entity is an ItemFrame, false otherwise.
    • handleFurnitureInteraction

      private void handleFurnitureInteraction(org.bukkit.event.player.PlayerInteractEntityEvent event, org.bukkit.entity.Entity entity)
      Handles the interaction with the furniture. If the furniture is associated with a grave, the event is cancelled and the grave is opened for the player.
      Parameters:
      event - The PlayerInteractEntityEvent.
      entity - The entity being interacted with.