public final class MinecraftVersion extends Object implements Comparable<MinecraftVersion>
| Modifier and Type | Field and Description |
|---|---|
static Comparator<MinecraftVersion> |
COMPARATOR |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(MinecraftVersion that) |
boolean |
equals(Object obj) |
int |
getBuild()
Gets the build component of the version.
|
String |
getDevelopmentStage()
Gets the development stage.
|
int |
getMajor()
Gets the major component of the version.
|
int |
getMinor()
Gets the minor component of the version.
|
static MinecraftVersion |
getRuntimeVersion()
Gets the
MinecraftVersion of the runtime server. |
SnapshotVersion |
getSnapshot()
Gets the snapshot version, or null if this is a release.
|
String |
getVersion()
Gets the version String (major.minor.build) only.
|
int |
hashCode() |
boolean |
isAfter(MinecraftVersion other)
Gets if this version was released after another version.
|
boolean |
isAfterOrEq(MinecraftVersion other)
Gets if this version was released after another version, or is equal to it.
|
boolean |
isBefore(MinecraftVersion other)
Gets if this version was released before another version.
|
boolean |
isBeforeOrEq(MinecraftVersion other)
Gets if this version was released before another version, or is equal to it.
|
boolean |
isBetween(MinecraftVersion o1,
MinecraftVersion o2)
Gets if this version was released in the period between two other versions, or is equal
to either of them.
|
boolean |
isSnapshot()
Gets if this version is a snapshot.
|
static MinecraftVersion |
of(int major,
int minor,
int build)
Creates a new
MinecraftVersion with the given properties. |
static MinecraftVersion |
parse(String version)
Parses a
MinecraftVersion from a version string, in the format
major.minor.build, or in the snapshot format. |
static MinecraftVersion |
parse(String version,
boolean parseSnapshot)
Parses a
MinecraftVersion from a version string, in the format
major.minor.build, or in the snapshot format. |
String |
toString() |
public static final Comparator<MinecraftVersion> COMPARATOR
public static MinecraftVersion getRuntimeVersion()
MinecraftVersion of the runtime server.public static MinecraftVersion of(int major, int minor, int build)
MinecraftVersion with the given properties.major - the major componentminor - the minor componentbuild - the build componentpublic static MinecraftVersion parse(String version) throws IllegalArgumentException
MinecraftVersion from a version string, in the format
major.minor.build, or in the snapshot format.version - the version in text form.IllegalArgumentException - if unable to parsepublic static MinecraftVersion parse(String version, boolean parseSnapshot) throws IllegalArgumentException
MinecraftVersion from a version string, in the format
major.minor.build, or in the snapshot format.version - the version in text form.parseSnapshot - if the implementation should try to parse a snapshot versionIllegalArgumentException - if unable to parsepublic int getMajor()
public int getMinor()
public int getBuild()
@Nullable public String getDevelopmentStage()
@Nullable public SnapshotVersion getSnapshot()
public boolean isSnapshot()
@Nonnull public String getVersion()
public int compareTo(MinecraftVersion that)
compareTo in interface Comparable<MinecraftVersion>public boolean isAfter(MinecraftVersion other)
other - the other versionpublic boolean isAfterOrEq(MinecraftVersion other)
other - the other versionpublic boolean isBefore(MinecraftVersion other)
other - the other versionpublic boolean isBeforeOrEq(MinecraftVersion other)
other - the other versionpublic boolean isBetween(MinecraftVersion o1, MinecraftVersion o2)
o1 - the first other versiono2 - the second other versionCopyright © 2022. All rights reserved.