From 549ee548527db96deed0a49f3a1be9a7cb2ce630 Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Tue, 3 Sep 2013 21:41:54 -0400 Subject: [PATCH] Fixed More Bugs Fixed the issue with integrated servers causing circular updates between the combined server and client. We now check on the client side whether the connection we're receiving data from is a memory connection (which is presumably only used by integrated servers). If so, the client ignores any incoming packets. We don't just disable update events altogether because LAN games will require updating remote clients. Also fixed a bug in PocketManager.unload() - we weren't setting isLoaded to false after unloading everything and unregisterPockets() had to be called before setting dimensionData to null. --- .../mod_pocketDim/core/PocketManager.java | 15 +++++++-------- .../mod_pocketDimClient/ClientPacketHandler.java | 5 +++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/StevenDimDoors/mod_pocketDim/core/PocketManager.java index b79ee2bb..a03a7b9f 100644 --- a/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -391,17 +391,16 @@ public class PocketManager public static void unload() { + if (!isLoaded) + { + throw new IllegalStateException("Pocket dimensions have already been unloaded!"); + } + save(); - dimensionData = null; unregisterPockets(); + dimensionData = null; + isLoaded = false; } - - /* - * This isn't needed right now and it's causing me problems due to the iterator's generic type -_- - public static Iterable getDimensions() - { - return dimensionData.values(); - }*/ public static DimLink getLink(int x, int y, int z, World world) { diff --git a/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java b/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java index a98f115e..a969a92e 100644 --- a/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java +++ b/StevenDimDoors/mod_pocketDimClient/ClientPacketHandler.java @@ -38,6 +38,11 @@ public class ClientPacketHandler implements IPacketHandler, IUpdateSource if (!packet.channel.equals(PacketConstants.CHANNEL_NAME)) return; + // If this is a memory connection, then our client is running an integrated server. + // We can tell by checking if packet size is 0. + if (manager.packetSize() == 0) + return; + try { DataInputStream input = new DataInputStream(new ByteArrayInputStream(packet.data));