Fixed a bug where an instance would be deleted if a server restarted while no players were online
This commit is contained in:
@@ -250,6 +250,7 @@ export class StructureInstance {
|
|||||||
world.beforeEvents.playerLeave.subscribe(event => {
|
world.beforeEvents.playerLeave.subscribe(event => {
|
||||||
system.run(() => {
|
system.run(() => {
|
||||||
if (world.getAllPlayers().length === 0) {
|
if (world.getAllPlayers().length === 0) {
|
||||||
|
console.info(`[Construct] No players are online. Disabling instance: '${this.options.instanceName}'`);
|
||||||
this.disable();
|
this.disable();
|
||||||
this.shouldEnableOnJoin = true;
|
this.shouldEnableOnJoin = true;
|
||||||
}
|
}
|
||||||
@@ -257,6 +258,7 @@ export class StructureInstance {
|
|||||||
});
|
});
|
||||||
world.afterEvents.playerJoin.subscribe(event => {
|
world.afterEvents.playerJoin.subscribe(event => {
|
||||||
if (this.shouldEnableOnJoin) {
|
if (this.shouldEnableOnJoin) {
|
||||||
|
console.info(`[Construct] A player rejoined. Re-enabling instance: '${this.options.instanceName}'`);
|
||||||
this.enable();
|
this.enable();
|
||||||
this.shouldEnableOnJoin = false;
|
this.shouldEnableOnJoin = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export class VerificationRenderer {
|
|||||||
|
|
||||||
constructor(instance) {
|
constructor(instance) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
const bounds = this.instance.getActiveBounds();
|
|
||||||
this.lastRenderedChunk = 0;
|
this.lastRenderedChunk = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user