Class MinecraftVersion
java.lang.Object
io.github.bakedlibs.dough.versions.SemanticVersion
io.github.bakedlibs.dough.versions.MinecraftVersion
- All Implemented Interfaces:
Version,Comparable<Version>
This is an extension of
SemanticVersion, specifically designed
for Minecraft's versioning system.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMinecraftVersion(int major, int minor, int patch) This method constructs a newMinecraftVersionwith the given version components. -
Method Summary
Modifier and TypeMethodDescriptionstatic MinecraftVersionget()This attempts to get theMinecraftVersionon which the currentServeris running on.This method returns thisVersionas a human-readable format.static booleanisMocked()This checks if the current Server instance is a mock (MockBukkit) and whether we are in a Unit Test environment.static booleanThis checks if the current Server instance is a mock (MockBukkit) and whether we are in a Unit Test environment.static MinecraftVersionThis attempts to get theMinecraftVersionon which the givenServeris currently running on.Methods inherited from class io.github.bakedlibs.dough.versions.SemanticVersion
equals, equalsIgnorePatch, equalsIgnorePatch, getMajorVersion, getMinorVersion, getPatchVersion, hashCode, isAtLeast, isAtLeast, isEqualTo, isNewerThan, isOlderThan, isPatch, isSimilar, parse, toString
-
Constructor Details
-
MinecraftVersion
public MinecraftVersion(int major, int minor, int patch) This method constructs a newMinecraftVersionwith the given version components.- Parameters:
major- The "major" version (according to semver)minor- The "minor" version (according to semver)patch- The "patch" version (according to semver)
-
-
Method Details
-
of
@Nonnull public static MinecraftVersion of(@Nonnull Server server) throws UnknownServerVersionException This attempts to get theMinecraftVersionon which the givenServeris currently running on.- Parameters:
server- TheServerinstance- Returns:
- The current
MinecraftVersion - Throws:
UnknownServerVersionException- This exception is thrown when theServerversion could not be identified
-
get
This attempts to get theMinecraftVersionon which the currentServeris running on.- Returns:
- The current
MinecraftVersion - Throws:
UnknownServerVersionException- This exception is thrown when theServerversion could not be identified
-
isMocked
This checks if the current Server instance is a mock (MockBukkit) and whether we are in a Unit Test environment.- Parameters:
server- TheServerimplementation to investigate- Returns:
- Whether the current Server instance is a mock
-
isMocked
public static boolean isMocked()This checks if the current Server instance is a mock (MockBukkit) and whether we are in a Unit Test environment.- Returns:
- Whether the current Server instance is a mock
-
getAsString
This method returns thisVersionas a human-readable format. Example:1.4.2.- Specified by:
getAsStringin interfaceVersion- Overrides:
getAsStringin classSemanticVersion- Returns:
- A human-readable
Stringrepresentation of thisVersion
-