mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@29b17a8 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9088) PaperMC/Paper@b5ce6e3 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9104) PaperMC/Paper@9cda284 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@f8c0112 {ci skip} add missing labels to project status map (#9106) PaperMC/Paper@6a7fef0 Allow entity effect changes off the main thread for worldgen (#8942) PaperMC/Paper@f8d2f82 Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9068) PaperMC/Paper@b626528 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@058d7c1 Updated Upstream (Bukkit/CraftBukkit/Spigot) PaperMC/Paper@ab72b12 Update Adventure to 4.13.1 (#9113) PaperMC/Paper@8be7a60 Fix getBrightness and getRawBrightness throwing exception in BlockStateListPopulator (#9111) PaperMC/Paper@e811927 Revert "Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9068)" Pufferfish Changes: pufferfish-gg/Pufferfish@da9fd85 Updated Upstream (Paper) pufferfish-gg/Pufferfish@751dfb0 Updated Upstream (Paper) pufferfish-gg/Pufferfish@c09a154 Updated Upstream (Paper) pufferfish-gg/Pufferfish@b778163 Updated Upstream (Paper)
32 lines
2.7 KiB
Diff
32 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <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/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 2cc00ca01f40e1509d82bfb18ddc8c17ab816e2e..52232316039ad0ac81b83802afb05a0541a761b3 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1261,10 +1261,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax;
|
|
double multiplier = Math.max(0.3D, Math.min(1D, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier));
|
|
long byteAllowed = maxBookPageSize;
|
|
+ ItemStack itemstack = this.player.getInventory().getItem(packet.getSlot()); // Purpur
|
|
for (String testString : pageList) {
|
|
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
|
if (byteLength > 256 * 4) {
|
|
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
|
|
+ org.purpurmc.purpur.event.player.PlayerBookTooLargeEvent event = new org.purpurmc.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), itemstack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
|
|
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
|
return;
|
|
}
|
|
@@ -1288,6 +1290,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
|
|
|
if (byteTotal > byteAllowed) {
|
|
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
|
|
+ org.purpurmc.purpur.event.player.PlayerBookTooLargeEvent event = new org.purpurmc.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), itemstack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur
|
|
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
|
return;
|
|
}
|