Package com.comphenix.protocol.utility
Class MinecraftVersion
java.lang.Object
com.comphenix.protocol.utility.MinecraftVersion
- All Implemented Interfaces:
Serializable,Comparable<MinecraftVersion>
public final class MinecraftVersion
extends Object
implements Comparable<MinecraftVersion>, Serializable
Determine the current Minecraft version.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MinecraftVersionVersion 1.13 - update aquatic.static final MinecraftVersionVersion 1.15 - the bee updatestatic final MinecraftVersionVersion 1.8 - the "bountiful" update.static final MinecraftVersionVersion 1.17 - caves and cliffs part 1static final MinecraftVersionVersion 1.18 - caves and cliffs part 2static final MinecraftVersionVersion 1.12 - the world of color update.static final MinecraftVersionVersion 1.9 - the combat update.static final MinecraftVersionVersion 1.20.2 - the update that added the configuration protocol phase.static final MinecraftVersionVersion 1.11 - the exploration update.static final MinecraftVersionVersion 1.19.4 - the rest of the feature previewstatic final MinecraftVersionVersion 1.19.3 - introducing feature previewstatic final MinecraftVersionVersion 1.10 - the frostburn update.static final MinecraftVersionVersion 1.6.1 - the horse update.static final MinecraftVersionThe latest release version of minecraft.static final MinecraftVersionVersion 1.16.0 - the nether updatestatic final MinecraftVersionVersion 1.16.2 - breaking change to the nether updatestatic final MinecraftVersionVersion 1.16.4static final MinecraftVersionVersion 1.5.0 - the redstone update.static final MinecraftVersionVersion 1.4.2 - the scary update (Wither Boss).static final MinecraftVersionVersion 1.7.8 - the update that changed the skin format (and distribution - R.I.P.static final MinecraftVersionVersion 1.20 - the trails and tails updatestatic final MinecraftVersionVersion 1.20.4 - the decorated pot updatestatic final MinecraftVersionVersion 1.20.5 - the cookie and transfer packet updatestatic final MinecraftVersionVersion 1.21.0 - the tricky trials updatestatic final MinecraftVersionVersion 1.21.2 - the bundles of bravery dropstatic final MinecraftVersionVersion 1.21.4 - the garden awakens dropstatic final MinecraftVersionVersion 1.21.5 - spring to life dropstatic final MinecraftVersionVersion 1.21.6 - chase the skiesstatic final MinecraftVersionVersion 1.14 - village and pillage update.static final MinecraftVersionVersion 1.19 - the wild updatestatic final MinecraftVersionVersion 1.7.2 - the update that changed the world. -
Constructor Summary
ConstructorsConstructorDescriptionMinecraftVersion(int major, int minor, int build) Construct a version object directly.MinecraftVersion(int major, int minor, int build, String development) Construct a version object directly.MinecraftVersion(String versionOnly) Construct a version object from the format major.minor.build, or the snapshot format.MinecraftVersion(org.bukkit.Server server) Determine the current Minecraft version. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this version is at or above the current version the server is running.intbooleanstatic StringextractVersion(String text) Extract the Minecraft version from CraftBukkit itself.static MinecraftVersionfromServerVersion(String serverVersion) Parse the given server version into a Minecraft version.intgetBuild()Build version numberstatic MinecraftVersionRetrieve the development stage.intgetMajor()Major version numberintgetMinor()Minor version numberRetrieve the snapshot version, or NULL if this is a release.Retrieve the version String (major.minor.build) only.inthashCode()booleanisAtLeast(MinecraftVersion other) booleanDetermine if this version is a snapshot.static voidsetCurrentVersion(MinecraftVersion version) toString()
-
Field Details
-
v1_21_6
Version 1.21.6 - chase the skies -
v1_21_5
Version 1.21.5 - spring to life drop -
v1_21_4
Version 1.21.4 - the garden awakens drop -
v1_21_2
Version 1.21.2 - the bundles of bravery drop -
v1_21_0
Version 1.21.0 - the tricky trials update -
v1_20_5
Version 1.20.5 - the cookie and transfer packet update -
v1_20_4
Version 1.20.4 - the decorated pot update -
CONFIG_PHASE_PROTOCOL_UPDATE
Version 1.20.2 - the update that added the configuration protocol phase. -
TRAILS_AND_TAILS
Version 1.20 - the trails and tails update -
FEATURE_PREVIEW_2
Version 1.19.4 - the rest of the feature preview -
FEATURE_PREVIEW_UPDATE
Version 1.19.3 - introducing feature preview -
WILD_UPDATE
Version 1.19 - the wild update -
CAVES_CLIFFS_2
Version 1.18 - caves and cliffs part 2 -
CAVES_CLIFFS_1
Version 1.17 - caves and cliffs part 1 -
NETHER_UPDATE_4
Version 1.16.4 -
NETHER_UPDATE_2
Version 1.16.2 - breaking change to the nether update -
NETHER_UPDATE
Version 1.16.0 - the nether update -
BEE_UPDATE
Version 1.15 - the bee update -
VILLAGE_UPDATE
Version 1.14 - village and pillage update. -
AQUATIC_UPDATE
Version 1.13 - update aquatic. -
COLOR_UPDATE
Version 1.12 - the world of color update. -
EXPLORATION_UPDATE
Version 1.11 - the exploration update. -
FROSTBURN_UPDATE
Version 1.10 - the frostburn update. -
COMBAT_UPDATE
Version 1.9 - the combat update. -
BOUNTIFUL_UPDATE
Version 1.8 - the "bountiful" update. -
SKIN_UPDATE
Version 1.7.8 - the update that changed the skin format (and distribution - R.I.P. player disguise) -
WORLD_UPDATE
Version 1.7.2 - the update that changed the world. -
HORSE_UPDATE
Version 1.6.1 - the horse update. -
REDSTONE_UPDATE
Version 1.5.0 - the redstone update. -
SCARY_UPDATE
Version 1.4.2 - the scary update (Wither Boss). -
LATEST
The latest release version of minecraft.
-
-
Constructor Details
-
MinecraftVersion
public MinecraftVersion(org.bukkit.Server server) Determine the current Minecraft version.- Parameters:
server- - the Bukkit server that will be used to examine the MC version.
-
MinecraftVersion
Construct a version object from the format major.minor.build, or the snapshot format.- Parameters:
versionOnly- - the version in text form.
-
MinecraftVersion
public MinecraftVersion(int major, int minor, int build) Construct a version object directly.- Parameters:
major- - major version number.minor- - minor version number.build- - build version number.
-
MinecraftVersion
Construct a version object directly.- Parameters:
major- - major version number.minor- - minor version number.build- - build version number.development- - development stage.
-
-
Method Details
-
extractVersion
Extract the Minecraft version from CraftBukkit itself.- Parameters:
text- - the server version in text form.- Returns:
- The underlying MC version.
- Throws:
IllegalStateException- If we could not parse the version string.
-
fromServerVersion
Parse the given server version into a Minecraft version.- Parameters:
serverVersion- - the server version.- Returns:
- The resulting Minecraft version.
-
getCurrentVersion
-
setCurrentVersion
-
getMajor
public int getMajor()Major version number- Returns:
- Current major version number.
-
getMinor
public int getMinor()Minor version number- Returns:
- Current minor version number.
-
getBuild
public int getBuild()Build version number- Returns:
- Current build version number.
-
getDevelopmentStage
Retrieve the development stage.- Returns:
- Development stage, or NULL if this is a release.
-
getSnapshot
Retrieve the snapshot version, or NULL if this is a release.- Returns:
- The snapshot version.
-
isSnapshot
public boolean isSnapshot()Determine if this version is a snapshot.- Returns:
- The snapshot version.
-
atOrAbove
public boolean atOrAbove()Checks if this version is at or above the current version the server is running.- Returns:
- true if this version is equal or newer than the server version, false otherwise.
-
getVersion
Retrieve the version String (major.minor.build) only.- Returns:
- A normal version string.
-
compareTo
- Specified by:
compareToin interfaceComparable<MinecraftVersion>
-
isAtLeast
-
equals
-
hashCode
public int hashCode() -
toString
-