Paper/CraftBukkit-Patches/0045-Spam-Filter-Exclusions.patch
2013-10-24 21:23:24 +11:00

51 lines
2.2 KiB
Diff

From 86d91741f9b8c49805e5473a6ded05dae11c11da Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:59:22 +1000
Subject: [PATCH] Spam Filter Exclusions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a836111..759dc89 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -843,7 +843,17 @@ public class PlayerConnection extends Connection {
}
// This section stays because it is only applicable to packets
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam
+ // Spigot - spam exclusions
+ boolean counted = true;
+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
+ {
+ if ( exclude != null && s.startsWith( exclude ) )
+ {
+ counted = false;
+ break;
+ }
+ }
+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam
if (packet3chat.a_()) {
Waitable waitable = new Waitable() {
@Override
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 92cfac6..86e3680 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -213,4 +213,13 @@ public class SpigotConfig
bungeeAddresses = getList( "settings.bungeecord-addresses", bungeeAddresses );
bungee = getBoolean( "settings.bungeecord", true );
}
+
+ public static List<String> spamExclusions;
+ private static void spamExclusions()
+ {
+ spamExclusions = getList( "commands.spam-exclusions", Arrays.asList( new String[]
+ {
+ "/skill"
+ } ) );
+ }
}
--
1.8.3.2