Package com.ranull.graves.listener
Class PlayerInteractListener
java.lang.Object
com.ranull.graves.listener.PlayerInteractListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener for handling PlayerInteractEvent to interact with graves and compasses.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerInteractListener
(Graves plugin) Constructs a PlayerInteractListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoid
onPlayerInteract
(org.bukkit.event.player.PlayerInteractEvent event) Handles the PlayerInteractEvent when a player interacts with blocks or items.
-
Constructor Details
-
PlayerInteractListener
Constructs a PlayerInteractListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onPlayerInteract
public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles the PlayerInteractEvent when a player interacts with blocks or items. This method processes interactions with: - Graves: Opens a grave if the player interacts with a block or adjacent block that represents a grave. - Compasses: Updates or removes the compass item based on the grave it is tracking. The event is only processed if: - The hand used for the interaction is the main hand (or the plugin version does not support a second hand). - The player is not in Spectator mode (if the server version is 1.7).- Parameters:
event
- The PlayerInteractEvent to handle.
-