Package com.velocitypowered.api.network
Enum ProtocolVersion
- java.lang.Object
-
- java.lang.Enum<ProtocolVersion>
-
- com.velocitypowered.api.network.ProtocolVersion
-
- All Implemented Interfaces:
Serializable,Comparable<ProtocolVersion>
public enum ProtocolVersion extends Enum<ProtocolVersion>
Represents each Minecraft protocol version.
-
-
Enum Constant Summary
-
Field Summary
Fields Modifier and Type Field Description static ImmutableMap<Integer,ProtocolVersion>ID_TO_PROTOCOL_CONSTANTA map linking the protocol version number to itsProtocolVersionrepresentation.static ProtocolVersionMAXIMUM_VERSIONRepresents the highest supported version.static ProtocolVersionMINIMUM_VERSIONRepresents the lowest supported version.static StringSUPPORTED_VERSION_STRINGThe user-friendly representation of the lowest and highest supported versions.static Set<ProtocolVersion>SUPPORTED_VERSIONS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringgetMostRecentSupportedVersion()Returns the user-friendly name of the last version this protocol is valid for.StringgetName()Deprecated.A protocol may be shared by multiple versions.intgetProtocol()Returns the protocol as an int.static ProtocolVersiongetProtocolVersion(int protocol)Gets theProtocolVersionfor the given protocol.StringgetVersionIntroducedIn()Returns the user-friendly name of the version this protocol was introduced in.List<String>getVersionsSupportedBy()Returns all versions this protocol is valid for.booleanisLegacy()Returns whether thisProtocolVersionis a legacy protocol.static booleanisSupported(int protocol)Returns whether the protocol is supported.static booleanisSupported(ProtocolVersion version)Returns whether theProtocolVersionis supported.booleanisUnknown()Returns whether thisProtocolVersionis unknown to the proxy.StringtoString()static ProtocolVersionvalueOf(String name)Returns the enum constant of this type with the specified name.static ProtocolVersion[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final ProtocolVersion UNKNOWN
-
LEGACY
public static final ProtocolVersion LEGACY
-
MINECRAFT_1_7_2
public static final ProtocolVersion MINECRAFT_1_7_2
-
MINECRAFT_1_7_6
public static final ProtocolVersion MINECRAFT_1_7_6
-
MINECRAFT_1_8
public static final ProtocolVersion MINECRAFT_1_8
-
MINECRAFT_1_9
public static final ProtocolVersion MINECRAFT_1_9
-
MINECRAFT_1_9_1
public static final ProtocolVersion MINECRAFT_1_9_1
-
MINECRAFT_1_9_2
public static final ProtocolVersion MINECRAFT_1_9_2
-
MINECRAFT_1_9_4
public static final ProtocolVersion MINECRAFT_1_9_4
-
MINECRAFT_1_10
public static final ProtocolVersion MINECRAFT_1_10
-
MINECRAFT_1_11
public static final ProtocolVersion MINECRAFT_1_11
-
MINECRAFT_1_11_1
public static final ProtocolVersion MINECRAFT_1_11_1
-
MINECRAFT_1_12
public static final ProtocolVersion MINECRAFT_1_12
-
MINECRAFT_1_12_1
public static final ProtocolVersion MINECRAFT_1_12_1
-
MINECRAFT_1_12_2
public static final ProtocolVersion MINECRAFT_1_12_2
-
MINECRAFT_1_13
public static final ProtocolVersion MINECRAFT_1_13
-
MINECRAFT_1_13_1
public static final ProtocolVersion MINECRAFT_1_13_1
-
MINECRAFT_1_13_2
public static final ProtocolVersion MINECRAFT_1_13_2
-
MINECRAFT_1_14
public static final ProtocolVersion MINECRAFT_1_14
-
MINECRAFT_1_14_1
public static final ProtocolVersion MINECRAFT_1_14_1
-
MINECRAFT_1_14_2
public static final ProtocolVersion MINECRAFT_1_14_2
-
MINECRAFT_1_14_3
public static final ProtocolVersion MINECRAFT_1_14_3
-
MINECRAFT_1_14_4
public static final ProtocolVersion MINECRAFT_1_14_4
-
MINECRAFT_1_15
public static final ProtocolVersion MINECRAFT_1_15
-
MINECRAFT_1_15_1
public static final ProtocolVersion MINECRAFT_1_15_1
-
MINECRAFT_1_15_2
public static final ProtocolVersion MINECRAFT_1_15_2
-
MINECRAFT_1_16
public static final ProtocolVersion MINECRAFT_1_16
-
MINECRAFT_1_16_1
public static final ProtocolVersion MINECRAFT_1_16_1
-
MINECRAFT_1_16_2
public static final ProtocolVersion MINECRAFT_1_16_2
-
MINECRAFT_1_16_3
public static final ProtocolVersion MINECRAFT_1_16_3
-
MINECRAFT_1_16_4
public static final ProtocolVersion MINECRAFT_1_16_4
-
MINECRAFT_1_17
public static final ProtocolVersion MINECRAFT_1_17
-
MINECRAFT_1_17_1
public static final ProtocolVersion MINECRAFT_1_17_1
-
MINECRAFT_1_18
public static final ProtocolVersion MINECRAFT_1_18
-
MINECRAFT_1_18_2
public static final ProtocolVersion MINECRAFT_1_18_2
-
MINECRAFT_1_19
public static final ProtocolVersion MINECRAFT_1_19
-
MINECRAFT_1_19_1
public static final ProtocolVersion MINECRAFT_1_19_1
-
MINECRAFT_1_19_3
public static final ProtocolVersion MINECRAFT_1_19_3
-
MINECRAFT_1_19_4
public static final ProtocolVersion MINECRAFT_1_19_4
-
MINECRAFT_1_20
public static final ProtocolVersion MINECRAFT_1_20
-
-
Field Detail
-
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 itsProtocolVersionrepresentation.
-
SUPPORTED_VERSIONS
public static final Set<ProtocolVersion> SUPPORTED_VERSIONS
-
-
Method Detail
-
values
public static ProtocolVersion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ProtocolVersion c : ProtocolVersion.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ProtocolVersion valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- 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
-
getProtocolVersion
public static ProtocolVersion getProtocolVersion(int protocol)
Gets theProtocolVersionfor the given protocol.- Parameters:
protocol- the protocol as an int- Returns:
- the protocol version
-
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 theProtocolVersionis supported.- Parameters:
version- the protocol version- Returns:
- if the protocol supported
-
isUnknown
public boolean isUnknown()
Returns whether thisProtocolVersionis unknown to the proxy.- Returns:
- if the protocol is unknown
-
isLegacy
public boolean isLegacy()
Returns whether thisProtocolVersionis a legacy protocol.- Returns:
- if the protocol is legacy
-
toString
public String toString()
- Overrides:
toStringin classEnum<ProtocolVersion>
-
-