import Module from '../utils/Module' export default class Spawn extends Module<{ spawn: boolean }> { private _checkList: string[] = [] public addCheck(name: string) { this._checkList.push(name) } public validateCheck(name: string) { const idx = this._checkList.indexOf(name) if (idx > -1) { this._checkList.splice(this._checkList.indexOf(name), 1) this.logger.trace({ msg: 'Spawn ready', value: name, remain: this._checkList.length }) if (this._checkList.length === 0 && this.conf.spawn) { this.respawn() } } } public respawn() { this.logger.info('Respawn') this.client.write('client_command', { action: 1 }) } protected mount() { // passive } protected getConf() { return { spawn: true } } }