From d9bd0e3ee6bbe3c8b9a2126bd60c9aca0362cddd Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 25 Oct 2012 16:26:42 +1100 Subject: [PATCH] Don't need to maintain rain or held item state. Closes issues #12 and #3 --- .../java/net/md_5/bungee/UserConnection.java | 11 --------- .../md_5/bungee/packet/Packet10HeldItem.java | 24 ------------------- .../md_5/bungee/packet/Packet46GameState.java | 23 ------------------ 3 files changed, 58 deletions(-) delete mode 100644 src/main/java/net/md_5/bungee/packet/Packet10HeldItem.java delete mode 100644 src/main/java/net/md_5/bungee/packet/Packet46GameState.java diff --git a/src/main/java/net/md_5/bungee/UserConnection.java b/src/main/java/net/md_5/bungee/UserConnection.java index 11364f442..5eb58e6b8 100644 --- a/src/main/java/net/md_5/bungee/UserConnection.java +++ b/src/main/java/net/md_5/bungee/UserConnection.java @@ -9,11 +9,9 @@ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import net.md_5.bungee.command.CommandSender; import net.md_5.bungee.packet.DefinedPacket; -import net.md_5.bungee.packet.Packet10HeldItem; import net.md_5.bungee.packet.Packet1Login; import net.md_5.bungee.packet.Packet2Handshake; import net.md_5.bungee.packet.Packet3Chat; -import net.md_5.bungee.packet.Packet46GameState; import net.md_5.bungee.packet.Packet9Respawn; import net.md_5.bungee.packet.PacketFAPluginMessage; import net.md_5.bungee.packet.PacketInputStream; @@ -27,7 +25,6 @@ public class UserConnection extends GenericConnection implements CommandSender private UpstreamBridge upBridge; private DownstreamBridge downBridge; // reconnect stuff - private Packet10HeldItem heldItem; private int clientEntityId; private int serverEntityId; private volatile boolean reconnecting; @@ -81,11 +78,6 @@ public class UserConnection extends GenericConnection implements CommandSender Packet1Login login = newServer.loginPacket; serverEntityId = login.entityId; out.write(new Packet9Respawn(login.dimension, login.difficulty, login.gameMode, (short) 256, login.levelType).getPacket()); - out.write(new Packet46GameState((byte) 2, (byte) 0).getPacket()); - if (heldItem != null) - { - newServer.out.write(heldItem.getPacket()); - } } reconnecting = false; downBridge = new DownstreamBridge(); @@ -158,9 +150,6 @@ public class UserConnection extends GenericConnection implements CommandSender { sendPacket = !BungeeCord.instance.dispatchCommand(message.substring(1), UserConnection.this); } - } else if (id == 0x10) - { - heldItem = new Packet10HeldItem(packet); } EntityMap.rewrite(packet, clientEntityId, serverEntityId); diff --git a/src/main/java/net/md_5/bungee/packet/Packet10HeldItem.java b/src/main/java/net/md_5/bungee/packet/Packet10HeldItem.java deleted file mode 100644 index 9122ebea0..000000000 --- a/src/main/java/net/md_5/bungee/packet/Packet10HeldItem.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.md_5.bungee.packet; - -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@ToString -@EqualsAndHashCode(callSuper = false) -public class Packet10HeldItem extends DefinedPacket -{ - - public short slot; - - public Packet10HeldItem(short slot) - { - super(0x10); - writeShort(slot); - } - - public Packet10HeldItem(byte[] buf) - { - super(0x10, buf); - this.slot = readShort(); - } -} diff --git a/src/main/java/net/md_5/bungee/packet/Packet46GameState.java b/src/main/java/net/md_5/bungee/packet/Packet46GameState.java deleted file mode 100644 index 1bab1fe83..000000000 --- a/src/main/java/net/md_5/bungee/packet/Packet46GameState.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.md_5.bungee.packet; - -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@ToString -@EqualsAndHashCode(callSuper = false) -public class Packet46GameState extends DefinedPacket -{ - - /** - * Update game state. When sent with a state of 2, rain will cease. - * - * @param state the new game state - * @param mode the new game mode. Used when state == 3. - */ - public Packet46GameState(byte state, byte mode) - { - super(0x46); - writeByte(state); - writeByte(mode); - } -}