Files
ParchmentMC/patches/server/0020-Add-spam-bypass-permission.patch
Lexi 9f1b9e93dd Updated Upstream (Paper)
As promised,

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@22ac7d6 Add internal netty pipeline events
PaperMC/Paper@345a6a6 Updated Upstream (CraftBukkit)
PaperMC/Paper@86f87ba Fix custom merchant trade event world reference
PaperMC/Paper@734a436 Move patches over, start with first few
PaperMC/Paper@faafca8 New work
PaperMC/Paper@afb9e81 Fix timings diff
PaperMC/Paper@08828fd More work
PaperMC/Paper@50710fa More more work
PaperMC/Paper@7a13367 More more more work
PaperMC/Paper@aab4038 More more more more work
PaperMC/Paper@c730403 More more more more work
PaperMC/Paper@6b80b34 More more more more more more work
PaperMC/Paper@c8f3d9e More more more more more more more work
PaperMC/Paper@64cb313 some compile fixes
PaperMC/Paper@063e6b2 Compile fixes
PaperMC/Paper@cb6f029 More compile fixed
PaperMC/Paper@d41ecbe Make it compie
PaperMC/Paper@2184cd2 Fix chat message api using overlay
PaperMC/Paper@c488d15 Don't fire preview event for non-player senders
PaperMC/Paper@71544ab Readd deobfuscation of chat executor stacktraces
PaperMC/Paper@4a4ee79 Separate out chat and commands sent via API (#8131)
PaperMC/Paper@2acb479 Fix xray patch code style (#8196)
PaperMC/Paper@3b895f3 Updated Upstream (CraftBukkit)
PaperMC/Paper@e5bbb56 Added 1.19 kick event causes (#8204)
PaperMC/Paper@b72eafc Send block entities after destroy prediction (#8053)
PaperMC/Paper@b74c4d4 Warn on plugins accessing faraway chunks (#8208)
PaperMC/Paper@65f0b2e Add more needed BlockStateListPopulator Methods (#8021)
PaperMC/Paper@8a08b86 Custom Chat Completions API (#8212)
PaperMC/Paper@6ecdbc0 Use Worldheight for Activation Ranges (#8061)
PaperMC/Paper@532dc51 Add missing BlockFadeEvents (#8171)
2022-07-30 16:15:44 -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 ff7df8026f85b7ad51458a0b720a8baf71cd9bd1..3481e44c64924ebdfeec0a950efec22b0afb653d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -874,16 +874,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
@@ -2587,6 +2590,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 )
@@ -3363,10 +3367,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());