spigot/CraftBukkit-Patches/0046-Spam-Filter-Exclusions.patch

62 lines
2.4 KiB
Diff
Raw Normal View History

2021-07-07 00:00:00 +10:00
From 1d5403dae4610b12be40180377f84d7eb0ec5554 Mon Sep 17 00:00:00 2001
2014-04-12 14:18:37 +10:00
From: md_5 <md_5@live.com.au>
Date: Sat, 8 Feb 2014 08:13:40 +0000
Subject: [PATCH] Spam Filter Exclusions
2021-03-16 09:00:00 +11:00
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
2021-07-07 00:00:00 +10:00
index acee766ee..66b38c00a 100644
2021-03-16 09:00:00 +11:00
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
2021-07-07 00:00:00 +10:00
@@ -1775,9 +1775,20 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerP
2021-06-11 15:00:00 +10:00
}, ChatMessageType.CHAT, this.player.getUniqueID());
2014-04-12 14:18:37 +10:00
}
+ // Spigot start - spam exclusions
2014-04-12 14:18:37 +10:00
+ boolean counted = true;
+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
+ {
+ if ( exclude != null && s.startsWith( exclude ) )
+ {
+ counted = false;
+ break;
+ }
+ }
+ // Spigot end
2014-04-12 14:18:37 +10:00
// CraftBukkit start - replaced with thread safe throttle
// this.chatThrottle += 20;
2021-06-11 15:00:00 +10:00
- if (chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getProfile())) {
+ if (counted && chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getProfile())) { // Spigot
if (!isSync) {
2014-04-12 14:18:37 +10:00
Waitable waitable = new Waitable() {
@Override
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
2021-03-16 09:00:00 +11:00
index 9acc8feb7..e17e857e9 100644
2014-04-12 14:18:37 +10:00
--- 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;
2019-07-30 20:52:01 +10:00
@@ -284,4 +285,13 @@ public class SpigotConfig
2014-04-12 14:18:37 +10:00
{
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"
+ } ) );
+ }
}
--
2.25.1
2014-04-12 14:18:37 +10:00