Package me.hsgamer.hscore.bukkit.utils
Class VersionUtils
java.lang.Object
me.hsgamer.hscore.bukkit.utils.VersionUtils
The helper class for server versions
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet the CraftBukkit package versionstatic intGet the major version of the serverstatic intGet the minor version of the serverstatic booleanisAt(int majorVersion) Check if the server version is at the given versionstatic booleanisAt(int majorVersion, int minorVersion) Check if the server version is at the given versionstatic booleanisAtLeast(int version) Check if the server version is at least the given versionstatic booleanisAtLeast(int majorVersion, int minorVersion) Check if the server version is at least the given versionstatic booleanCheck if the server is using CraftBukkit mappings.static booleanisLowerThan(int majorVersion) Check if the server version is lower than the given versionstatic booleanisLowerThan(int majorVersion, int minorVersion) Check if the server version is lower than the given versionstatic booleanisNewerThan(int majorVersion) Check if the server version is newer than the given versionstatic booleanisNewerThan(int majorVersion, int minorVersion) Check if the server version is newer than the given version
-
Method Details
-
getMajorVersion
public static int getMajorVersion()Get the major version of the server- Returns:
- the version
-
getMinorVersion
public static int getMinorVersion()Get the minor version of the server- Returns:
- the version
-
isAtLeast
public static boolean isAtLeast(int version) Check if the server version is at least the given version- Parameters:
version- the version to check- Returns:
- true if it is
-
isAtLeast
public static boolean isAtLeast(int majorVersion, int minorVersion) Check if the server version is at least the given version- Parameters:
majorVersion- the major version to checkminorVersion- the minor version to check- Returns:
- true if it is
-
isAt
public static boolean isAt(int majorVersion) Check if the server version is at the given version- Parameters:
majorVersion- the major version to check- Returns:
- true if it is
-
isAt
public static boolean isAt(int majorVersion, int minorVersion) Check if the server version is at the given version- Parameters:
majorVersion- the major version to checkminorVersion- the minor version to check- Returns:
- true if it is
-
isNewerThan
public static boolean isNewerThan(int majorVersion) Check if the server version is newer than the given version- Parameters:
majorVersion- the major version to check- Returns:
- true if it is
-
isNewerThan
public static boolean isNewerThan(int majorVersion, int minorVersion) Check if the server version is newer than the given version- Parameters:
majorVersion- the major version to checkminorVersion- the minor version to check- Returns:
- true if it is
-
isLowerThan
public static boolean isLowerThan(int majorVersion) Check if the server version is lower than the given version- Parameters:
majorVersion- the major version to check- Returns:
- true if it is
-
isLowerThan
public static boolean isLowerThan(int majorVersion, int minorVersion) Check if the server version is lower than the given version- Parameters:
majorVersion- the major version to checkminorVersion- the minor version to check- Returns:
- true if it is
-
isCraftBukkitMapped
public static boolean isCraftBukkitMapped()Check if the server is using CraftBukkit mappings. CraftBukkit mappings are usually used in Spigot and old Paper versions. It's useful to check whether the server is using CraftBukkit mappings (Spigot, old Paper) or new Paper mappings. More info- Returns:
- true if it is
-
getCraftBukkitPackageVersion
Get the CraftBukkit package version- Returns:
- the CraftBukkit package version, or empty if
isCraftBukkitMapped()returns false
-