mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 19:54:25 -05:00
00c0b2765c
* Updated Year For Copyright Message * fixed terminology * Fix template literals for copyright message * Fix SCBL Info plugin's threshold option * Wrap SCBL API call in try catch * Update license * ESLint & README Generation * Run Action on pull request * admin list parse improvements * prefer for loop for readability * Delete pull.yml * Fix error in auto-tk-warn Co-authored-by: werewolfboy13 <werewolfboy13@afocommunity.com> Co-authored-by: Marek <werewolfpartner@gmail.com> Co-authored-by: Thomas Smyth <thomas.smyth3141@gmail.com> Co-authored-by: SeanWalsh95 <SeanWalsh95@users.noreply.github.com>
42 lines
981 B
JavaScript
42 lines
981 B
JavaScript
import BasePlugin from './base-plugin.js';
|
|
|
|
export default class AutoTKWarn extends BasePlugin {
|
|
static get description() {
|
|
return 'The <code>AutoTkWarn</code> plugin will automatically warn players with a message when they teamkill.';
|
|
}
|
|
|
|
static get defaultEnabled() {
|
|
return true;
|
|
}
|
|
|
|
static get optionsSpecification() {
|
|
return {
|
|
message: {
|
|
required: false,
|
|
description: 'The message to warn players with.',
|
|
default: 'Please apologise for ALL TKs in ALL chat!'
|
|
}
|
|
};
|
|
}
|
|
|
|
constructor(server, options, connectors) {
|
|
super(server, options, connectors);
|
|
|
|
this.onTeamkill = this.onTeamkill.bind(this);
|
|
}
|
|
|
|
async mount() {
|
|
this.server.on('TEAMKILL', this.onTeamkill);
|
|
}
|
|
|
|
async unmount() {
|
|
this.server.removeEventListener('TEAMKILL', this.onTeamkill);
|
|
}
|
|
|
|
async onTeamkill(info) {
|
|
if (!info.attacker) return;
|
|
|
|
await this.server.rcon.warn(info.attacker.steamID, this.options.message);
|
|
}
|
|
}
|