Class HangingBreakListener

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

public class HangingBreakListener extends Object implements org.bukkit.event.Listener
Listener for handling HangingBreakEvent and conditionally canceling the event.
  • Field Summary

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

    Constructors
    Constructor
    Description
    Constructs a HangingBreakListener with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    isAssociatedWithGrave(org.bukkit.event.hanging.HangingBreakEvent event)
    Checks if the entity involved in the event is associated with a grave.
    void
    onHangingBreak(org.bukkit.event.hanging.HangingBreakEvent event)
    Handles the HangingBreakEvent to conditionally cancel the event if the entity is an ItemFrame and associated with a grave.
    private boolean
    shouldCancelEvent(org.bukkit.event.hanging.HangingBreakEvent event)
    Determines if the HangingBreakEvent should be canceled.

    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
  • Constructor Details

    • HangingBreakListener

      public HangingBreakListener(Graves plugin)
      Constructs a HangingBreakListener with the specified Graves plugin.
      Parameters:
      plugin - The Graves plugin instance.
  • Method Details

    • onHangingBreak

      public void onHangingBreak(org.bukkit.event.hanging.HangingBreakEvent event)
      Handles the HangingBreakEvent to conditionally cancel the event if the entity is an ItemFrame and associated with a grave.
      Parameters:
      event - The HangingBreakEvent to handle.
    • shouldCancelEvent

      private boolean shouldCancelEvent(org.bukkit.event.hanging.HangingBreakEvent event)
      Determines if the HangingBreakEvent should be canceled.
      Parameters:
      event - The HangingBreakEvent.
      Returns:
      True if the event should be canceled, false otherwise.
    • isAssociatedWithGrave

      private boolean isAssociatedWithGrave(org.bukkit.event.hanging.HangingBreakEvent event)
      Checks if the entity involved in the event is associated with a grave.
      Parameters:
      event - The HangingBreakEvent.
      Returns:
      True if the entity is associated with a grave, false otherwise.