From c9d55463864a9a739842a57521090a02cb4f519c Mon Sep 17 00:00:00 2001 From: Etzelia Date: Wed, 5 Dec 2018 19:16:36 +0100 Subject: [PATCH] Banned IP Match Only ping once with the name of all associated banned players. --- api/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index 26094ba..59c1657 100644 --- a/api/views.py +++ b/api/views.py @@ -268,10 +268,13 @@ class PluginAPI(View): player.last_seen = timezone.now().strftime("%Y-%m-%d") player.save() if new_player and ip.associated: + associated = [] for assoc in ip.associated: if assoc.uuid is not player.uuid and assoc.is_banned: - mcm_api.plugin("staff", "Server {0}'s IP matches the banned player {1}".format(player.username, assoc.username)) - mcm_api.discord_notification("{0}'s IP matches the banned player {1}".format(player.username, assoc.username), ping=True) + associated.append(assoc) + if associated: + mcm_api.plugin("staff", "Server {0}'s IP matches the banned player(s) {1}".format(player.username, ", ".join([assoc.username for assoc in associated]))) + mcm_api.discord_notification("{0}'s IP matches the banned player(s) {1}".format(player.username, ", ".join([assoc.username for assoc in associated])), ping=True) json['status'] = True json['message'] = "Updated {0}".format(post['username']) elif "register" == keyword: