public static class MinecraftVersions.Version extends java.lang.Object implements java.lang.Comparable<MinecraftVersions.Version>
| Constructor and Description |
|---|
Version(int major,
int minor,
int patch,
int protocol)
Creates a new Version instance.
|
Version(@NotNull MinecraftVersions.Update update,
int patch,
int protocol)
Creates a new Version instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(@NotNull MinecraftVersions.Version other) |
boolean |
equals(java.lang.Object o) |
int |
getMajor()
Returns the major version.
|
int |
getMinor()
Returns the minor version.
|
int |
getPatch()
Returns the patch number, the last number in the version.
|
int |
getProtocol()
Returns the protocol version, like R1, R2, etc.
|
@NotNull MinecraftVersions.Update |
getUpdate()
Returns the parent update, or null if this version was not created from an update.
|
int |
hashCode() |
boolean |
isAbove()
Returns true if the server version is newer than this version.
|
boolean |
isAtLeast()
Returns true if the server version is at least this version.
|
boolean |
isAtMost()
Returns true if the server version is at most this version.
|
boolean |
isBelow()
Returns true if the server version is older than this version.
|
boolean |
isCurrent()
Returns true if the server version equals this version.
|
@NotNull java.lang.String |
toProtocolString()
Returns the version in the protocol format, e.g., `v1_16_R3`.
|
@NotNull java.lang.String |
toString() |
public Version(int major,
int minor,
int patch,
int protocol)
major - The major number.minor - The minor number.patch - The patch number.protocol - The current protocol version.public Version(@NotNull
@NotNull MinecraftVersions.Update update,
int patch,
int protocol)
update - The parent update.patch - The patch number.protocol - The current protocol version.@NotNull public @NotNull MinecraftVersions.Update getUpdate()
public int getMajor()
public int getMinor()
public int getPatch()
public int getProtocol()
If the version is "unknown" (not included in the utility), this will return -1. This happens usually because a new version of Minecraft was released after this utility was created... Be sure to keep this updated!
public boolean isCurrent()
public boolean isAbove()
public boolean isAtLeast()
public boolean isBelow()
public boolean isAtMost()
@NotNull public @NotNull java.lang.String toProtocolString()
public int compareTo(@NotNull
@NotNull MinecraftVersions.Version other)
compareTo in interface java.lang.Comparable<MinecraftVersions.Version>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object@NotNull public @NotNull java.lang.String toString()
toString in class java.lang.Object