Files
Purpur/patches/server/0155-PlayerBookTooLargeEvent.patch
Ben Kerllenevich 6bd246b947 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
2c6b1f048 Revert "Remove itneract event from boat" (Fixes #5677)
aae1c54a9 Add command line option to load extra plugin jars not in the plugins folder
322886c86 Avoid NPE due to PlayerBedFailEnterEvent
d3c9a195c removed duplicate ProjectileHitEvent for fireball (#5671)
7989028a5 More Enchantment API (#5588)
c0cb5c129 Adds methods for checking item repairability (#5651)
22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647)
979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638)
51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664)
45e19ffb0 [Auto] Updated Upstream (CraftBukkit)
151457628 Fix Counter#decrement recursive call (#5665)
21ac7dc98 [Auto] Updated Upstream (CraftBukkit)
18ad2c9dd Add environment variable (PAPER_DISABLE_SERVER_GUI) to disable server gui
2021-05-19 18:01:23 -04:00

35 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Wed, 23 Dec 2020 00:43:59 -0600
Subject: [PATCH] PlayerBookTooLargeEvent
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index e1c42de5d1e3ddbdf8530a79e5eb9d4ac2c96236..82e59d0f3e59992d6b40edb29cc5a01ea74e746f 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -1128,6 +1128,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
NBTTagList pageList = testStack.getTag().getList("pages", 8);
if (pageList.size() > 100) {
PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send a book with too many pages");
+ net.pl3x.purpur.event.player.PlayerBookTooLargeEvent event = new net.pl3x.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), testStack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
minecraftServer.scheduleOnMain(() -> this.disconnect("Book too large!"));
return;
}
@@ -1140,6 +1141,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) {
PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send a book with with a page too large!");
+ net.pl3x.purpur.event.player.PlayerBookTooLargeEvent event = new net.pl3x.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), testStack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
minecraftServer.scheduleOnMain(() -> this.disconnect("Book too large!"));
return;
}
@@ -1163,6 +1165,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (byteTotal > byteAllowed) {
PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
+ net.pl3x.purpur.event.player.PlayerBookTooLargeEvent event = new net.pl3x.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), testStack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
minecraftServer.scheduleOnMain(() -> this.disconnect("Book too large!"));
return;
}