Package valorless.valorlessutils
Class Server
java.lang.Object
valorless.valorlessutils.Server
Utility class for handling and comparing Minecraft server versions.
Provides methods to resolve the current server version, compare versions,
and check version relationships (higher/equal). Versions are represented
as the Server.Version
enum.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing supported Minecraft server versions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Server.Version
Attempts to resolve the current running server version.static int
VersionCompare
(Server.Version version, Server.Version compareTo) Compares twoServer.Version
enums based on their ordinal order.static Boolean
VersionEqualTo
(Server.Version version) Checks if the current server version is exactly equal to a specified version.static Boolean
VersionHigherOrEqualTo
(Server.Version version) Checks if the current server version is higher than or equal to a specified version.
-
Constructor Details
-
Server
public Server()
-
-
Method Details
-
VersionCompare
Compares twoServer.Version
enums based on their ordinal order.Useful for determining if one version comes before, after, or is equal to another.
- Parameters:
version
- The version to compare.compareTo
- The version to compare against.- Returns:
- -1 if
version
is lower thancompareTo
, 1 ifversion
is higher, or 0 if equal.
-
ResolveVersion
Attempts to resolve the current running server version.Uses
Bukkit.getBukkitVersion()
to determine the server version and converts it to the correspondingServer.Version
enum value.- Returns:
- The resolved
Server.Version
, orServer.Version.NULL
if the resolution fails.
-
VersionHigherOrEqualTo
Checks if the current server version is higher than or equal to a specified version.- Parameters:
version
- The version to compare against.- Returns:
true
if the current server version is higher than or equal toversion
;false
otherwise.
-
VersionEqualTo
Checks if the current server version is exactly equal to a specified version.- Parameters:
version
- The version to compare against.- Returns:
true
if the current server version equalsversion
;false
otherwise.
-