Package com.ranull.graves.listener
Class HangingBreakListener
java.lang.Object
com.ranull.graves.listener.HangingBreakListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener for handling HangingBreakEvent and conditionally canceling the event.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHangingBreakListener
(Graves plugin) Constructs a HangingBreakListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate 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.
-
Field Details
-
plugin
-
-
Constructor Details
-
HangingBreakListener
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.
-