mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Pause server ups when no players online (#405)
This commit is contained in:
@@ -24,6 +24,14 @@ export class InstancePlugin extends BaseInstancePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onPlayerEvent(event: lib.PlayerEvent): Promise<void> {
|
||||||
|
if (event.type === "join" && !this.updateInterval) {
|
||||||
|
await this.onStart();
|
||||||
|
} else if (event.type === "leave" && this.instance.playersOnline.size == 0 && this.instance.config.get("factorio.settings")["auto_pause"] as boolean) {
|
||||||
|
this.onExit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async updateUps() {
|
async updateUps() {
|
||||||
let ups = 0;
|
let ups = 0;
|
||||||
const collected = this.gameTimes.length - 1;
|
const collected = this.gameTimes.length - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user