From 853fd2226da884943885984c990a7884e9ece81a Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 7 Dec 2018 17:24:56 -0500 Subject: [PATCH] Fix formatting in ProtocolVersion --- .../api/network/ProtocolVersion.java | 223 +++++++++--------- 1 file changed, 111 insertions(+), 112 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java index d413bc8bf..c3ca74271 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -1,138 +1,137 @@ package com.velocitypowered.api.network; import com.google.common.collect.ImmutableMap; -import com.velocitypowered.api.proxy.server.ServerInfo; - import java.util.HashMap; import java.util.Map; /** - * Represents each Minecraft protocol version + * Represents each Minecraft protocol version. */ public enum ProtocolVersion { - UNKNOWN(-1, "Unknown"), - LEGACY(-1, "Legacy"), - MINECRAFT_1_8(47, "1.8"), - MINECRAFT_1_9(107, "1.9"), - MINECRAFT_1_9_1(108, "1.9.1"), - MINECRAFT_1_9_2(109, "1.9.2"), - MINECRAFT_1_9_4(110, "1.9.4"), - MINECRAFT_1_10(210, "1.10"), - MINECRAFT_1_11(315, "1.11"), - MINECRAFT_1_11_1(316, "1.11.1"), - MINECRAFT_1_12(335, "1.12"), - MINECRAFT_1_12_1(338, "1.12.1"), - MINECRAFT_1_12_2(340, "1.12.2"), - MINECRAFT_1_13(393, "1.13"), - MINECRAFT_1_13_1(401, "1.13.1"), - MINECRAFT_1_13_2(404, "1.13.2"); + UNKNOWN(-1, "Unknown"), + LEGACY(-2, "Legacy"), + MINECRAFT_1_8(47, "1.8"), + MINECRAFT_1_9(107, "1.9"), + MINECRAFT_1_9_1(108, "1.9.1"), + MINECRAFT_1_9_2(109, "1.9.2"), + MINECRAFT_1_9_4(110, "1.9.4"), + MINECRAFT_1_10(210, "1.10"), + MINECRAFT_1_11(315, "1.11"), + MINECRAFT_1_11_1(316, "1.11.1"), + MINECRAFT_1_12(335, "1.12"), + MINECRAFT_1_12_1(338, "1.12.1"), + MINECRAFT_1_12_2(340, "1.12.2"), + MINECRAFT_1_13(393, "1.13"), + MINECRAFT_1_13_1(401, "1.13.1"), + MINECRAFT_1_13_2(404, "1.13.2"); - private final int protocol; - private final String name; + private final int protocol; + private final String name; - /** - * Represents the lowest supported version - */ - public static final ProtocolVersion MINIMUM_VERSION = MINECRAFT_1_8; - /** - * Represents the highest supported version - */ - public static final ProtocolVersion MAXIMUM_VERSION = MINECRAFT_1_13_2; + /** + * Represents the lowest supported version. + */ + public static final ProtocolVersion MINIMUM_VERSION = MINECRAFT_1_8; + /** + * Represents the highest supported version. + */ + public static final ProtocolVersion MAXIMUM_VERSION = MINECRAFT_1_13_2; - /** - * The user-friendly representation of the lowest and highest supported versions - */ - public static final String SUPPORTED_VERSION_STRING = String.format("%s-%s", MINIMUM_VERSION, MAXIMUM_VERSION); + /** + * The user-friendly representation of the lowest and highest supported versions. + */ + public static final String SUPPORTED_VERSION_STRING = String + .format("%s-%s", MINIMUM_VERSION, MAXIMUM_VERSION); - /** - * A map linking the protocol version number to its {@link ProtocolVersion} representation - */ - public static final ImmutableMap ID_TO_PROTOCOL_CONSTANT; + /** + * A map linking the protocol version number to its {@link ProtocolVersion} representation. + */ + public static final ImmutableMap ID_TO_PROTOCOL_CONSTANT; - static { - Map versions = new HashMap<>(); - for (ProtocolVersion version : values()) { - versions.put(version.protocol, version); - } - - ID_TO_PROTOCOL_CONSTANT = ImmutableMap.copyOf(versions); + static { + Map versions = new HashMap<>(); + for (ProtocolVersion version : values()) { + versions.put(version.protocol, version); } - ProtocolVersion(int protocol, String name) { - this.protocol = protocol; - this.name = name; - } + ID_TO_PROTOCOL_CONSTANT = ImmutableMap.copyOf(versions); + } - /** - * Returns the protocol as an int - * - * @return the protocol version - */ - public int getProtocol() { - return protocol; - } + ProtocolVersion(int protocol, String name) { + this.protocol = protocol; + this.name = name; + } - /** - * Returns the user-friendly name for this protocol - * - * @return the protocol name - */ - public String getName() { - return name; - } + /** + * Returns the protocol as an int. + * + * @return the protocol version + */ + public int getProtocol() { + return protocol; + } - /** - * Gets the {@link ProtocolVersion} for the given protocol - * - * @param protocol the protocol as an int - * @return the protocol version - */ - public static ProtocolVersion getProtocolVersion(int protocol) { - return ID_TO_PROTOCOL_CONSTANT.getOrDefault(protocol, UNKNOWN); - } + /** + * Returns the user-friendly name for this protocol. + * + * @return the protocol name + */ + public String getName() { + return name; + } - /** - * Returns whether the protocol is supported - * - * @param protocol the protocol as an int - * @return if the protocol supported - */ - public static boolean isSupported(int protocol) { - ProtocolVersion version = ID_TO_PROTOCOL_CONSTANT.get(protocol); + /** + * Gets the {@link ProtocolVersion} for the given protocol. + * + * @param protocol the protocol as an int + * @return the protocol version + */ + public static ProtocolVersion getProtocolVersion(int protocol) { + return ID_TO_PROTOCOL_CONSTANT.getOrDefault(protocol, UNKNOWN); + } - return version != null && !version.isUnknown(); - } + /** + * Returns whether the protocol is supported. + * + * @param protocol the protocol as an int + * @return if the protocol supported + */ + public static boolean isSupported(int protocol) { + ProtocolVersion version = ID_TO_PROTOCOL_CONSTANT.get(protocol); - /** - * Returns whether the {@link ProtocolVersion} is supported - * - * @param version the protocol version - * @return if the protocol supported - */ - public static boolean isSupported(ProtocolVersion version) { - return version != null && !version.isUnknown(); - } + return version != null && !version.isUnknown(); + } - /** - * Returns whether this {@link ProtocolVersion} is unknown to the proxy - * - * @return if the protocol is unknown - */ - public boolean isUnknown() { - return this == UNKNOWN; - } + /** + * Returns whether the {@link ProtocolVersion} is supported. + * + * @param version the protocol version + * @return if the protocol supported + */ + public static boolean isSupported(ProtocolVersion version) { + return version != null && !version.isUnknown(); + } - /** - * Returns whether this {@link ProtocolVersion} is a legacy protocol - * - * @return if the protocol is legacy - */ - public boolean isLegacy() { - return this == LEGACY; - } + /** + * Returns whether this {@link ProtocolVersion} is unknown to the proxy. + * + * @return if the protocol is unknown + */ + public boolean isUnknown() { + return this == UNKNOWN; + } - @Override - public String toString() { - return name; - } + /** + * Returns whether this {@link ProtocolVersion} is a legacy protocol. + * + * @return if the protocol is legacy + */ + public boolean isLegacy() { + return this == LEGACY; + } + + @Override + public String toString() { + return name; + } }