mirror of
https://github.com/barkeser2002/Tenet.git
synced 2026-09-25 01:39:58 +03:00
74 lines
2.9 KiB
Diff
74 lines
2.9 KiB
Diff
From 525919ed53ef5469747cd2bc99bbfca63eabe7b8 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 6e203c9535..f064a44ea3 100644
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
@@ -1901,7 +1901,7 @@ public class PlayerConnection implements ServerPlayerConnection, TickablePacketL
|
|
// CraftBukkit end
|
|
|
|
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
|
|
- this.detectRateSpam();
|
|
+ this.detectRateSpam("/" + serverboundchatcommandpacket.command()); // Spigot
|
|
});
|
|
}
|
|
|
|
@@ -2168,11 +2168,22 @@ public class PlayerConnection implements ServerPlayerConnection, TickablePacketL
|
|
}
|
|
// 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.41.0
|
|
|