Update db-log.js

This commit is contained in:
Skillet 2023-03-01 12:16:11 -05:00 committed by GitHub
parent a4eab2e898
commit 763f2536f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -420,10 +420,8 @@ export default class DBLog extends BasePlugin {
id: this.options.overrideServerID || this.server.id,
name: this.server.serverName
});
this.match = await this.models.Match.findOne({
where: { server: this.options.overrideServerID || this.server.id, endTime: null }
});
this.repairDB();
this.server.on('TICK_RATE', this.onTickRate);
this.server.on('UPDATED_A2S_INFORMATION', this.onUpdatedA2SInformation);
@ -433,6 +431,12 @@ export default class DBLog extends BasePlugin {
this.server.on('PLAYER_DIED', this.onPlayerDied);
this.server.on('PLAYER_REVIVED', this.onPlayerRevived);
}
async repairDB() {
this.match = await this.models.Match.findOne({
where: { server: this.options.overrideServerID || this.server.id, endTime: null }
});
}
async unmount() {
this.server.removeEventListener('TICK_RATE', this.onTickRate);