3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

ProtocolVersion#SUPPORTED_VERSIONS

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-12-13 05:24:37 -05:00
Ursprung da12008736
Commit 1856fb6aad

Datei anzeigen

@ -1,8 +1,11 @@
package com.velocitypowered.api.network; package com.velocitypowered.api.network;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Represents each Minecraft protocol version. * Represents each Minecraft protocol version.
@ -57,6 +60,23 @@ public enum ProtocolVersion {
ID_TO_PROTOCOL_CONSTANT = ImmutableMap.copyOf(versions); ID_TO_PROTOCOL_CONSTANT = ImmutableMap.copyOf(versions);
} }
/**
* A set containing all the protocols that the proxy actually supports, excluding special-purpose
* "versions" like {@link #LEGACY} and {@link #UNKNOWN}.
*/
public static final Set<ProtocolVersion> SUPPORTED_VERSIONS;
static {
Set<ProtocolVersion> versions = EnumSet.noneOf(ProtocolVersion.class);
for (ProtocolVersion value : values()) {
if (!value.isUnknown() && !value.isLegacy()) {
versions.add(value);
}
}
SUPPORTED_VERSIONS = Sets.immutableEnumSet(versions);
}
ProtocolVersion(int protocol, String name) { ProtocolVersion(int protocol, String name) {
this.protocol = protocol; this.protocol = protocol;
this.name = name; this.name = name;