Package one.tranic.t.base.player
Class ViaPlayer
java.lang.Object
one.tranic.t.base.player.ViaPlayer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetVersion(@NotNull Object player) Retrieves the protocol version of the specified player.static intgetVersion(@NotNull UUID uuid) Retrieves the protocol version of a player identified by their unique identifier (UUID).static booleanDetermines if the ViaVersion plugin is enabled.
-
Constructor Details
-
ViaPlayer
public ViaPlayer()
-
-
Method Details
-
getVersion
Retrieves the protocol version of a player identified by their unique identifier (UUID).If the ViaVersion plugin is enabled, the player's protocol version is fetched using the ViaVersion API. If the plugin is not enabled, this method returns -1.
- Parameters:
uuid- the universally unique identifier (UUID) of the player; must not be null- Returns:
- the protocol version of the player as an integer if ViaVersion is enabled; otherwise, -1
- Throws:
IllegalArgumentException- if the provided UUID is null
-
getVersion
Retrieves the protocol version of the specified player.
This method utilizes the ViaVersion API to determine the protocol version of the player if the ViaVersion plugin is enabled. If the plugin is not enabled, it defaults to returning -1.- Parameters:
player- the player object for which the protocol version is to be retrieved; must not be null- Returns:
- the protocol version of the player as an integer if ViaVersion is enabled; -1 if ViaVersion is not enabled
- Throws:
IllegalArgumentException- if the player object is null
-
isEnabled
public static boolean isEnabled()Determines if the ViaVersion plugin is enabled.- Returns:
trueif the ViaVersion plugin is active and available,falseotherwise.
-