Fixed a bug where an instance would be deleted if a server restarted while no players were online

This commit is contained in:
ForestOfLight
2025-06-06 03:19:18 -07:00
Unverified
parent efe0d61ec3
commit f585f96ecf
2 changed files with 2 additions and 1 deletions
@@ -250,6 +250,7 @@ export class StructureInstance {
world.beforeEvents.playerLeave.subscribe(event => {
system.run(() => {
if (world.getAllPlayers().length === 0) {
console.info(`[Construct] No players are online. Disabling instance: '${this.options.instanceName}'`);
this.disable();
this.shouldEnableOnJoin = true;
}
@@ -257,6 +258,7 @@ export class StructureInstance {
});
world.afterEvents.playerJoin.subscribe(event => {
if (this.shouldEnableOnJoin) {
console.info(`[Construct] A player rejoined. Re-enabling instance: '${this.options.instanceName}'`);
this.enable();
this.shouldEnableOnJoin = false;
}
@@ -13,7 +13,6 @@ export class VerificationRenderer {
constructor(instance) {
this.instance = instance;
const bounds = this.instance.getActiveBounds();
this.lastRenderedChunk = 0;
}