mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 05:30:23 -07:00
Add config option for command spam whitelist
This commit is contained in:
parent
894631f0d0
commit
2aad131e74
@ -27496,7 +27496,7 @@ index d1f235ebd835f58cf0c703c3a64d29825d98e183..080091efc19bc768bb9a660f366c42e8
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index f054ea710108e5017bc48fdda5f180a04f5b55e2..f44600604a7bf68c990cd74a1ac2d7900ff6e88e 100644
|
||||
index 0bb610f12e3ddda649ecb5ad62ffdc7bfd243223..19428343b37c9b739b3d28984d52e257f85f253f 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -178,7 +178,7 @@ import net.minecraft.world.scores.Team;
|
||||
@ -27508,7 +27508,7 @@ index f054ea710108e5017bc48fdda5f180a04f5b55e2..f44600604a7bf68c990cd74a1ac2d790
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
|
||||
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
|
||||
@@ -388,6 +388,36 @@ public class ServerPlayer extends Player {
|
||||
@@ -395,6 +395,36 @@ public class ServerPlayer extends Player {
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
|
||||
|
@ -78,10 +78,10 @@ index 87d4291a3944f706a694536da6de0f28c548ab8d..5576bf1d1d70ab7a010653d3207909b5
|
||||
profiler.popPush("spawnAndTick");
|
||||
boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 1fe212e8584c177b49e83f29b1a869b534914348..cd6b5176f34248f844f0e591875701bd08f455ce 100644
|
||||
index 02fb30a3adf92de0795aee213caf94a228b01ca0..67f6e40216e0be063a3cfb61427f095f7c74d785 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -368,6 +368,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -375,6 +375,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
public boolean queueHealthUpdatePacket;
|
||||
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
||||
// Paper end - cancellable death event
|
||||
|
@ -60,10 +60,10 @@ index 5576bf1d1d70ab7a010653d3207909b5de867e70..6540b2d6a1062d883811ce240c49d30d
|
||||
spawnState = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true);
|
||||
} else {
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index cd6b5176f34248f844f0e591875701bd08f455ce..f347ff8d863f4bcef46604c757de112cb3fe445c 100644
|
||||
index 67f6e40216e0be063a3cfb61427f095f7c74d785..3de65c4025be91d938a350c884975cb6edc234d3 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -372,6 +372,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -379,6 +379,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length;
|
||||
public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS];
|
||||
// Paper end - Optional per player mob spawns
|
||||
|
@ -1561,7 +1561,7 @@
|
||||
}
|
||||
|
||||
return optional;
|
||||
@@ -1451,22 +_,155 @@
|
||||
@@ -1451,22 +_,157 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1707,11 +1707,13 @@
|
||||
+ // Spigot start - spam exclusions
|
||||
+ private void detectRateSpam(String message) {
|
||||
+ // CraftBukkit start - replaced with thread safe throttle
|
||||
+ if (org.spigotmc.SpigotConfig.enableSpamExclusions) {
|
||||
+ for (String exclude : org.spigotmc.SpigotConfig.spamExclusions) {
|
||||
+ if (exclude != null && message.startsWith(exclude)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+ // this.chatSpamThrottler.increment();
|
||||
+ if (!this.chatSpamThrottler.isIncrementAndUnderThreshold()
|
||||
|
@ -242,9 +242,23 @@ public class SpigotConfig {
|
||||
SpigotConfig.playerShuffle = SpigotConfig.getInt("settings.player-shuffle", 0);
|
||||
}
|
||||
|
||||
public static boolean enableSpamExclusions = false;
|
||||
public static List<String> spamExclusions;
|
||||
private static void spamExclusions() {
|
||||
SpigotConfig.spamExclusions = SpigotConfig.getList("commands.spam-exclusions", List.of("/skill"));
|
||||
Object enabled = SpigotConfig.config.get("commands.enable-spam-exclusions");
|
||||
if (enabled instanceof Boolean value) {
|
||||
SpigotConfig.enableSpamExclusions = value;
|
||||
} else {
|
||||
if (spamExclusions.size() == 1 && spamExclusions.getFirst().equals("/skill")) {
|
||||
SpigotConfig.enableSpamExclusions = false;
|
||||
SpigotConfig.set("commands.enable-spam-exclusions", false);
|
||||
} else {
|
||||
SpigotConfig.enableSpamExclusions = true;
|
||||
SpigotConfig.set("commands.enable-spam-exclusions", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean silentCommandBlocks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user