From 24f026deb228bd77bd49c1d64389d75d5b4b8174 Mon Sep 17 00:00:00 2001 From: RhysB Date: Thu, 10 Dec 2020 10:15:22 +1000 Subject: [PATCH] Provide Online/Offline status of player to Poseidon --- .../moderntobeta/B_1_7/LoginStartTranslator.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/dirtpowered/releasetobeta/network/translator/moderntobeta/B_1_7/LoginStartTranslator.java b/src/main/java/com/github/dirtpowered/releasetobeta/network/translator/moderntobeta/B_1_7/LoginStartTranslator.java index b1c5789..5026dbf 100644 --- a/src/main/java/com/github/dirtpowered/releasetobeta/network/translator/moderntobeta/B_1_7/LoginStartTranslator.java +++ b/src/main/java/com/github/dirtpowered/releasetobeta/network/translator/moderntobeta/B_1_7/LoginStartTranslator.java @@ -42,12 +42,18 @@ public void translate(ReleaseToBeta main, LoginStartPacket packet, Session moder if (betaSession.getProtocolState() != ProtocolState.LOGIN) return; - boolean flag = R2BConfiguration.ipForwarding; + int header = 1; + long address = 0; + if(R2BConfiguration.ipForwarding) { + InetSocketAddress socketAddress = (InetSocketAddress) modernSession.getRemoteAddress(); + address = serializeAddress(socketAddress.getAddress().getHostAddress()); + if(R2BConfiguration.onlineMode) { + header = 26; + } else { + header = 25; + } - InetSocketAddress socketAddress = (InetSocketAddress) modernSession.getRemoteAddress(); - - long address = flag ? serializeAddress(socketAddress.getAddress().getHostAddress()) : 0; - byte header = (byte) (flag ? -999 : 1); + } betaSession.getPlayer().fillProfile(username, result -> { betaSession.sendPacket(new HandshakePacketData(username));