Enum Class ServerVersion

java.lang.Object
java.lang.Enum<ServerVersion>
com.github.retrooper.packetevents.manager.server.ServerVersion
All Implemented Interfaces:
Serializable, Comparable<ServerVersion>, Constable

public enum ServerVersion extends Enum<ServerVersion>
Server Version. This is a nice wrapper over minecraft's protocol versions. You won't have to memorize the protocol version, just memorize the server version you see in the launcher.
Since:
1.6.9
See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static ServerVersion[] 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 ServerVersion 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
    • reversedValues

      public static ServerVersion[] reversedValues()
    • getLatest

      public static ServerVersion getLatest()
    • getOldest

      public static ServerVersion getOldest()
    • getById

      @Deprecated public static ServerVersion getById(int protocolVersion)
      Deprecated.
    • toClientVersion

      public ClientVersion toClientVersion()
    • getReleaseName

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

      public int getProtocolVersion()
      Get this server version's protocol version.
      Returns:
      Protocol version.
    • isNewerThan

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

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

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

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

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