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_CONSTANT
A map linking the protocol version number to itsProtocolVersion
representation.static ProtocolVersion
MAXIMUM_VERSION
Represents the highest supported version.static ProtocolVersion
MINIMUM_VERSION
Represents the lowest supported version.static String
SUPPORTED_VERSION_STRING
The 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 Modifier and Type Method Description String
getName()
Returns the user-friendly name for this protocol.int
getProtocol()
Returns the protocol as an int.static ProtocolVersion
getProtocolVersion(int protocol)
Gets theProtocolVersion
for the given protocol.boolean
isLegacy()
Returns whether thisProtocolVersion
is a legacy protocol.static boolean
isSupported(int protocol)
Returns whether the protocol is supported.static boolean
isSupported(ProtocolVersion version)
Returns whether theProtocolVersion
is supported.boolean
isUnknown()
Returns whether thisProtocolVersion
is unknown to the proxy.String
toString()
static ProtocolVersion
valueOf(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
-
-
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 itsProtocolVersion
representation.
-
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
public String getName()
Returns the user-friendly name for this protocol.- Returns:
- the protocol name
-
getProtocolVersion
public static ProtocolVersion getProtocolVersion(int protocol)
Gets theProtocolVersion
for 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 theProtocolVersion
is supported.- Parameters:
version
- the protocol version- Returns:
- if the protocol supported
-
isUnknown
public boolean isUnknown()
Returns whether thisProtocolVersion
is unknown to the proxy.- Returns:
- if the protocol is unknown
-
isLegacy
public boolean isLegacy()
Returns whether thisProtocolVersion
is a legacy protocol.- Returns:
- if the protocol is legacy
-
toString
public String toString()
- Overrides:
toString
in classEnum<ProtocolVersion>
-
-