From be9547612fd5240257b4a93c9d47f3e0f0281349 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 7 Sep 2018 17:54:59 -0400 Subject: [PATCH] Misc code cleanup --- .../connection/backend/BackendPlaySessionHandler.java | 4 ++-- .../proxy/connection/backend/LoginSessionHandler.java | 4 ++-- .../connection/backend/VelocityServerConnection.java | 10 +++++----- .../connection/client/ClientPlaySessionHandler.java | 2 +- .../proxy/connection/client/ClientSettingsWrapper.java | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) 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 968feccfe..1a011a2e8 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 @@ -70,8 +70,8 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler { } if (!connection.hasCompletedJoin() && pm.getChannel().equals(VelocityConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL)) { - if (!connection.isModded()) { - connection.setModded(true); + if (!connection.isLegacyForge()) { + connection.setLegacyForge(true); // We must always reset the handshake before a modded connection is established if // we haven't done so already. 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 4d011110c..1a7f5e2df 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 @@ -85,7 +85,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } else { // The previous server connection should become obsolete. // Before we remove it, if the server we are departing is modded, we must always reset the client state. - if (existingConnection.isModded()) { + if (existingConnection.isLegacyForge()) { connection.getPlayer().sendLegacyForgeHandshakeResetPacket(); } existingConnection.disconnect(); @@ -123,7 +123,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } } - static ByteBuf createForwardingData(byte[] hmacSecret, String address, GameProfile profile) { + private static ByteBuf createForwardingData(byte[] hmacSecret, String address, GameProfile profile) { ByteBuf dataToForward = Unpooled.buffer(); ByteBuf finalData = Unpooled.buffer(); try { 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 6d37a8b65..fe472afba 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 @@ -43,7 +43,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, private final ConnectedPlayer proxyPlayer; private final VelocityServer server; private MinecraftConnection minecraftConnection; - private boolean isModded = false; + private boolean legacyForge = false; private boolean hasCompletedJoin = false; public VelocityServerConnection(ServerInfo target, ConnectedPlayer proxyPlayer, VelocityServer server) { @@ -159,12 +159,12 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, minecraftConnection.write(message); } - public boolean isModded() { - return isModded; + public boolean isLegacyForge() { + return legacyForge; } - public void setModded(boolean modded) { - isModded = modded; + public void setLegacyForge(boolean modded) { + legacyForge = modded; } public boolean hasCompletedJoin() { 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 b68311236..343054488 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 @@ -243,7 +243,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { return; } - if (player.getConnectedServer().isModded() && !player.getConnectedServer().hasCompletedJoin()) { + if (player.getConnectedServer().isLegacyForge() && !player.getConnectedServer().hasCompletedJoin()) { // Ensure that the messages are forwarded player.getConnectedServer().getMinecraftConnection().write(packet); return; diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java index e82fd354f..4977c5df9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientSettingsWrapper.java @@ -12,7 +12,7 @@ public class ClientSettingsWrapper implements PlayerSettings { private final SkinParts parts; private Locale locale = null; - public ClientSettingsWrapper(ClientSettings settings) { + ClientSettingsWrapper(ClientSettings settings) { this.settings = settings; this.parts = new SkinParts((byte) settings.getSkinParts()); }