Package com.ranull.graves.listener
Class PlayerRespawnListener
java.lang.Object
com.ranull.graves.listener.PlayerRespawnListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Handles player respawns and performs grave-related actions:
- Runs a configured function shortly after respawn.
- Optionally grants temporary potion effects if the grave is recent.
- Optionally gives a compass pointing to the grave.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidapplyPotionEffectIfWithinTime(org.bukkit.entity.Player player, List<String> permissionList, Grave grave, org.bukkit.Location respawnLoc) Applies temporary potion effects if the grave's lived time is within the configured limit.private voidgiveCompassToPlayer(org.bukkit.event.player.PlayerRespawnEvent event, org.bukkit.entity.Player player, Grave grave, org.bukkit.Location respawnLoc) Creates and gives the grave compass one tick after respawn, executing on the respawn location region to safely read locations and modify the player's inventory.voidonPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent event) private voidscheduleRespawnFunction(org.bukkit.entity.Player player, List<String> permissionList, Grave grave, org.bukkit.Location respawnLoc) Schedules the configured respawn function to run one tick after respawn on the player's respawn location region.private booleanshouldGiveCompass(org.bukkit.entity.Player player, List<String> permissionList, Grave grave) Returns true if a compass should be given: compass feature available, enabled, and within the configured time window relative to the grave's lived time.
-
Field Details
-
plugin
-
-
Constructor Details
-
PlayerRespawnListener
-
-
Method Details
-
onPlayerRespawn
public void onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent event) -
scheduleRespawnFunction
private void scheduleRespawnFunction(org.bukkit.entity.Player player, List<String> permissionList, Grave grave, org.bukkit.Location respawnLoc) Schedules the configured respawn function to run one tick after respawn on the player's respawn location region. -
applyPotionEffectIfWithinTime
private void applyPotionEffectIfWithinTime(org.bukkit.entity.Player player, List<String> permissionList, Grave grave, org.bukkit.Location respawnLoc) Applies temporary potion effects if the grave's lived time is within the configured limit. Executed one tick after respawn on the respawn location region. -
shouldGiveCompass
private boolean shouldGiveCompass(org.bukkit.entity.Player player, List<String> permissionList, Grave grave) Returns true if a compass should be given: compass feature available, enabled, and within the configured time window relative to the grave's lived time. -
giveCompassToPlayer
private void giveCompassToPlayer(org.bukkit.event.player.PlayerRespawnEvent event, org.bukkit.entity.Player player, Grave grave, org.bukkit.Location respawnLoc) Creates and gives the grave compass one tick after respawn, executing on the respawn location region to safely read locations and modify the player's inventory.
-