mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-04-13 09:32:09 +00:00
73 lines
2.8 KiB
Diff
73 lines
2.8 KiB
Diff
From aeefd2322859ee029829741bbde882b45ed8c9ce 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/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
index f4df3a902e..af3ee9d5ae 100644
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
@@ -1766,7 +1766,7 @@ public class PlayerConnection extends ServerCommonPacketListenerImpl implements
|
|
// CraftBukkit end
|
|
|
|
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
|
|
- this.detectRateSpam();
|
|
+ this.detectRateSpam("/" + serverboundchatcommandpacket.command()); // Spigot
|
|
});
|
|
}
|
|
|
|
@@ -2033,11 +2033,22 @@ public class PlayerConnection extends ServerCommonPacketListenerImpl implements
|
|
}
|
|
// this.server.getPlayerList().broadcastChatMessage(playerchatmessage, this.player, ChatMessageType.bind(ChatMessageType.CHAT, (Entity) this.player));
|
|
// CraftBukkit end
|
|
- this.detectRateSpam();
|
|
+ this.detectRateSpam(s); // Spigot
|
|
}
|
|
|
|
- private void detectRateSpam() {
|
|
+ // Spigot start - spam exclusions
|
|
+ private void detectRateSpam(String s) {
|
|
// CraftBukkit start - replaced with thread safe throttle
|
|
+ boolean counted = true;
|
|
+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
|
|
+ {
|
|
+ if ( exclude != null && s.startsWith( exclude ) )
|
|
+ {
|
|
+ counted = false;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
// this.chatSpamTickCount += 20;
|
|
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index cf7c624bc5..4f9b55c713 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;
|
|
@@ -284,4 +285,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"
|
|
+ } ) );
|
|
+ }
|
|
}
|
|
--
|
|
2.42.0
|
|
|