mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
77 lines
3 KiB
Diff
77 lines
3 KiB
Diff
From d78786023321fc7bb3ca1bb19cddccb83124a651 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 2d18a998c..907866c7a 100644
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
@@ -1814,7 +1814,7 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerP
|
|
} finally {
|
|
this.server.server.playerCommandState = false;
|
|
}
|
|
- this.detectRateSpam(true);
|
|
+ this.detectRateSpam(true, "/" + serverboundchatcommandpacket.command()); // Spigot
|
|
// CraftBukkit end
|
|
}
|
|
|
|
@@ -1913,7 +1913,7 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerP
|
|
this.chat(s, true);
|
|
}
|
|
// this.server.getPlayerList().broadcastChatMessage(playerchatmessage, filteredtext, this.player, ChatMessageType.CHAT);
|
|
- this.detectRateSpam(false);
|
|
+ this.detectRateSpam(false, s); // Spigot
|
|
// CraftBukkit end
|
|
}
|
|
}
|
|
@@ -2021,7 +2021,18 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerP
|
|
// CraftBukkit end
|
|
|
|
// CraftBukkit start - replaced with thread safe throttle
|
|
- private void detectRateSpam(boolean isSync) {
|
|
+ // Spigot start - spam exclusions
|
|
+ private void detectRateSpam(boolean isSync, String s) {
|
|
+ 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())) {
|
|
if (!isSync) {
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
|
index 245a9e5e9..5f0b27ad2 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.25.1
|
|
|