Enum Class ProtocolVersion

java.lang.Object
java.lang.Enum<ProtocolVersion>
com.velocitypowered.api.network.ProtocolVersion
All Implemented Interfaces:
Ordered<ProtocolVersion>, Serializable, Comparable<ProtocolVersion>, Constable

public enum ProtocolVersion extends Enum<ProtocolVersion> implements Ordered<ProtocolVersion>
Represents each Minecraft protocol version.
  • Enum Constant Details

  • Field Details

    • MINIMUM_VERSION

      public static final ProtocolVersion MINIMUM_VERSION
      Represents the lowest supported version.
    • MAXIMUM_VERSION

      public static final ProtocolVersion MAXIMUM_VERSION
      Represents the highest supported version.
    • SUPPORTED_VERSION_STRING

      public static final String SUPPORTED_VERSION_STRING
      The user-friendly representation of the lowest and highest supported versions.
    • ID_TO_PROTOCOL_CONSTANT

      public static final ImmutableMap<Integer,ProtocolVersion> ID_TO_PROTOCOL_CONSTANT
      A map linking the protocol version number to its ProtocolVersion representation.
    • SUPPORTED_VERSIONS

      public static final Set<ProtocolVersion> SUPPORTED_VERSIONS
      A set containing all the protocols that the proxy actually supports, excluding special-purpose "versions" like LEGACY and UNKNOWN.
  • 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
    • getProtocol

      public int getProtocol()
      Returns the protocol as an int.
      Returns:
      the protocol version
    • getName

      @Deprecated public String getName()
      Deprecated.
      A protocol may be shared by multiple versions. Use @link{#getVersionIntroducedIn()} or @link{#getVersionsSupportedBy()} to get more accurate version names.
      Returns the user-friendly name for this protocol.
      Returns:
      the protocol name
    • getVersionIntroducedIn

      public String getVersionIntroducedIn()
      Returns the user-friendly name of the version this protocol was introduced in.
      Returns:
      the version name
    • getMostRecentSupportedVersion

      public String getMostRecentSupportedVersion()
      Returns the user-friendly name of the last version this protocol is valid for.
      Returns:
      the version name
    • getVersionsSupportedBy

      public List<String> getVersionsSupportedBy()
      Returns all versions this protocol is valid for.
      Returns:
      the version names
    • isSupported

      public boolean isSupported()
      Returns whether this ProtocolVersion is supported.
      Returns:
      if the protocol supported
    • isSupported

      public static boolean isSupported(int protocol)
      Returns whether the protocol is supported.
      Parameters:
      protocol - the protocol as an int
      Returns:
      if the protocol supported
    • isSupported

      public static boolean isSupported(ProtocolVersion version)
      Returns whether the ProtocolVersion is supported.
      Parameters:
      version - the protocol version
      Returns:
      if the protocol supported
    • getProtocolVersion

      public static ProtocolVersion getProtocolVersion(int protocol)
      Gets the ProtocolVersion for the given protocol.
      Parameters:
      protocol - the protocol as an int
      Returns:
      the protocol version
    • isUnknown

      public boolean isUnknown()
      Returns whether this ProtocolVersion is unknown to the proxy.
      Returns:
      if the protocol is unknown
    • isLegacy

      public boolean isLegacy()
      Returns whether this ProtocolVersion is a legacy protocol.
      Returns:
      if the protocol is legacy
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ProtocolVersion>