Enum Class MinecraftVersion
- All Implemented Interfaces:
Serializable
,Comparable<MinecraftVersion>
,Constable
This enum holds all versions of Minecraft that we currently support.
- Author:
- TheBusyBiscuit, Walshy
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThis constant represents Minecraft (Java Edition) Version 1.16 (The "Nether Update")This constant represents Minecraft (Java Edition) Version 1.17 (The "Caves and Cliffs: Part I" Update)This constant represents Minecraft (Java Edition) Version 1.18 (The "Caves and Cliffs: Part II" Update)This constant represents Minecraft (Java Edition) Version 1.19 ("The Wild Update")This constant represents Minecraft (Java Edition) Version 1.20 ("The Trails & Tales Update")This constant represents Minecraft (Java Edition) Version 1.20.5 ("The Armored Paws Update")This is a very special state that represents the environment being a Unit Test and not an actual running Minecraft Server.This constant represents an exceptional state in which we were unable to identify the Minecraft Version we are using -
Method Summary
Modifier and TypeMethodDescriptiongetName()
This returns the name of thisMinecraftVersion
in a readable format.boolean
isAtLeast
(MinecraftVersion version) This method checks whether thisMinecraftVersion
is newer or equal to the givenMinecraftVersion
, An unknown version will default to false.boolean
isBefore
(int minecraftVersion, int patchVersion) Checks whether thisMinecraftVersion
is older than the specified minecraft and patch versionsboolean
isBefore
(MinecraftVersion version) This checks whether thisMinecraftVersion
is older than the specifiedMinecraftVersion
.boolean
isMinecraftVersion
(int minecraftVersion) This tests if the given minecraft version number matches with thisMinecraftVersion
.boolean
isMinecraftVersion
(int minecraftVersion, int patchVersion) This tests if the given minecraft version matches with thisMinecraftVersion
.boolean
This returns whether thisMinecraftVersion
is virtual or not.static MinecraftVersion
Returns the enum constant of this class with the specified name.static MinecraftVersion[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MINECRAFT_1_16
This constant represents Minecraft (Java Edition) Version 1.16 (The "Nether Update") -
MINECRAFT_1_17
This constant represents Minecraft (Java Edition) Version 1.17 (The "Caves and Cliffs: Part I" Update) -
MINECRAFT_1_18
This constant represents Minecraft (Java Edition) Version 1.18 (The "Caves and Cliffs: Part II" Update) -
MINECRAFT_1_19
This constant represents Minecraft (Java Edition) Version 1.19 ("The Wild Update") -
MINECRAFT_1_20
This constant represents Minecraft (Java Edition) Version 1.20 ("The Trails & Tales Update") -
MINECRAFT_1_20_5
This constant represents Minecraft (Java Edition) Version 1.20.5 ("The Armored Paws Update") -
UNKNOWN
This constant represents an exceptional state in which we were unable to identify the Minecraft Version we are using -
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
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
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 nameNullPointerException
- if the argument is null
-
getName
This returns the name of thisMinecraftVersion
in a readable format.- Returns:
- The name of this
MinecraftVersion
-
isVirtual
public boolean isVirtual()This returns whether thisMinecraftVersion
is virtual or not. A virtualMinecraftVersion
does not actually exist but is rather a state of theServer
software used. VirtualMinecraftVersions
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 thisMinecraftVersion
.You can obtain the version number by doing
PaperLib.getMinecraftVersion()
. It is equivalent to the "major" versionExample: "1.13" returns 13
- Parameters:
minecraftVersion
- TheInteger
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 thisMinecraftVersion
.You can obtain the version number by doing
PaperLib.getMinecraftVersion()
. It is equivalent to the "major" version
You can obtain the patch version by doingPaperLib.getMinecraftPatchVersion()
. It is equivalent to the "minor" versionExample: "1.13" returns 13
Example: "1.13.2" returns 13_2- Parameters:
minecraftVersion
- TheInteger
version to match- Returns:
- Whether this
MinecraftVersion
matches the specified version id
-
isAtLeast
This method checks whether thisMinecraftVersion
is newer or equal to the givenMinecraftVersion
, An unknown version will default to false.- Parameters:
version
- TheMinecraftVersion
to compare- Returns:
- Whether this
MinecraftVersion
is newer or equal to the givenMinecraftVersion
-
isBefore
This checks whether thisMinecraftVersion
is older than the specifiedMinecraftVersion
. An unknown version will default to true.- Parameters:
version
- TheMinecraftVersion
to compare- Returns:
- Whether this
MinecraftVersion
is older than the given one
-
isBefore
public boolean isBefore(int minecraftVersion, int patchVersion) Checks whether thisMinecraftVersion
is older than the specified minecraft and patch versions- Parameters:
minecraftVersion
- The minecraft versionpatchVersion
- The patch version- Returns:
- True if this version is before, False if this version is virtual or otherwise.
-