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

Misc code cleanup

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-07 17:54:59 -04:00
Ursprung a66246b83c
Commit be9547612f
5 geänderte Dateien mit 11 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -70,8 +70,8 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
} }
if (!connection.hasCompletedJoin() && pm.getChannel().equals(VelocityConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL)) { if (!connection.hasCompletedJoin() && pm.getChannel().equals(VelocityConstants.FORGE_LEGACY_HANDSHAKE_CHANNEL)) {
if (!connection.isModded()) { if (!connection.isLegacyForge()) {
connection.setModded(true); connection.setLegacyForge(true);
// We must always reset the handshake before a modded connection is established if // We must always reset the handshake before a modded connection is established if
// we haven't done so already. // we haven't done so already.

Datei anzeigen

@ -85,7 +85,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
} else { } else {
// The previous server connection should become obsolete. // 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. // 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(); connection.getPlayer().sendLegacyForgeHandshakeResetPacket();
} }
existingConnection.disconnect(); 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 dataToForward = Unpooled.buffer();
ByteBuf finalData = Unpooled.buffer(); ByteBuf finalData = Unpooled.buffer();
try { try {

Datei anzeigen

@ -43,7 +43,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
private final ConnectedPlayer proxyPlayer; private final ConnectedPlayer proxyPlayer;
private final VelocityServer server; private final VelocityServer server;
private MinecraftConnection minecraftConnection; private MinecraftConnection minecraftConnection;
private boolean isModded = false; private boolean legacyForge = false;
private boolean hasCompletedJoin = false; private boolean hasCompletedJoin = false;
public VelocityServerConnection(ServerInfo target, ConnectedPlayer proxyPlayer, VelocityServer server) { public VelocityServerConnection(ServerInfo target, ConnectedPlayer proxyPlayer, VelocityServer server) {
@ -159,12 +159,12 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
minecraftConnection.write(message); minecraftConnection.write(message);
} }
public boolean isModded() { public boolean isLegacyForge() {
return isModded; return legacyForge;
} }
public void setModded(boolean modded) { public void setLegacyForge(boolean modded) {
isModded = modded; legacyForge = modded;
} }
public boolean hasCompletedJoin() { public boolean hasCompletedJoin() {

Datei anzeigen

@ -243,7 +243,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
return; return;
} }
if (player.getConnectedServer().isModded() && !player.getConnectedServer().hasCompletedJoin()) { if (player.getConnectedServer().isLegacyForge() && !player.getConnectedServer().hasCompletedJoin()) {
// Ensure that the messages are forwarded // Ensure that the messages are forwarded
player.getConnectedServer().getMinecraftConnection().write(packet); player.getConnectedServer().getMinecraftConnection().write(packet);
return; return;

Datei anzeigen

@ -12,7 +12,7 @@ public class ClientSettingsWrapper implements PlayerSettings {
private final SkinParts parts; private final SkinParts parts;
private Locale locale = null; private Locale locale = null;
public ClientSettingsWrapper(ClientSettings settings) { ClientSettingsWrapper(ClientSettings settings) {
this.settings = settings; this.settings = settings;
this.parts = new SkinParts((byte) settings.getSkinParts()); this.parts = new SkinParts((byte) settings.getSkinParts());
} }