Enum Class ProtocolVersion

java.lang.Object
java.lang.Enum<ProtocolVersion>
me.neznamy.tab.api.ProtocolVersion
All Implemented Interfaces:
Serializable, Comparable<ProtocolVersion>, Constable

public enum ProtocolVersion extends Enum<ProtocolVersion>
Enum class representing all possibly used protocol versions
  • Enum Constant Details

  • Field Details

    • VALUES

      public static final ProtocolVersion[] VALUES
      Value array to iterate over to avoid array creations on each call
  • Method Details

    • values

      public static ProtocolVersion[] 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 ProtocolVersion 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
    • getNetworkId

      public int getNetworkId()
      Returns the version's network id
      Returns:
      version's network id
    • getFriendlyName

      public String getFriendlyName()
      Returns user-friendly name of the version (such as 1.16.2 instead of V1_16_2)
      Returns:
      user-friendly name of the version
    • getMinorVersion

      public int getMinorVersion()
      Returns minor version of this release, such as 8 for 1.8.x or 13 for 1.13.x
      Returns:
      version's minor version
    • setMinorVersion

      public void setMinorVersion(int minorVersion)
      Overrides minor version of the version instance. This is used internally to set minor version of UNKNOWN_SERVER_VERSION value to value from package to fix compatibility with server forks that set bukkit version field value to "Unknown".
      Parameters:
      minorVersion - minor version to change value to
    • fromFriendlyName

      public static ProtocolVersion fromFriendlyName(String friendlyName)
      Returns enum constant of entered version or UNKNOWN_SERVER_VERSION if unknown version
      Parameters:
      friendlyName - friendly name of the version
      Returns:
      version or UNKNOWN_SERVER_VERSION if version is unknown
    • fromNetworkId

      public static ProtocolVersion fromNetworkId(int networkId)
      Returns version from given network id
      Parameters:
      networkId - network id of protocol version
      Returns:
      version from given network id