Package com.ranull.graves.listener
Class PlayerJoinListener
java.lang.Object
com.ranull.graves.listener.PlayerJoinListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener for handling PlayerJoinEvent to notify players about plugin updates.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerJoinListener
(Graves plugin) Constructs a PlayerJoinListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoid
onPlayerJoin
(org.bukkit.event.player.PlayerJoinEvent event) Handles the PlayerJoinEvent to notify players about available plugin updates.
-
Constructor Details
-
PlayerJoinListener
Constructs a PlayerJoinListener with the specified Graves plugin.- Parameters:
plugin
- The Graves plugin instance.
-
-
Method Details
-
onPlayerJoin
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) Handles the PlayerJoinEvent to notify players about available plugin updates. This method checks if the plugin's update check is enabled and if the player has the permission to receive update notifications. If so, it runs an asynchronous task to fetch the latest version of the plugin and compares it with the player's current version. If the player's version is outdated, a message is sent to the player indicating the current version, the latest version, and a link to the Spigot resource page. The comparison is handled carefully to ensure proper handling of version format errors.- Parameters:
event
- The PlayerJoinEvent to handle.
-