Class VersionUtils
java.lang.Object
de.studiocode.inventoryaccess.util.VersionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisHigherOrEqualThanServer(int... version) Returns if the given version is higher or equal to the one currently running on the server.static booleanisHigherOrEqualThanServer(String version) Returns if the given version is higher or equal to the one currently running on the server.static booleanisServerHigherOrEqual(int... version) Returns if the server is on this or a newer version of Minecraft.static booleanisServerHigherOrEqual(String version) Returns if the server is on this or a newer version of Minecraft.static int[]toMajorMinorPatch(String version) Converts a version string like "1.17.1" or "1.17" to an array of three ints.
-
Constructor Details
-
VersionUtils
public VersionUtils()
-
-
Method Details
-
toMajorMinorPatch
Converts a version string like "1.17.1" or "1.17" to an array of three ints.- Parameters:
version- The version to check against- Returns:
- The version as an array of three ints.
- Throws:
NumberFormatException- If an invalid version string is provided.
-
isHigherOrEqualThanServer
Returns if the given version is higher or equal to the one currently running on the server.- Parameters:
version- The version to check against- Returns:
- If the given version is running on this server or a newer one.
-
isHigherOrEqualThanServer
public static boolean isHigherOrEqualThanServer(int... version) Returns if the given version is higher or equal to the one currently running on the server.- Parameters:
version- The version to check against- Returns:
- If the given version is running on this server or a newer one.
- Throws:
IllegalArgumentException- If the version array does not have a size of 3
-
isServerHigherOrEqual
Returns if the server is on this or a newer version of Minecraft.- Parameters:
version- The version to check against- Returns:
- If the server is running this exact or a newer version of Minecraft.
-
isServerHigherOrEqual
public static boolean isServerHigherOrEqual(int... version) Returns if the server is on this or a newer version of Minecraft.- Parameters:
version- The version to check against- Returns:
- If the server is running this exact or a newer version of Minecraft.
- Throws:
IllegalArgumentException- If the version array does not have a size of 3
-