Package com.ranull.graves.listener
Class PlayerTeleportListener
java.lang.Object
com.ranull.graves.listener.PlayerTeleportListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for PlayerTeleportEvent to handle interactions with grave blocks and
remove specific items from the player's inventory if they teleport into a grave location.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlayerTeleportListener
(Graves plugin) Constructs a new PlayerTeleportListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate UUID
getGraveUUIDFromItemStack
(org.bukkit.inventory.ItemStack itemStack) Retrieves the Grave UUID from the item stack.void
onPlayerTeleport
(org.bukkit.event.player.PlayerTeleportEvent event) Handles PlayerTeleportEvent to manage interactions with grave blocks when a player teleports.private void
removeSpecificCompassNearGrave
(org.bukkit.entity.Player player, org.bukkit.Location location) Removes a specific type of compass (e.g., RECOVERY_COMPASS) from the player's inventory if within a configured block radius of a grave.
-
Field Details
-
plugin
-
-
Constructor Details
-
PlayerTeleportListener
Constructs a new PlayerTeleportListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onPlayerTeleport
public void onPlayerTeleport(org.bukkit.event.player.PlayerTeleportEvent event) Handles PlayerTeleportEvent to manage interactions with grave blocks when a player teleports. Checks if the player's new location is within a 15-block radius of any grave and removes specific compass items from their inventory if so.- Parameters:
event
- The PlayerTeleportEvent to handle.
-
removeSpecificCompassNearGrave
private void removeSpecificCompassNearGrave(org.bukkit.entity.Player player, org.bukkit.Location location) Removes a specific type of compass (e.g., RECOVERY_COMPASS) from the player's inventory if within a configured block radius of a grave.- Parameters:
player
- The player to check.location
- The player's current location.
-
getGraveUUIDFromItemStack
Retrieves the Grave UUID from the item stack.- Parameters:
itemStack
- The item stack to check.- Returns:
- The UUID of the grave associated with the item stack, or null if not found.
-