mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Drop Airplane patches
This commit is contained in:
34
patches/server/0154-PlayerBookTooLargeEvent.patch
Normal file
34
patches/server/0154-PlayerBookTooLargeEvent.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
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 764ec67150a37f3a18eb1efde9d0c8810a92da6d..04052a43a2025876529d2a6c6f5fc9821c723da6 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -1136,6 +1136,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!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
@@ -1148,6 +1149,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!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
@@ -1171,6 +1173,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!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user