From e6be30ba29e04bbeeda627d1c33fa39b0656f1f9 Mon Sep 17 00:00:00 2001 From: MiGoYAm Date: Sun, 12 Dec 2021 19:45:23 +0100 Subject: [PATCH 1/3] small improvement --- src/main/java/ru/nanit/limbo/protocol/registry/State.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/protocol/registry/State.java b/src/main/java/ru/nanit/limbo/protocol/registry/State.java index 115d87f..4b377d4 100644 --- a/src/main/java/ru/nanit/limbo/protocol/registry/State.java +++ b/src/main/java/ru/nanit/limbo/protocol/registry/State.java @@ -80,8 +80,7 @@ public enum State { clientBound.register(PacketJoinGame::new, map(0x01, V1_8, V1_8), map(0x23, V1_9, V1_12_2), - map(0x25, V1_13, V1_13_2), - map(0x25, V1_14, V1_14_4), + map(0x25, V1_13, V1_14_4), map(0x26, V1_15, V1_15_2), map(0x25, V1_16, V1_16_1), map(0x24, V1_16_2, V1_16_4), From d49a16ba35d31d92fe34c6abb044227e55df9403 Mon Sep 17 00:00:00 2001 From: MiGoYAm Date: Thu, 23 Dec 2021 13:15:14 +0100 Subject: [PATCH 2/3] Send PacketDeclareCommand only when limbo is connected to proxy --- .../ru/nanit/limbo/connection/ClientConnection.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java index e0b7473..353c4c5 100644 --- a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java +++ b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java @@ -23,6 +23,7 @@ import ru.nanit.limbo.protocol.packets.status.PacketStatusResponse; import ru.nanit.limbo.protocol.registry.State; import ru.nanit.limbo.protocol.registry.Version; import ru.nanit.limbo.server.LimboServer; +import ru.nanit.limbo.server.data.InfoForwarding; import ru.nanit.limbo.server.data.Title; import ru.nanit.limbo.util.Logger; import ru.nanit.limbo.util.UuidUtil; @@ -405,15 +406,17 @@ public class ClientConnection extends ChannelInboundHandlerAdapter { info.setGameMode(server.getConfig().getGameMode()); info.setUuid(uuid); - PacketDeclareCommands declareCommands = new PacketDeclareCommands(); - declareCommands.setCommands(Collections.singletonList("limbo")); - PACKET_LOGIN_SUCCESS = PreEncodedPacket.of(loginSuccess); PACKET_JOIN_GAME = PreEncodedPacket.of(joinGame); PACKET_PLAYER_ABILITIES = PreEncodedPacket.of(playerAbilities); PACKET_PLAYER_POS = PreEncodedPacket.of(positionAndLook); PACKET_PLAYER_INFO = PreEncodedPacket.of(info); - PACKET_DECLARE_COMMANDS = PreEncodedPacket.of(declareCommands); + + if (!server.getConfig().getInfoForwarding().isNone()){// or server.getConfig().getInfoForwarding().getType() != InfoForwarding.Type.NONE + PacketDeclareCommands declareCommands = new PacketDeclareCommands(); + declareCommands.setCommands(Collections.emptyList()); + PACKET_DECLARE_COMMANDS = PreEncodedPacket.of(declareCommands); + } if (server.getConfig().isUseBrandName()){ PacketPluginMessage pluginMessage = new PacketPluginMessage(); From e6bcee3e73eb5218207544a17a8c1463b95b86e1 Mon Sep 17 00:00:00 2001 From: MiGoYAm Date: Thu, 23 Dec 2021 19:00:48 +0100 Subject: [PATCH 3/3] fix --- .../ru/nanit/limbo/connection/ClientConnection.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java index 353c4c5..9d585bf 100644 --- a/src/main/java/ru/nanit/limbo/connection/ClientConnection.java +++ b/src/main/java/ru/nanit/limbo/connection/ClientConnection.java @@ -23,7 +23,6 @@ import ru.nanit.limbo.protocol.packets.status.PacketStatusResponse; import ru.nanit.limbo.protocol.registry.State; import ru.nanit.limbo.protocol.registry.Version; import ru.nanit.limbo.server.LimboServer; -import ru.nanit.limbo.server.data.InfoForwarding; import ru.nanit.limbo.server.data.Title; import ru.nanit.limbo.util.Logger; import ru.nanit.limbo.util.UuidUtil; @@ -224,7 +223,7 @@ public class ClientConnection extends ChannelInboundHandlerAdapter { if (clientVersion.moreOrEqual(Version.V1_13)){ writePacket(PACKET_DECLARE_COMMANDS); - if(PACKET_PLUGIN_MESSAGE != null) + if (PACKET_PLUGIN_MESSAGE != null) writePacket(PACKET_PLUGIN_MESSAGE); } @@ -406,17 +405,15 @@ public class ClientConnection extends ChannelInboundHandlerAdapter { info.setGameMode(server.getConfig().getGameMode()); info.setUuid(uuid); + PacketDeclareCommands declareCommands = new PacketDeclareCommands(); + declareCommands.setCommands(Collections.emptyList()); + PACKET_LOGIN_SUCCESS = PreEncodedPacket.of(loginSuccess); PACKET_JOIN_GAME = PreEncodedPacket.of(joinGame); PACKET_PLAYER_ABILITIES = PreEncodedPacket.of(playerAbilities); PACKET_PLAYER_POS = PreEncodedPacket.of(positionAndLook); PACKET_PLAYER_INFO = PreEncodedPacket.of(info); - - if (!server.getConfig().getInfoForwarding().isNone()){// or server.getConfig().getInfoForwarding().getType() != InfoForwarding.Type.NONE - PacketDeclareCommands declareCommands = new PacketDeclareCommands(); - declareCommands.setCommands(Collections.emptyList()); - PACKET_DECLARE_COMMANDS = PreEncodedPacket.of(declareCommands); - } + PACKET_DECLARE_COMMANDS = PreEncodedPacket.of(declareCommands); if (server.getConfig().isUseBrandName()){ PacketPluginMessage pluginMessage = new PacketPluginMessage();