Files
ParchmentMC/patches/server/0020-Add-spam-bypass-permission.patch
Lexi Larkin cc60bfd0f8 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@0bf8790 Fix client lag spikes due to client light recalc
PaperMC/Paper@aabf676 Prevent unloading worlds with pending player logins
PaperMC/Paper@eff22eb Ensure players are removed from pendingLogin
PaperMC/Paper@046466f Re-arrange most chunk system patches to front (#8338)
PaperMC/Paper@e8c2c3b Fix World#refreshChunk not working for chunks in no-tick range
PaperMC/Paper@09904fd Re-add legacy getChunkAtAsynchronously to ChunkProviderServer
PaperMC/Paper@36a5f15 Allow preventing BlockDestroyEvent from dropping items (#8349)
PaperMC/Paper@e51401e Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8347)
PaperMC/Paper@51183af Fix console completer/highlighter having invalid source stack (#8346)
PaperMC/Paper@ef0e5a6 Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@178f035 Restore no-crash behaviour when read-only config file(s) (#8318)
PaperMC/Paper@267dd18 Stop large look changes from crashing the server (#8326)
PaperMC/Paper@36f0c1b Rebuild patches
PaperMC/Paper@751d092 Properly close section storage managed files (#8364)
PaperMC/Paper@f5f84ff Add custom destroyerIdentity parameter to the sendBlockBreak function (#5840)
PaperMC/Paper@05f6a5c Limit size of Authenticator Cache Thread Pool (#8360)
PaperMC/Paper@ef670eb EndDragonFight killed statuses should be false for newly created worlds (#8354)
PaperMC/Paper@b826065 fire EntityChangeBlockEvent in more places (#6371)
PaperMC/Paper@34777cd Missing eating regain reason (#8244)
PaperMC/Paper@dbda887 Missing some effect cause (#8307)
PaperMC/Paper@63cb747 Added byte array serialization/deserialization for PersistentDataContainers (#7505)
PaperMC/Paper@ea777c3 Add a consumer parameter to ProjectileSource#launchProjectile (#8374)
PaperMC/Paper@470c638 Configurable chat thread limit (#7878)
PaperMC/Paper@dbc2d60 Make WorldCreator#keepSpawnLoaded return the WorldCreator (Fixes #8321) (#8371)
PaperMC/Paper@f8742e2 Also load resources from LibraryLoader (#8335)
PaperMC/Paper@f7e6809 Fix Pathfinding After World Has Changed (#8068)
PaperMC/Paper@ad3dffe Respect preventMovingIntoUnloadedChunks for optimized collision checking (#8259)
PaperMC/Paper@8db45c4 Copper clear on lightning strike calls EntityChangeBlockEvent (#8126)
PaperMC/Paper@9e614e6 Fix ground pathfinding (#7683)
PaperMC/Paper@339e85d Updated Upstream (CraftBukkit) (#8376)
PaperMC/Paper@980c1d1 Updated Upstream (Bukkit/CraftBukkit) (#8378)
PaperMC/Paper@8681503 Call EntityChangeBlockEvent for frogs egg (#8136)
PaperMC/Paper@ec0c550 Call BlockPhysicsEvent more often (#8264)
PaperMC/Paper@f528f53 Correct javadocs on PlayerArmorStandManipulateEvent (#7719)
PaperMC/Paper@3996e6e Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@d332623 Avoid potential place where the world map could be modified after its iterator is created (#8315)
PaperMC/Paper@6736f39 Fix mangled patch
PaperMC/Paper@4d52f1d Add method isTickingWorlds to Bukkit (#8316)
PaperMC/Paper@62680d5 Avoid item meta usage for itemstack enchantment getter (#8373)
PaperMC/Paper@b4c025b Fix player desync on dimension change (#8253)
PaperMC/Paper@6d63005 Fix setEggCount method from TurtleLayEggEvent (#8385)
PaperMC/Paper@abe53a7 Fix typos in isTickingWorlds API javadocs (#8382)
PaperMC/Paper@01a1387 Rewrite chunk system (#8177)
PaperMC/Paper@b58c0cf Update snekyaml
2022-09-26 19:36:07 -04:00

53 lines
3.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 25 Jul 2022 09:11:13 -0400
Subject: [PATCH] Add spam bypass permission
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9eb921fec32afa360f3a402e978411fcf3ec618c..44557ac1d655cd7118419072eb34acfdf714a133 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -875,16 +875,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
// CraftBukkit start
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
// Paper start
- String str = packet.getCommand(); int index = -1;
+ String str = packet.getCommand();
+ int index = -1;
if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) {
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
+ } // Parchment - spam bypass
// Paper end
// CraftBukkit end
// Paper start - Don't suggest if tab-complete is disabled
@@ -2615,6 +2618,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot start - spam exclusions
private void detectRateSpam(String s) {
+ if (this.getCraftPlayer().hasPermission("spam.bypass")) return; // Parchment - spam bypass
// CraftBukkit start - replaced with thread safe throttle
boolean counted = true;
for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
@@ -3393,10 +3397,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
+ } // Parchment - spam bypass
}
// Paper end
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());