Files
Purpur/patches/server/0161-PlayerBookTooLargeEvent.patch
BillyGalbreath 643d9681ff Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
8fa15382b [Auto] Updated Upstream (CraftBukkit)
732b2f6b5 [CI-SKIP] [Auto] Rebuild Patches
c5a39ffa2 Add BlockPreDispenseEvent (#5075)
8aeb4c9c3 Correctly skip pathfinder ticks for inactive entities (#5085)
0e420049c Fix console spam when removing chests in water
56b7935bb Add PlayerChangeBeaconEffectEvent
2eda45c34 added Wither API
97d0c571b Added Vanilla Entity Tags
fccac282a fix NPE in getDisplayNameComponent
24e140372 Configurable max leash distance

Tuinity Changes:
d3ee22224 Merge dev/lighting
2021-01-20 23:52:16 -06: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/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e9485684b7d5ddde72fc388d51cfef679178bad3..75d955948a407d94e6f3a88f86afa8b1d6ba33cb 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -941,6 +941,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;
}
@@ -953,6 +954,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;
}
@@ -976,6 +978,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;
}