Enum Class MinecraftVersion

java.lang.Object
java.lang.Enum<MinecraftVersion>
io.github.thebusybiscuit.slimefun4.api.MinecraftVersion
All Implemented Interfaces:
Serializable, Comparable<MinecraftVersion>, Constable

public enum MinecraftVersion extends Enum<MinecraftVersion>
This enum holds all versions of Minecraft that we currently support.
Author:
TheBusyBiscuit, Walshy
See Also:
  • Enum Constant Details

    • MINECRAFT_1_16

      public static final MinecraftVersion MINECRAFT_1_16
      This constant represents Minecraft (Java Edition) Version 1.16 (The "Nether Update")
    • MINECRAFT_1_17

      public static final MinecraftVersion MINECRAFT_1_17
      This constant represents Minecraft (Java Edition) Version 1.17 (The "Caves and Cliffs: Part I" Update)
    • MINECRAFT_1_18

      public static final MinecraftVersion MINECRAFT_1_18
      This constant represents Minecraft (Java Edition) Version 1.18 (The "Caves and Cliffs: Part II" Update)
    • MINECRAFT_1_19

      public static final MinecraftVersion MINECRAFT_1_19
      This constant represents Minecraft (Java Edition) Version 1.19 ("The Wild Update")
    • MINECRAFT_1_20

      public static final MinecraftVersion MINECRAFT_1_20
      This constant represents Minecraft (Java Edition) Version 1.20 ("The Trails & Tales Update")
    • MINECRAFT_1_20_5

      public static final MinecraftVersion MINECRAFT_1_20_5
      This constant represents Minecraft (Java Edition) Version 1.20.5 ("The Armored Paws Update")
    • UNKNOWN

      public static final MinecraftVersion UNKNOWN
      This constant represents an exceptional state in which we were unable to identify the Minecraft Version we are using
    • UNIT_TEST

      public static final MinecraftVersion UNIT_TEST
      This is a very special state that represents the environment being a Unit Test and not an actual running Minecraft Server.
  • Method Details

    • values

      public static MinecraftVersion[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MinecraftVersion valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getName

      @Nonnull public String getName()
      This returns the name of this MinecraftVersion in a readable format.
      Returns:
      The name of this MinecraftVersion
    • isVirtual

      public boolean isVirtual()
      This returns whether this MinecraftVersion is virtual or not. A virtual MinecraftVersion does not actually exist but is rather a state of the Server software used. Virtual MinecraftVersions include "UNKNOWN" and "UNIT TEST".
      Returns:
      Whether this MinecraftVersion is virtual or not
    • isMinecraftVersion

      public boolean isMinecraftVersion(int minecraftVersion)
      This tests if the given minecraft version number matches with this MinecraftVersion.

      You can obtain the version number by doing PaperLib.getMinecraftVersion(). It is equivalent to the "major" version

      Example: "1.13" returns 13

      Parameters:
      minecraftVersion - The Integer version to match
      Returns:
      Whether this MinecraftVersion matches the specified version id
    • isMinecraftVersion

      public boolean isMinecraftVersion(int minecraftVersion, int patchVersion)
      This tests if the given minecraft version matches with this MinecraftVersion.

      You can obtain the version number by doing PaperLib.getMinecraftVersion(). It is equivalent to the "major" version
      You can obtain the patch version by doing PaperLib.getMinecraftPatchVersion(). It is equivalent to the "minor" version

      Example: "1.13" returns 13
      Example: "1.13.2" returns 13_2

      Parameters:
      minecraftVersion - The Integer version to match
      Returns:
      Whether this MinecraftVersion matches the specified version id
    • isAtLeast

      public boolean isAtLeast(@Nonnull MinecraftVersion version)
      This method checks whether this MinecraftVersion is newer or equal to the given MinecraftVersion, An unknown version will default to false.
      Parameters:
      version - The MinecraftVersion to compare
      Returns:
      Whether this MinecraftVersion is newer or equal to the given MinecraftVersion
    • isBefore

      public boolean isBefore(@Nonnull MinecraftVersion version)
      This checks whether this MinecraftVersion is older than the specified MinecraftVersion. An unknown version will default to true.
      Parameters:
      version - The MinecraftVersion to compare
      Returns:
      Whether this MinecraftVersion is older than the given one
    • isBefore

      public boolean isBefore(int minecraftVersion, int patchVersion)
      Checks whether this MinecraftVersion is older than the specified minecraft and patch versions
      Parameters:
      minecraftVersion - The minecraft version
      patchVersion - The patch version
      Returns:
      True if this version is before, False if this version is virtual or otherwise.