From 61a20ef97258f9926765b9a745f2c36dd9633148 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:06:03 -0400 Subject: [PATCH 1/8] allow for victim to be notified on TK --- squad-server/plugins/auto-tk-warn.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index a0d7a76..fc9161d 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -11,10 +11,20 @@ export default class AutoTKWarn extends BasePlugin { static get optionsSpecification() { return { - message: { + attacker_message: { required: false, - description: 'The message to warn players with.', + description: 'The message to warn attacking players with.', default: 'Please apologise for ALL TKs in ALL chat!' + }, + warn_victim: { + required: false, + description: 'Should we nottify the the victim, telling them that they were teamkilled via a warning message', + default: false + }, + victim_message: { + required: false, + description: 'The message that will be sent to the victim', + default: 'You were killed by your own team.' } }; } @@ -34,8 +44,14 @@ export default class AutoTKWarn extends BasePlugin { } async onTeamkill(info) { - if (!info.attacker) return; + if (info.attacker) { + this.server.rcon.warn(info.attacker.steamID, this.options.attacker_message); + }; + + if (this.options.warn_victe && info.victim) { + this.server.rcon.warn(info.victim.steamID, this.options.victim_message); + }; - await this.server.rcon.warn(info.attacker.steamID, this.options.message); + } } From a2e677c13cb1026717794357bf77a3770a420150 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:07:43 -0400 Subject: [PATCH 2/8] formatting --- squad-server/plugins/auto-tk-warn.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index fc9161d..3bdd9ad 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -46,12 +46,9 @@ export default class AutoTKWarn extends BasePlugin { async onTeamkill(info) { if (info.attacker) { this.server.rcon.warn(info.attacker.steamID, this.options.attacker_message); - }; - + } if (this.options.warn_victe && info.victim) { this.server.rcon.warn(info.victim.steamID, this.options.victim_message); - }; - - + } } } From 83de2491ac2d7e862b70edd6674e7f8a08b6f541 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:11:38 -0400 Subject: [PATCH 3/8] spelling fix --- squad-server/plugins/auto-tk-warn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index 3bdd9ad..17d6115 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -47,7 +47,7 @@ export default class AutoTKWarn extends BasePlugin { if (info.attacker) { this.server.rcon.warn(info.attacker.steamID, this.options.attacker_message); } - if (this.options.warn_victe && info.victim) { + if (this.options.warn_victim && info.victim) { this.server.rcon.warn(info.victim.steamID, this.options.victim_message); } } From 2a2a09caa92cfbe1b15ea2b6fa5cccdfe7d21fa8 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:28:47 -0400 Subject: [PATCH 4/8] prefer camelCase with JS --- squad-server/plugins/auto-tk-warn.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index 17d6115..44c7744 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -11,17 +11,17 @@ export default class AutoTKWarn extends BasePlugin { static get optionsSpecification() { return { - attacker_message: { + attackerMessage: { required: false, description: 'The message to warn attacking players with.', default: 'Please apologise for ALL TKs in ALL chat!' }, - warn_victim: { + warnVictim: { required: false, description: 'Should we nottify the the victim, telling them that they were teamkilled via a warning message', default: false }, - victim_message: { + victimMessage: { required: false, description: 'The message that will be sent to the victim', default: 'You were killed by your own team.' @@ -45,10 +45,10 @@ export default class AutoTKWarn extends BasePlugin { async onTeamkill(info) { if (info.attacker) { - this.server.rcon.warn(info.attacker.steamID, this.options.attacker_message); + this.server.rcon.warn(info.attacker.steamID, this.options.attackerMessage); } - if (this.options.warn_victim && info.victim) { - this.server.rcon.warn(info.victim.steamID, this.options.victim_message); + if (this.options.warnVictim && info.victim) { + this.server.rcon.warn(info.victim.steamID, this.options.victimMessage); } } } From d5ee2381579596af57877c12e93082780fd880d1 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:33:55 -0400 Subject: [PATCH 5/8] remove unneeded flag --- squad-server/plugins/auto-tk-warn.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index 44c7744..470041e 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -16,11 +16,6 @@ export default class AutoTKWarn extends BasePlugin { description: 'The message to warn attacking players with.', default: 'Please apologise for ALL TKs in ALL chat!' }, - warnVictim: { - required: false, - description: 'Should we nottify the the victim, telling them that they were teamkilled via a warning message', - default: false - }, victimMessage: { required: false, description: 'The message that will be sent to the victim', @@ -44,11 +39,11 @@ export default class AutoTKWarn extends BasePlugin { } async onTeamkill(info) { - if (info.attacker) { - this.server.rcon.warn(info.attacker.steamID, this.options.attackerMessage); + if (info.attacker && this.options.attackerMessage) { + await this.server.rcon.warn(info.attacker.steamID, this.options.attackerMessage); } - if (this.options.warnVictim && info.victim) { - this.server.rcon.warn(info.victim.steamID, this.options.victimMessage); + if (info.victim && this.options.victimMessage) { + await this.server.rcon.warn(info.victim.steamID, this.options.victimMessage); } } } From 333e5fc7eebb8626d77b4fc78db0b64e84aa660c Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:40:54 -0400 Subject: [PATCH 6/8] rm unneeded blocking --- squad-server/plugins/auto-tk-warn.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index 470041e..af7798e 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -40,10 +40,10 @@ export default class AutoTKWarn extends BasePlugin { async onTeamkill(info) { if (info.attacker && this.options.attackerMessage) { - await this.server.rcon.warn(info.attacker.steamID, this.options.attackerMessage); + this.server.rcon.warn(info.attacker.steamID, this.options.attackerMessage); } if (info.victim && this.options.victimMessage) { - await this.server.rcon.warn(info.victim.steamID, this.options.victimMessage); + this.server.rcon.warn(info.victim.steamID, this.options.victimMessage); } } } From 7cd7133bc6dd317687041f15a24931caff2ab38e Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 15:42:57 -0400 Subject: [PATCH 7/8] grammar --- squad-server/plugins/auto-tk-warn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index af7798e..6e42d3f 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -18,7 +18,7 @@ export default class AutoTKWarn extends BasePlugin { }, victimMessage: { required: false, - description: 'The message that will be sent to the victim', + description: 'The message that will be sent to the victim.', default: 'You were killed by your own team.' } }; From 6b48502c44fe9eacc9411b1458a841b37215ae90 Mon Sep 17 00:00:00 2001 From: SeanWalsh95 Date: Tue, 12 Jul 2022 18:11:28 -0400 Subject: [PATCH 8/8] dafault victim message to disabled --- squad-server/plugins/auto-tk-warn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squad-server/plugins/auto-tk-warn.js b/squad-server/plugins/auto-tk-warn.js index 6e42d3f..fadf759 100644 --- a/squad-server/plugins/auto-tk-warn.js +++ b/squad-server/plugins/auto-tk-warn.js @@ -19,7 +19,7 @@ export default class AutoTKWarn extends BasePlugin { victimMessage: { required: false, description: 'The message that will be sent to the victim.', - default: 'You were killed by your own team.' + default: null // 'You were killed by your own team.' } }; }