From b97fa2b1c8341964af4ff5e896e0d6d9ee278353 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Wed, 26 Feb 2020 23:53:26 +0100 Subject: [PATCH] Added a response to the PluginMessage packet in the Login state --- .../network/translators/TranslatorsInit.java | 3 +++ .../java/JavaLoginPluginMessageTranslator.java | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginMessageTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java b/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java index 2abeebb8..f4ab1684 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/TranslatorsInit.java @@ -40,6 +40,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenW import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.world.*; +import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestPacket; import com.nukkitx.nbt.CompoundTagBuilder; import com.nukkitx.nbt.NbtUtils; import com.nukkitx.nbt.stream.NBTOutputStream; @@ -94,6 +95,8 @@ public class TranslatorsInit { } public static void start() { + Registry.registerJava(LoginPluginRequestPacket.class, new JavaLoginPluginMessageTranslator()); + Registry.registerJava(ServerJoinGamePacket.class, new JavaJoinGameTranslator()); Registry.registerJava(ServerPluginMessagePacket.class, new JavaPluginMessageTranslator()); Registry.registerJava(ServerChatPacket.class, new JavaChatTranslator()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginMessageTranslator.java new file mode 100644 index 00000000..f92fca9f --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginMessageTranslator.java @@ -0,0 +1,16 @@ +package org.geysermc.connector.network.translators.java; + +import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; +import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestPacket; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; + +public class JavaLoginPluginMessageTranslator extends PacketTranslator { + @Override + public void translate(LoginPluginRequestPacket packet, GeyserSession session) { + // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. + session.getDownstream().getSession().send( + new LoginPluginResponsePacket(packet.getMessageId(), null) + ); + } +}