Class Versions
java.lang.Object
com.fren_gor.ultimateAdvancementAPI.util.Versions
Utility class for handling UltimateAdvancementAPI versions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Gets current API version.Gets the NMS version of the current server.static @UnmodifiableView @Nullable List
<@NotNull String> Gets an unmodifiable list of the minecraft versions supported by this server NMS version.static @UnmodifiableView @Nullable List
<@NotNull String> getNMSVersionsList
(String version) Gets an unmodifiable list of the minecraft versions supported by the provided NMS version.Gets the minecraft versions supported by this server NMS version.getNMSVersionsRange
(String version) Gets the minecraft versions supported by the provided NMS version.static @UnmodifiableView @NotNull List
<@NotNull String> Gets an unmodifiable list of NMS versions supported by this release of UltimateAdvancementAPI.static @UnmodifiableView @NotNull List
<@NotNull String> Gets an unmodifiable list of minecraft versions supported by this release of UltimateAdvancementAPI.static String
removeInitialV
(String string) Returns the input string unless it starts with'v'
.
-
Method Details
-
getNMSVersion
Gets the NMS version of the current server.This returns a
Optional<String>
like"v1_15_R1"
. To remove initial'v'
seeremoveInitialV(String)
.- Returns:
- The server NMS version.
-
getApiVersion
Gets current API version.- Returns:
- The API version.
-
getSupportedVersions
Gets an unmodifiable list of minecraft versions supported by this release of UltimateAdvancementAPI.Returned versions are like
"1.15"
or"1.15.2"
.- Returns:
- An unmodifiable list of minecraft versions supported by this release of UltimateAdvancementAPI.
-
getSupportedNMSVersions
Gets an unmodifiable list of NMS versions supported by this release of UltimateAdvancementAPI.Returned versions are like
"v1_15_R1"
.- Returns:
- An unmodifiable list of minecraft versions supported by this release of UltimateAdvancementAPI.
-
getNMSVersionsRange
Gets the minecraft versions supported by this server NMS version.For example, for
"v1_15_R1"
this method returns"1.15-1.15.2"
.- Returns:
- The minecraft versions supported by this server NMS version,
or
null
if the server version is not supported (seegetSupportedNMSVersions()
).
-
getNMSVersionsRange
@Nullable @Contract("null -> null") public static @Nullable String getNMSVersionsRange(String version) Gets the minecraft versions supported by the provided NMS version.For example, for
"v1_15_R1"
this method returns"1.15-1.15.2"
.- Parameters:
version
- The NMS version.- Returns:
- The minecraft versions supported by the provided NMS version,
or
null
if the provided version is not supported (seegetSupportedNMSVersions()
).
-
getNMSVersionsList
Gets an unmodifiable list of the minecraft versions supported by this server NMS version.For example, for
"v1_15_R1"
this method returns a list containing"1.15"
,"1.15.1"
, and"1.15.2"
.- Returns:
- An unmodifiable list of the minecraft versions supported by this server NMS version,
or
null
if the server version is not supported (seegetSupportedNMSVersions()
).
-
getNMSVersionsList
@Nullable @Contract("null -> null") public static @UnmodifiableView @Nullable List<@NotNull String> getNMSVersionsList(String version) Gets an unmodifiable list of the minecraft versions supported by the provided NMS version.For example, for
"v1_15_R1"
this method returns a list containing"1.15"
,"1.15.1"
, and"1.15.2"
.- Parameters:
version
- The NMS version.- Returns:
- An unmodifiable list of the minecraft versions supported by the provided NMS version,
or
null
if the provided version is not supported (seegetSupportedNMSVersions()
).
-
removeInitialV
Returns the input string unless it starts with'v'
. In that case, this method returns the string without the first letter. Ifnull
, this method returnsnull
.Examples:
removeInitialV("v1_15_R1") returns "1_15_R1" removeInitialV("1_15_R1") returns "1_15_R1" removeInitialV("") returns "" removeInitialV("vv1_15_R1") returns "v1_15_R1" removeInitialV(null) returns null
- Parameters:
string
- The input string- Returns:
null
if the string isnull
, the string itself if the first character isn't'v'
, otherwise the string without the first character.
-