From b100721cf8f27d27177313aaa9b2cc89bfd52064 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 21 Apr 2020 10:44:03 +0200 Subject: [PATCH] Prevent users from sending links Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 6 ++++++ .../steamwar/bungeecore/listeners/ConnectionListener.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 036ff5a..7efe9e7 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -94,6 +94,12 @@ public class ChatListener extends BasicListener { return; } + if(!sender.hasPermission(ConnectionListener.TEAM_GROUP) && (e.getMessage().contains("http") || e.getMessage().contains("www"))){ + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDu darfst keine Links versenden."); + e.setCancelled(true); + return; + } + Subserver subserver = Subserver.getSubserver(sender); if(subserver != null && subserver.getType() == Servertype.ARENA) return; diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index b3c7353..7da2da2 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -25,7 +25,7 @@ import java.util.Iterator; public class ConnectionListener extends BasicListener { private static final String ADMIN_GROUP = "admin"; - private static final String TEAM_GROUP = "team"; + public static final String TEAM_GROUP = "team"; private static final String YOUTUBER_MODS = "bungeecore.youtubermods"; @EventHandler -- 2.39.5