Enum Class ClientVersion

java.lang.Object
java.lang.Enum<ClientVersion>
com.github.retrooper.packetevents.protocol.player.ClientVersion
All Implemented Interfaces:
Serializable, Comparable<ClientVersion>, Constable

public enum ClientVersion extends Enum<ClientVersion>
Client Version. This is a nice tool for minecraft's client protocol versions. You won't have to memorize the protocol version, just memorize the client version as the version you see in the minecraft launcher. Some enum constants may represent two or more versions as there have been cases where some versions have the same protocol version due to no protocol changes. We added a comment over those enum constants so check it out.
Since:
1.6.9
See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static ClientVersion[] 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 ClientVersion 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
    • isPreRelease

      public static boolean isPreRelease(int protocolVersion)
    • isRelease

      public static boolean isRelease(int protocolVersion)
    • isPreRelease

      public boolean isPreRelease()
    • isRelease

      public boolean isRelease()
    • getReleaseName

      public String getReleaseName()
      Get the release name of this client version. For example, for the V_1_18 enum constant, it would return "1.18".
      Returns:
      Release name
    • getById

      @NotNull public static @NotNull ClientVersion getById(int protocolVersion)
      Get a ClientVersion enum by protocol version.
      Parameters:
      protocolVersion - Protocol version.
      Returns:
      ClientVersion
    • getLatest

      public static ClientVersion getLatest()
    • getOldest

      public static ClientVersion getOldest()
    • toServerVersion

      @Deprecated public ServerVersion toServerVersion()
      Deprecated.
    • getProtocolVersion

      public int getProtocolVersion()
      Protocol version of this client version.
      Returns:
      Protocol version.
    • isNewerThan

      public boolean isNewerThan(ClientVersion target)
      Is this client version newer than the compared client version? This method simply checks if this client version's protocol version is greater than the compared client version's protocol version.
      Parameters:
      target - Compared client version.
      Returns:
      Is this client version newer than the compared client version.
    • isNewerThanOrEquals

      public boolean isNewerThanOrEquals(ClientVersion target)
      Is this client version newer than or equal to the compared client version? This method simply checks if this client version's protocol version is newer than or equal to the compared client version's protocol version.
      Parameters:
      target - Compared client version.
      Returns:
      Is this client version newer than or equal to the compared client version.
    • isOlderThan

      public boolean isOlderThan(ClientVersion target)
      Is this client version older than the compared client version? This method simply checks if this client version's protocol version is less than the compared client version's protocol version.
      Parameters:
      target - Compared client version.
      Returns:
      Is this client version older than the compared client version.
    • isOlderThanOrEquals

      public boolean isOlderThanOrEquals(ClientVersion target)
      Is this client version older than or equal to the compared client version? This method simply checks if this client version's protocol version is older than or equal to the compared client version's protocol version.
      Parameters:
      target - Compared client version.
      Returns:
      Is this client version older than or equal to the compared client version.
    • is

      public boolean is(@NotNull @NotNull VersionComparison comparison, @NotNull @NotNull ClientVersion targetVersion)
      Is this client version newer than, older than or equal to the compared client version? This method simply checks if this client version's protocol version is greater than, less than or equal to the compared client version's protocol version.
      Parameters:
      comparison - Comparison type.
      targetVersion - Compared client version.
      Returns:
      true or false, based on the comparison type.
      See Also: