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: 3db3aaf39 [Auto] Updated Upstream (CraftBukkit) c953e51dd [Auto] Updated Upstream (CraftBukkit/Spigot) dc529c7a9 Fix PlayerEditBookEvent (#5463) 3fea87edb [Auto] Updated Upstream (CraftBukkit) a111b1365 Send post ChatEvent messages as MessageType.CHAT d15161114 [Auto] Updated Upstream (Spigot) e8889e96a [Auto] Updated Upstream (CraftBukkit) 3bc888ba6 [Auto] Updated Upstream (CraftBukkit) 211f8e041 Prevent light queue overfill when no players are online Airplane Changes: 3ed988c05 Use AIR library for configuration parsing
35 lines
2.6 KiB
Diff
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 851d4ac34feb94f0cd4ba8a5399093dfa40ce1cd..da95a9e8870da7002c6ef47fc48ead32f3ab4856 100644
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
@@ -1115,6 +1115,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;
|
|
}
|
|
@@ -1127,6 +1128,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;
|
|
}
|
|
@@ -1150,6 +1152,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;
|
|
}
|