From 6c8ccb1b1e58f91fb50e724dbbf6d62906a52e82 Mon Sep 17 00:00:00 2001 From: Myles Date: Wed, 23 Mar 2016 13:37:45 +0000 Subject: [PATCH] Don't send place block twice (1.9 will use use_item to handle items), fixes #244 (may fix more) --- .../myles/ViaVersion/transformers/IncomingTransformer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java index 75acf3441..64a7f85f2 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java @@ -35,6 +35,7 @@ public class IncomingTransformer { if (packet.getPacketID() != -1) { packetID = packet.getPacketID(); } + if (plugin.isDebug()) { if (packet != PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST && packet != PacketType.PLAY_KEEP_ALIVE_REQUEST && packet != PacketType.PLAY_PLAYER_POSITION_REQUEST && packet != PacketType.PLAY_PLAYER_LOOK_REQUEST) { System.out.println("Direction " + packet.getDirection().name() + " Packet Type: " + packet + " New ID: " + packetID + " Original: " + original + " Size: " + input.readableBytes()); @@ -293,6 +294,12 @@ public class IncomingTransformer { } catch (Exception e) { e.printStackTrace(); } + // Check item + if (inHand != null) { + if (!inHand.getType().isBlock()) { + throw new CancelException(); + } + } short curX = input.readUnsignedByte(); output.writeByte(curX); short curY = input.readUnsignedByte();