From 9806d57a13dce88a68db9dfec4615788d228521a Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 28 Oct 2018 02:36:03 -0400 Subject: [PATCH] More Checkstyle. --- .../proxy/command/VelocityCommand.java | 3 +- .../proxy/config/AnnotatedConfig.java | 29 ++++++++------- .../proxy/config/VelocityConfiguration.java | 34 +++++++++--------- .../proxy/connection/MinecraftConnection.java | 10 +++--- .../backend/BackendPlaySessionHandler.java | 12 +++---- .../backend/LoginSessionHandler.java | 7 ++-- .../backend/VelocityServerConnection.java | 6 ++-- .../client/ClientPlaySessionHandler.java | 20 +++++------ .../connection/client/ConnectedPlayer.java | 4 +-- .../plugin/util/PluginDependencyUtils.java | 16 ++++++--- .../proxy/protocol/StateRegistry.java | 36 +++++++++---------- .../netty/MinecraftCompressDecoder.java | 5 ++- .../proxy/testutil/FakePluginManager.java | 4 +-- 13 files changed, 94 insertions(+), 92 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java index 577a9a8ce..d6ff9718e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java @@ -104,8 +104,7 @@ public class VelocityCommand implements Command { .build(); TextComponent copyright = TextComponent .of("Copyright 2018 " + version.getVendor() + ". " + version.getName() - + " is freely licensed under the terms of the " + - "MIT License."); + + " is freely licensed under the terms of the MIT License."); source.sendMessage(velocity); source.sendMessage(copyright); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java b/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java index 134bb6725..da05586d8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/AnnotatedConfig.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** - * Simple annotation and fields based TOML configuration serializer + * Simple annotation and fields based TOML configuration serializer. */ public abstract class AnnotatedConfig { @@ -31,7 +31,7 @@ public abstract class AnnotatedConfig { } /** - * Indicates that a field is a table + * Indicates that a field is a table. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) @@ -41,7 +41,7 @@ public abstract class AnnotatedConfig { } /** - * Creates a comment + * Creates a comment. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) @@ -51,7 +51,7 @@ public abstract class AnnotatedConfig { } /** - * How field will be named in config + * How field will be named in config. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) @@ -61,7 +61,7 @@ public abstract class AnnotatedConfig { } /** - * Indicates that a field is a map and we need to save all map data to config + * Indicates that a field is a map and we need to save all map data to config. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) @@ -70,7 +70,7 @@ public abstract class AnnotatedConfig { } /** - * Indicates that a field is a string converted to byte[] + * Indicates that a field is a string converted to byte[]. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE}) @@ -79,7 +79,7 @@ public abstract class AnnotatedConfig { } /** - * Indicates that a field should be skipped + * Indicates that a field should be skipped. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) @@ -88,7 +88,7 @@ public abstract class AnnotatedConfig { } /** - * Dumps this configuration to list of strings using {@link #dumpConfig(Object)} + * Dumps this configuration to list of strings using {@link #dumpConfig(Object)}. * * @return configuration dump */ @@ -123,22 +123,23 @@ public abstract class AnnotatedConfig { } } - // Get a key name for config + // Get a key name for config. Use field name if @ConfigKey annotation is not present. ConfigKey key = field.getAnnotation(ConfigKey.class); - String name = safeKey(key == null ? field.getName() - : key.value()); // Use field name if @ConfigKey annotation is not present + final String name = safeKey(key == null ? field.getName() : key.value()); + + Object value = field.get(dumpable); // Check if field is table. Table table = field.getAnnotation(Table.class); if (table != null) { lines.add(table.value()); // Write [name] - lines.addAll(dumpConfig(field.get(dumpable))); // Dump fields of table + lines.addAll(dumpConfig(value)); // Dump fields of table continue; } if (field.getAnnotation(IsMap.class) != null) { // Check if field is a map @SuppressWarnings("unchecked") - Map map = (Map) field.get(dumpable); + Map map = (Map) value; for (Entry entry : map.entrySet()) { lines.add( safeKey(entry.getKey()) + " = " + serialize(entry.getValue())); // Save map data @@ -147,8 +148,6 @@ public abstract class AnnotatedConfig { continue; } - Object value = field.get(dumpable); - // Check if field is a byte[] representation of a string if (field.getAnnotation(StringAsBytes.class) != null) { value = new String((byte[]) value, StandardCharsets.UTF_8); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index b7ac585b2..d33df5f20 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -522,9 +522,9 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi @Override public String toString() { - return "ForcedHosts{" + - "forcedHosts=" + forcedHosts + - '}'; + return "ForcedHosts{" + + "forcedHosts=" + forcedHosts + + '}'; } } @@ -601,14 +601,14 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi @Override public String toString() { - return "Advanced{" + - "compressionThreshold=" + compressionThreshold + - ", compressionLevel=" + compressionLevel + - ", loginRatelimit=" + loginRatelimit + - ", connectionTimeout=" + connectionTimeout + - ", readTimeout=" + readTimeout + - ", proxyProtocol=" + proxyProtocol + - '}'; + return "Advanced{" + + "compressionThreshold=" + compressionThreshold + + ", compressionLevel=" + compressionLevel + + ", loginRatelimit=" + loginRatelimit + + ", connectionTimeout=" + connectionTimeout + + ", readTimeout=" + readTimeout + + ", proxyProtocol=" + proxyProtocol + + '}'; } } @@ -667,12 +667,12 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi @Override public String toString() { - return "Query{" + - "queryEnabled=" + queryEnabled + - ", queryPort=" + queryPort + - ", queryMap='" + queryMap + '\'' + - ", showPlugins=" + showPlugins + - '}'; + return "Query{" + + "queryEnabled=" + queryEnabled + + ", queryPort=" + queryPort + + ", queryMap='" + queryMap + '\'' + + ", showPlugins=" + showPlugins + + '}'; } } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index d474b903e..441ff38b6 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -58,7 +58,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { private @Nullable MinecraftConnectionAssociation association; private boolean isLegacyForge; private final VelocityServer server; - private boolean canSendLegacyFMLResetPacket = false; + private boolean canSendLegacyFmlResetPacket = false; public MinecraftConnection(Channel channel, VelocityServer server) { this.channel = channel; @@ -287,12 +287,12 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { this.isLegacyForge = isForge; } - public boolean canSendLegacyFMLResetPacket() { - return canSendLegacyFMLResetPacket; + public boolean canSendLegacyFmlResetPacket() { + return canSendLegacyFmlResetPacket; } - public void setCanSendLegacyFMLResetPacket(boolean canSendLegacyFMLResetPacket) { - this.canSendLegacyFMLResetPacket = isLegacyForge && canSendLegacyFMLResetPacket; + public void setCanSendLegacyFmlResetPacket(boolean canSendLegacyFMLResetPacket) { + this.canSendLegacyFmlResetPacket = isLegacyForge && canSendLegacyFMLResetPacket; } public int getNextProtocolVersion() { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java index d15811de0..c7c1a281f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/BackendPlaySessionHandler.java @@ -173,16 +173,16 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { if (mc == null) { return false; } - boolean isMCOrFMLMessage; + boolean minecraftOrFmlMessage; if (mc.getProtocolVersion() <= ProtocolConstants.MINECRAFT_1_12_2) { String channel = message.getChannel(); - isMCOrFMLMessage = channel.startsWith("MC|") || channel + minecraftOrFmlMessage = channel.startsWith("MC|") || channel .startsWith(ForgeConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL); } else { - isMCOrFMLMessage = message.getChannel().startsWith("minecraft:"); + minecraftOrFmlMessage = message.getChannel().startsWith("minecraft:"); } - return isMCOrFMLMessage || playerSessionHandler.getClientPluginMsgChannels() - .contains(message.getChannel()) || - server.getChannelRegistrar().registered(message.getChannel()); + return minecraftOrFmlMessage + || playerSessionHandler.getKnownChannels().contains(message.getChannel()) + || server.getChannelRegistrar().registered(message.getChannel()); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java index d9d63d13e..f04b4d869 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java @@ -32,6 +32,9 @@ import net.kyori.text.TextComponent; public class LoginSessionHandler implements MinecraftSessionHandler { + private static final TextComponent MODERN_IP_FORWARDING_FAILURE = TextComponent + .of("Your server did not send a forwarding request to the proxy. Is it set up correctly?"); + private final VelocityServer server; private final VelocityServerConnection serverConn; private final CompletableFuture resultFuture; @@ -100,9 +103,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { public boolean handle(ServerLoginSuccess packet) { if (server.getConfiguration().getPlayerInfoForwardingMode() == PlayerInfoForwarding.MODERN && !informationForwarded) { - resultFuture.complete(ConnectionRequestResults.forDisconnect( - TextComponent - .of("Your server did not send a forwarding request to the proxy. Is it set up correctly?"))); + resultFuture.complete(ConnectionRequestResults.forDisconnect(MODERN_IP_FORWARDING_FAILURE)); serverConn.disconnect(); return true; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java index 2e0bf3aa9..7f275e8f3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java @@ -198,7 +198,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, return legacyForge; } - public void setLegacyForge(boolean modded) { + void setLegacyForge(boolean modded) { legacyForge = modded; } @@ -210,7 +210,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, this.hasCompletedJoin = hasCompletedJoin; } - public boolean isGracefulDisconnect() { + boolean isGracefulDisconnect() { return gracefulDisconnect; } @@ -222,7 +222,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, return lastPingSent; } - public void setLastPingId(long lastPingId) { + void setLastPingId(long lastPingId) { this.lastPingId = lastPingId; this.lastPingSent = System.currentTimeMillis(); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index f87580847..84e96d0a5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -52,7 +52,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { private final ConnectedPlayer player; private boolean spawned = false; private final List serverBossBars = new ArrayList<>(); - private final Set clientPluginMsgChannels = new HashSet<>(); + private final Set knownChannels = new HashSet<>(); private final Queue loginPluginMessages = new ArrayDeque<>(); private final VelocityServer server; private @Nullable TabCompleteRequest outstandingTabComplete; @@ -163,11 +163,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { List actuallyRegistered = new ArrayList<>(); List channels = PluginMessageUtil.getChannels(packet); for (String channel : channels) { - if (clientPluginMsgChannels.size() >= MAX_PLUGIN_CHANNELS && - !clientPluginMsgChannels.contains(channel)) { + if (knownChannels.size() >= MAX_PLUGIN_CHANNELS && + !knownChannels.contains(channel)) { throw new IllegalStateException("Too many plugin message channels registered"); } - if (clientPluginMsgChannels.add(channel)) { + if (knownChannels.add(channel)) { actuallyRegistered.add(channel); } } @@ -179,7 +179,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { } } else if (PluginMessageUtil.isMCUnregister(packet)) { List channels = PluginMessageUtil.getChannels(packet); - clientPluginMsgChannels.removeAll(channels); + knownChannels.removeAll(channels); backendConn.write(packet); } else if (PluginMessageUtil.isMCBrand(packet)) { backendConn.write(PluginMessageUtil.rewriteMinecraftBrand(packet)); @@ -296,7 +296,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { // Forge client that we must reset on the next switch. // // The call will handle if the player is not a Forge player appropriately. - player.getConnection().setCanSendLegacyFMLResetPacket(true); + player.getConnection().setCanSendLegacyFmlResetPacket(true); } else { // Clear tab list to avoid duplicate entries player.getTabList().clearAll(); @@ -334,7 +334,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { // Tell the server about this client's plugin message channels. int serverVersion = serverMc.getProtocolVersion(); - Collection toRegister = new HashSet<>(clientPluginMsgChannels); + Collection toRegister = new HashSet<>(knownChannels); if (serverVersion >= ProtocolConstants.MINECRAFT_1_13) { toRegister.addAll(server.getChannelRegistrar().getModernChannelIds()); } else { @@ -370,7 +370,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { // don't want to set it false if this is a first connection to a Vanilla server. // // See LoginSessionHandler#handle for where the counterpart to this method is - player.getConnection().setCanSendLegacyFMLResetPacket(true); + player.getConnection().setCanSendLegacyFmlResetPacket(true); } } @@ -378,8 +378,8 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { return serverBossBars; } - public Set getClientPluginMsgChannels() { - return clientPluginMsgChannels; + public Set getKnownChannels() { + return knownChannels; } public void handleTabCompleteResponse(TabCompleteResponse response) { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index e29133861..91c9d3c53 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -450,9 +450,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } public void sendLegacyForgeHandshakeResetPacket() { - if (connection.canSendLegacyFMLResetPacket()) { + if (connection.canSendLegacyFmlResetPacket()) { connection.write(ForgeConstants.resetPacket()); - connection.setCanSendLegacyFMLResetPacket(false); + connection.setCanSendLegacyFmlResetPacket(false); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/plugin/util/PluginDependencyUtils.java b/proxy/src/main/java/com/velocitypowered/proxy/plugin/util/PluginDependencyUtils.java index 8be6c7609..2ba635c19 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/plugin/util/PluginDependencyUtils.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/plugin/util/PluginDependencyUtils.java @@ -15,7 +15,6 @@ import java.util.List; import java.util.Map; import java.util.Queue; import java.util.Set; -import org.checkerframework.checker.nullness.qual.NonNull; public class PluginDependencyUtils { @@ -23,8 +22,15 @@ public class PluginDependencyUtils { throw new AssertionError(); } - public static List sortCandidates( - List<@NonNull PluginDescription> candidates) { + /** + * Attempts to topographically sort all plugins for the proxy to load by dependencies using + * Kahn's algorithm. + * + * @param candidates the plugins to sort + * @return the sorted list of plugins + * @throws IllegalStateException if there is a circular loop in the dependency graph + */ + public static List sortCandidates(List candidates) { // Create our graph, we're going to be using this for Kahn's algorithm. MutableGraph graph = GraphBuilder.directed().allowsSelfLoops(false).build(); Map candidateMap = Maps @@ -69,7 +75,7 @@ public class PluginDependencyUtils { return sorted; } - public static Queue getNoDependencyCandidates(Graph graph) { + private static Queue getNoDependencyCandidates(Graph graph) { Queue found = new ArrayDeque<>(); for (PluginDescription node : graph.nodes()) { @@ -81,7 +87,7 @@ public class PluginDependencyUtils { return found; } - public static String createLoopInformation(Graph graph) { + private static String createLoopInformation(Graph graph) { StringBuilder repr = new StringBuilder("{"); for (EndpointPair edge : graph.edges()) { repr.append(edge.target().getId()).append(": ["); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java index 844f1eb90..498bc39ef 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java @@ -190,10 +190,8 @@ public enum StateRegistry { public static final int STATUS_ID = 1; public static final int LOGIN_ID = 2; - public final PacketRegistry CLIENTBOUND = new PacketRegistry( - ProtocolConstants.Direction.CLIENTBOUND); - public final PacketRegistry SERVERBOUND = new PacketRegistry( - ProtocolConstants.Direction.SERVERBOUND); + public final PacketRegistry CLIENTBOUND = new PacketRegistry(Direction.CLIENTBOUND); + public final PacketRegistry SERVERBOUND = new PacketRegistry(Direction.SERVERBOUND); public static class PacketRegistry { @@ -210,11 +208,11 @@ public enum StateRegistry { .put(MINECRAFT_1_13, ImmutableIntArray.of(MINECRAFT_1_13_1, MINECRAFT_1_13_2)); } - private final ProtocolConstants.Direction direction; + private final Direction direction; private final IntObjectMap versions = new IntObjectHashMap<>(16); private boolean fallback = true; - public PacketRegistry(Direction direction) { + PacketRegistry(Direction direction) { this.direction = direction; ProtocolConstants.SUPPORTED_VERSIONS .forEach(version -> versions.put(version, new ProtocolVersion(version))); @@ -267,10 +265,10 @@ public enum StateRegistry { public class ProtocolVersion { public final int version; - final IntObjectMap> packetIdToSupplier = new IntObjectHashMap<>( - 16, 0.5f); - final Object2IntMap> packetClassToId = new Object2IntOpenHashMap<>( - 16, 0.5f); + final IntObjectMap> packetIdToSupplier = + new IntObjectHashMap<>(16, 0.5f); + final Object2IntMap> packetClassToId = + new Object2IntOpenHashMap<>(16, 0.5f); ProtocolVersion(final int version) { this.version = version; @@ -312,11 +310,11 @@ public enum StateRegistry { @Override public String toString() { - return "PacketMapping{" + - "id=" + id + - ", protocolVersion=" + protocolVersion + - ", encodeOnly=" + encodeOnly + - '}'; + return "PacketMapping{" + + "id=" + id + + ", protocolVersion=" + protocolVersion + + ", encodeOnly=" + encodeOnly + + '}'; } @Override @@ -328,9 +326,9 @@ public enum StateRegistry { return false; } PacketMapping that = (PacketMapping) o; - return id == that.id && - protocolVersion == that.protocolVersion && - encodeOnly == that.encodeOnly; + return id == that.id + && protocolVersion == that.protocolVersion + && encodeOnly == that.encodeOnly; } @Override @@ -340,7 +338,7 @@ public enum StateRegistry { } /** - * Creates a PacketMapping using the provided arguments + * Creates a PacketMapping using the provided arguments. * * @param id Packet Id * @param version Protocol version diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java index 9d6200718..ef7c934ae 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java @@ -31,8 +31,8 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder { } Preconditions.checkState(uncompressedSize >= threshold, - "Uncompressed size %s doesn't make sense with threshold %s", uncompressedSize, threshold); - // Try to use the uncompressed size, but place a cap if it might be too big (possibly malicious). + "Uncompressed size %s is greater than threshold %s", + uncompressedSize, threshold); ByteBuf uncompressed = ctx.alloc() .buffer(Math.min(uncompressedSize, MAXIMUM_INITIAL_BUFFER_SIZE)); try { @@ -41,7 +41,6 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder { "Mismatched compression sizes"); out.add(uncompressed); } catch (Exception e) { - // If something went wrong, rethrow the exception, but ensure we free our temporary buffer first. uncompressed.release(); throw e; } diff --git a/proxy/src/test/java/com/velocitypowered/proxy/testutil/FakePluginManager.java b/proxy/src/test/java/com/velocitypowered/proxy/testutil/FakePluginManager.java index 2948d6256..1aedeeaab 100644 --- a/proxy/src/test/java/com/velocitypowered/proxy/testutil/FakePluginManager.java +++ b/proxy/src/test/java/com/velocitypowered/proxy/testutil/FakePluginManager.java @@ -14,8 +14,8 @@ public class FakePluginManager implements PluginManager { public static final Object PLUGIN_A = new Object(); public static final Object PLUGIN_B = new Object(); - public static final PluginContainer PC_A = new FakePluginContainer("a", PLUGIN_A); - public static final PluginContainer PC_B = new FakePluginContainer("b", PLUGIN_B); + private static final PluginContainer PC_A = new FakePluginContainer("a", PLUGIN_A); + private static final PluginContainer PC_B = new FakePluginContainer("b", PLUGIN_B); @Override public @NonNull Optional fromInstance(@NonNull Object instance) {