Skip to content

Commit

Permalink
more methods for VersionUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Apr 4, 2024
1 parent abd23dd commit 884cb0e
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,50 @@ public static boolean isAt(int majorVersion) {
public static boolean isAt(int majorVersion, int minorVersion) {
return MAJOR_VERSION == majorVersion && MINOR_VERSION == minorVersion;
}

/**
* Check if the server version is newer than the given version
*
* @param majorVersion the major version to check
*
* @return true if it is
*/
public static boolean isNewerThan(int majorVersion) {
return MAJOR_VERSION > majorVersion;
}

/**
* Check if the server version is newer than the given version
*
* @param majorVersion the major version to check
* @param minorVersion the minor version to check
*
* @return true if it is
*/
public static boolean isNewerThan(int majorVersion, int minorVersion) {
return MAJOR_VERSION > majorVersion || (MAJOR_VERSION == majorVersion && MINOR_VERSION > minorVersion);
}

/**
* Check if the server version is lower than the given version
*
* @param majorVersion the major version to check
*
* @return true if it is
*/
public static boolean isLowerThan(int majorVersion) {
return MAJOR_VERSION < majorVersion;
}

/**
* Check if the server version is lower than the given version
*
* @param majorVersion the major version to check
* @param minorVersion the minor version to check
*
* @return true if it is
*/
public static boolean isLowerThan(int majorVersion, int minorVersion) {
return MAJOR_VERSION < majorVersion || (MAJOR_VERSION == majorVersion && MINOR_VERSION < minorVersion);
}
}

0 comments on commit 884cb0e

Please sign in to comment.