Paper/CraftBukkit-Patches/0105-Spam-Filter-Exclusions.patch
2014-02-12 14:06:33 +00:00

61 lines
2.4 KiB
Diff

From 406fe8af81203e6c840334f49d1c3ed1f553d1af Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 8 Feb 2014 08:13:40 +0000
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 9e6901c..f028c02 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -836,9 +836,19 @@ public class PlayerConnection implements PacketPlayInListener {
this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false);
}
+ // Spigot - spam exclusions
+ boolean counted = true;
+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
+ {
+ if ( exclude != null && s.startsWith( exclude ) )
+ {
+ counted = false;
+ break;
+ }
+ }
// CraftBukkit start - replaced with thread safe throttle
// this.chatThrottle += 20;
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) {
+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) {
if (packetplayinchat.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 61fb942..8da3cc9 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -6,6 +6,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -251,4 +252,13 @@ public class SpigotConfig
{
playerShuffle = getInt( "settings.player-shuffle", 0 );
}
+
+ public static List<String> spamExclusions;
+ private static void spamExclusions()
+ {
+ spamExclusions = getList( "commands.spam-exclusions", Arrays.asList( new String[]
+ {
+ "/skill"
+ } ) );
+ }
}
--
1.8.4.msysgit.0