Move closing of client world to a proper place

This commit is contained in:
s809
2023-10-28 19:43:10 +05:00
parent 62bf59f098
commit 5e2accadca
@@ -134,27 +134,24 @@ public class ClientApi
public void onClientOnlyDisconnected()
{
if (MC.clientConnectedToDedicatedServer())
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
if (world != null)
{
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
if (world != null)
{
LOGGER.info("Client on ClientOnly mode disconnecting.");
world.close();
SharedApi.setDhWorld(null);
}
LOGGER.info("Client on ClientOnly mode disconnecting.");
// clear the previous server's information
this.isServerCommunicationEnabled = false;
this.serverNetworkingIsMalformed = false;
KEYED_CLIENT_LEVEL_MANAGER.setUseOverrideWrapper(false);
KEYED_CLIENT_LEVEL_MANAGER.setServerKeyedLevel(null);
// remove any waiting items
this.waitingChunkByClientLevelAndPos.clear();
this.waitingClientLevels.clear();
world.close();
SharedApi.setDhWorld(null);
}
// clear the previous server's information
this.isServerCommunicationEnabled = false;
this.serverNetworkingIsMalformed = false;
KEYED_CLIENT_LEVEL_MANAGER.setUseOverrideWrapper(false);
KEYED_CLIENT_LEVEL_MANAGER.setServerKeyedLevel(null);
// remove any waiting items
this.waitingChunkByClientLevelAndPos.clear();
this.waitingClientLevels.clear();
}