papermc/CraftBukkit-Patches/0045-Spam-Filter-Exclusions.patch

51 lines
2.2 KiB
Diff
Raw Normal View History

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