From 9e12a199cf86d0ca3c5fc91e90d4ef3d2c515ddd Mon Sep 17 00:00:00 2001 From: creeper123123321 Date: Sat, 2 Feb 2019 17:19:30 -0200 Subject: [PATCH] Login plugin request and response --- .../packets/PlayerPacket1_13.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java index a096b02e..7a49b6fa 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java @@ -9,6 +9,7 @@ import us.myles.ViaVersion.api.minecraft.Position; import us.myles.ViaVersion.api.minecraft.item.Item; import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.remapper.ValueCreator; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter; @@ -17,6 +18,25 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPacke public class PlayerPacket1_13 extends Rewriter { @Override protected void registerPackets(Protocol1_12_2To1_13 protocol) { + // Login Plugin Request + protocol.out(State.LOGIN, 0x04, -1, new PacketRemapper() { + @Override + public void registerMap() { + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper packetWrapper) throws Exception { + packetWrapper.cancel(); + packetWrapper.create(0x02, new ValueCreator() { // Plugin response + @Override + public void write(PacketWrapper newWrapper) throws Exception { + newWrapper.write(Type.VAR_INT, packetWrapper.read(Type.VAR_INT)); // Packet id + newWrapper.write(Type.BOOLEAN, false); // Success + } + }).sendToServer(Protocol1_12_2To1_13.class); + } + }); + } + }); //Plugin Message protocol.out(State.PLAY, 0x19, 0x18, new PacketRemapper() {