server closing for SP is signalled too late.
This commit is contained in:
1 parent
63901ebb0c
commit
15f7d52b4c
2 files changed
+13
-2
No files matched your search
@@ -114,7 +114,7 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
|||||||
{
|
{
|
||||||
TickSpeed.tick();
|
TickSpeed.tick();
|
||||||
HUDController.update_hud(server, null);
|
HUDController.update_hud(server, null);
|
||||||
scriptServer.tick();
|
if (scriptServer != null) scriptServer.tick();
|
||||||
|
|
||||||
//in case something happens
|
//in case something happens
|
||||||
CarpetSettings.impendingFillSkipUpdates.set(false);
|
CarpetSettings.impendingFillSkipUpdates.set(false);
|
||||||
@@ -168,6 +168,12 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
|||||||
extensions.forEach(e -> e.onPlayerLoggedOut(player));
|
extensions.forEach(e -> e.onPlayerLoggedOut(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clientPreClosing()
|
||||||
|
{
|
||||||
|
if (scriptServer != null) scriptServer.onClose();
|
||||||
|
scriptServer = null;
|
||||||
|
}
|
||||||
|
|
||||||
public static void onServerClosed(MinecraftServer server)
|
public static void onServerClosed(MinecraftServer server)
|
||||||
{
|
{
|
||||||
// this for whatever reason gets called multiple times even when joining on SP
|
// this for whatever reason gets called multiple times even when joining on SP
|
||||||
@@ -175,6 +181,7 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
|||||||
if (minecraft_server != null)
|
if (minecraft_server != null)
|
||||||
{
|
{
|
||||||
if (scriptServer != null) scriptServer.onClose();
|
if (scriptServer != null) scriptServer.onClose();
|
||||||
|
scriptServer = null;
|
||||||
ServerNetworkHandler.close();
|
ServerNetworkHandler.close();
|
||||||
currentCommandDispatcher = null;
|
currentCommandDispatcher = null;
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,17 @@ public class CarpetClient
|
|||||||
|
|
||||||
public static void disconnect()
|
public static void disconnect()
|
||||||
{
|
{
|
||||||
if (isServerCarpet)
|
if (isServerCarpet) // multiplayer connection
|
||||||
{
|
{
|
||||||
isServerCarpet = false;
|
isServerCarpet = false;
|
||||||
clientPlayer = null;
|
clientPlayer = null;
|
||||||
CarpetServer.onServerClosed(null);
|
CarpetServer.onServerClosed(null);
|
||||||
CarpetServer.onServerDoneClosing(null);
|
CarpetServer.onServerDoneClosing(null);
|
||||||
}
|
}
|
||||||
|
else // singleplayer disconnect
|
||||||
|
{
|
||||||
|
CarpetServer.clientPreClosing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCarpet()
|
public static void setCarpet()
|
||||||
|
|||||||
Reference in new issue
Block a user