Paper/CraftBukkit-Patches/0047-Spam-Filter-Exclusions.patch

51 lines
2.2 KiB
Diff
Raw Normal View History

From e630d3e3ed63f506baaffcd434033ed6c58b536f Mon Sep 17 00:00:00 2001
2013-06-21 09:59:37 +02:00
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
2013-07-02 05:03:56 +02:00
index 1422d67..fc174b2 100644
2013-06-21 09:59:37 +02:00
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2013-07-02 05:03:56 +02:00
@@ -858,7 +858,17 @@ public class PlayerConnection extends Connection {
2013-06-21 09:59:37 +02:00
this.chat(s, packet3chat.a_());
// This section stays because it is only applicable to packets
2013-07-02 05:03:56 +02:00
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam
2013-06-21 09:59:37 +02:00
+ // Spigot - spam exclusions
2013-07-01 06:35:48 +02:00
+ boolean counted = true;
+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
+ {
+ if ( s.startsWith( exclude ) )
+ {
+ counted = false;
+ break;
+ }
+ }
2013-07-02 05:03:56 +02:00
+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam
2013-06-21 09:59:37 +02:00
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 31ba25f..1eacf1e 100644
2013-06-21 09:59:37 +02:00
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -218,4 +218,13 @@ public class SpigotConfig
2013-06-22 07:48:42 +02:00
bungeeAddresses = getList( "settings.bungeecord-addresses", bungeeAddresses );
2013-06-21 09:59:37 +02:00
bungee = getBoolean( "settings.bungeecord", true );
}
+
+ public static List<String> spamExclusions;
2013-06-21 10:57:20 +02:00
+ private static void spamExclusions()
2013-06-21 09:59:37 +02:00
+ {
+ spamExclusions = getList( "commands.spam-exclusions", Arrays.asList( new String[]
+ {
+ "/skill"
+ } ) );
+ }
}
--
1.8.1.2