Added a response to the PluginMessage packet in the Login state

This commit is contained in:
Tim203 2020-02-26 23:53:26 +01:00
parent 41a24ca6ab
commit b97fa2b1c8
2 changed files with 19 additions and 0 deletions

View File

@ -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());

View File

@ -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<LoginPluginRequestPacket> {
@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)
);
}
}