From 0095a4f25fed25be4662bd3b045976947dfb1a77 Mon Sep 17 00:00:00 2001 From: James Monger Date: Mon, 17 Jul 2023 11:44:14 +0100 Subject: [PATCH] fix: check global instance correctly global instance now has an ID so we need to check against it rather than checking for `null` fixes #399 --- src/engine/world/instances.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/world/instances.ts b/src/engine/world/instances.ts index 74584afbb..ffc01e509 100644 --- a/src/engine/world/instances.ts +++ b/src/engine/world/instances.ts @@ -526,7 +526,7 @@ export class WorldInstance { public removePlayer(player: Player): void { this.players.delete(player.username); - if(this.instanceId !== null && this.players.size === 0) { + if(this.instanceId !== activeWorld.globalInstance.instanceId && this.players.size === 0) { this.chunkModifications.clear(); const instancedNpcs = activeWorld.findNpcsByInstance(this.instanceId); instancedNpcs?.forEach(npc => activeWorld.deregisterNpc(npc));