Use startsWith for spam exclusions

This commit is contained in:
md_5 2013-07-01 14:35:48 +10:00
parent fff3a4f3f9
commit 64a3e2baa5
3 changed files with 21 additions and 12 deletions

View file

@ -1,25 +1,34 @@
From 8a38b66a6ab4ae5fb449f416bbb221cafd591326 Mon Sep 17 00:00:00 2001 From 4382a5a97fe257d05dc11282c844f300811d27ac Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:59:22 +1000 Date: Fri, 21 Jun 2013 17:59:22 +1000
Subject: [PATCH] Spam Filter Exclusions 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 diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 998ac8d..a292c1a 100644 index 998ac8d..03e0e1c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -846,7 +846,8 @@ public class PlayerConnection extends Connection { @@ -846,7 +846,17 @@ public class PlayerConnection extends Connection {
this.chat(s, packet3chat.a_()); this.chat(s, packet3chat.a_());
// This section stays because it is only applicable to packets // This section stays because it is only applicable to packets
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam - if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
+ // Spigot - spam exclusions + // Spigot - spam exclusions
+ if (!org.spigotmc.SpigotConfig.spamExclusions.contains(s) && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam + boolean counted = true;
+ for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
+ {
+ if ( s.startsWith( exclude ) )
+ {
+ counted = false;
+ break;
+ }
+ }
+ if (counted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
if (packet3chat.a_()) { if (packet3chat.a_()) {
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index b341ee8..24b4aa0 100644 index d813492..4cac938 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -204,4 +204,13 @@ public class SpigotConfig @@ -204,4 +204,13 @@ public class SpigotConfig

View file

@ -1,14 +1,14 @@
From f78427a84375f14b3204f9891f62783c8c2840bb Mon Sep 17 00:00:00 2001 From 25f2b26cd9798f8e2b0dbd77f323e30e263730ba Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 18:01:29 +1000 Date: Fri, 21 Jun 2013 18:01:29 +1000
Subject: [PATCH] Allow Disabling of Command Logging Subject: [PATCH] Allow Disabling of Command Logging
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a292c1a..0e8d292 100644 index 03e0e1c..be44514 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -970,7 +970,12 @@ public class PlayerConnection extends Connection { @@ -979,7 +979,12 @@ public class PlayerConnection extends Connection {
} }
try { try {
@ -23,7 +23,7 @@ index a292c1a..0e8d292 100644
org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
return; return;
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 1685d9f..9214f16 100644 index 4cac938..d4a8777 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -213,4 +213,10 @@ public class SpigotConfig @@ -213,4 +213,10 @@ public class SpigotConfig

View file

@ -1,14 +1,14 @@
From fc86566c7e87d5294d6199d7bd46e0333b21e9dc Mon Sep 17 00:00:00 2001 From 91608f72be55d36c57c22e85b4740c23f129a735 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Fri, 28 Jun 2013 19:52:54 +1000 Date: Fri, 28 Jun 2013 19:52:54 +1000
Subject: [PATCH] Disallow Interaction With Self Subject: [PATCH] Disallow Interaction With Self
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0e8d292..96076ae 100644 index be44514..f5544a3 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1082,6 +1082,13 @@ public class PlayerConnection extends Connection { @@ -1091,6 +1091,13 @@ public class PlayerConnection extends Connection {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = worldserver.getEntity(packet7useentity.target); Entity entity = worldserver.getEntity(packet7useentity.target);