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 Details

    • v1_21_6

      public static final MinecraftVersion v1_21_6
      Version 1.21.6 - chase the skies
    • v1_21_5

      public static final MinecraftVersion v1_21_5
      Version 1.21.5 - spring to life drop
    • v1_21_4

      public static final MinecraftVersion v1_21_4
      Version 1.21.4 - the garden awakens drop
    • v1_21_2

      public static final MinecraftVersion v1_21_2
      Version 1.21.2 - the bundles of bravery drop
    • v1_21_0

      public static final MinecraftVersion v1_21_0
      Version 1.21.0 - the tricky trials update
    • v1_20_5

      public static final MinecraftVersion v1_20_5
      Version 1.20.5 - the cookie and transfer packet update
    • v1_20_4

      public static final MinecraftVersion v1_20_4
      Version 1.20.4 - the decorated pot update
    • CONFIG_PHASE_PROTOCOL_UPDATE

      public static final MinecraftVersion CONFIG_PHASE_PROTOCOL_UPDATE
      Version 1.20.2 - the update that added the configuration protocol phase.
    • TRAILS_AND_TAILS

      public static final MinecraftVersion TRAILS_AND_TAILS
      Version 1.20 - the trails and tails update
    • FEATURE_PREVIEW_2

      public static final MinecraftVersion FEATURE_PREVIEW_2
      Version 1.19.4 - the rest of the feature preview
    • FEATURE_PREVIEW_UPDATE

      public static final MinecraftVersion FEATURE_PREVIEW_UPDATE
      Version 1.19.3 - introducing feature preview
    • WILD_UPDATE

      public static final MinecraftVersion WILD_UPDATE
      Version 1.19 - the wild update
    • CAVES_CLIFFS_2

      public static final MinecraftVersion CAVES_CLIFFS_2
      Version 1.18 - caves and cliffs part 2
    • CAVES_CLIFFS_1

      public static final MinecraftVersion CAVES_CLIFFS_1
      Version 1.17 - caves and cliffs part 1
    • NETHER_UPDATE_4

      public static final MinecraftVersion NETHER_UPDATE_4
      Version 1.16.4
    • NETHER_UPDATE_2

      public static final MinecraftVersion NETHER_UPDATE_2
      Version 1.16.2 - breaking change to the nether update
    • NETHER_UPDATE

      public static final MinecraftVersion NETHER_UPDATE
      Version 1.16.0 - the nether update
    • BEE_UPDATE

      public static final MinecraftVersion BEE_UPDATE
      Version 1.15 - the bee update
    • VILLAGE_UPDATE

      public static final MinecraftVersion VILLAGE_UPDATE
      Version 1.14 - village and pillage update.
    • AQUATIC_UPDATE

      public static final MinecraftVersion AQUATIC_UPDATE
      Version 1.13 - update aquatic.
    • COLOR_UPDATE

      public static final MinecraftVersion COLOR_UPDATE
      Version 1.12 - the world of color update.
    • EXPLORATION_UPDATE

      public static final MinecraftVersion EXPLORATION_UPDATE
      Version 1.11 - the exploration update.
    • FROSTBURN_UPDATE

      public static final MinecraftVersion FROSTBURN_UPDATE
      Version 1.10 - the frostburn update.
    • COMBAT_UPDATE

      public static final MinecraftVersion COMBAT_UPDATE
      Version 1.9 - the combat update.
    • BOUNTIFUL_UPDATE

      public static final MinecraftVersion BOUNTIFUL_UPDATE
      Version 1.8 - the "bountiful" update.
    • SKIN_UPDATE

      public static final MinecraftVersion SKIN_UPDATE
      Version 1.7.8 - the update that changed the skin format (and distribution - R.I.P. player disguise)
    • WORLD_UPDATE

      public static final MinecraftVersion WORLD_UPDATE
      Version 1.7.2 - the update that changed the world.
    • HORSE_UPDATE

      public static final MinecraftVersion HORSE_UPDATE
      Version 1.6.1 - the horse update.
    • REDSTONE_UPDATE

      public static final MinecraftVersion REDSTONE_UPDATE
      Version 1.5.0 - the redstone update.
    • SCARY_UPDATE

      public static final MinecraftVersion SCARY_UPDATE
      Version 1.4.2 - the scary update (Wither Boss).
    • LATEST

      public static final MinecraftVersion 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

      public MinecraftVersion(String versionOnly)
      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

      public MinecraftVersion(int major, int minor, int build, String development)
      Construct a version object directly.
      Parameters:
      major - - major version number.
      minor - - minor version number.
      build - - build version number.
      development - - development stage.
  • Method Details

    • extractVersion

      public static String extractVersion(String text)
      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

      public static MinecraftVersion fromServerVersion(String serverVersion)
      Parse the given server version into a Minecraft version.
      Parameters:
      serverVersion - - the server version.
      Returns:
      The resulting Minecraft version.
    • getCurrentVersion

      public static MinecraftVersion getCurrentVersion()
    • setCurrentVersion

      public static void setCurrentVersion(MinecraftVersion version)
    • 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

      public String getDevelopmentStage()
      Retrieve the development stage.
      Returns:
      Development stage, or NULL if this is a release.
    • getSnapshot

      public SnapshotVersion 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

      public String getVersion()
      Retrieve the version String (major.minor.build) only.
      Returns:
      A normal version string.
    • compareTo

      public int compareTo(MinecraftVersion o)
      Specified by:
      compareTo in interface Comparable<MinecraftVersion>
    • isAtLeast

      public boolean isAtLeast(MinecraftVersion other)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object