9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0137-Chat-command-max-length.patch
2025-08-16 22:08:16 +08:00

43 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Wed, 30 Jul 2025 17:58:24 +0800
Subject: [PATCH] Chat command max length
diff --git a/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java b/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
index 3b0931d9bb5eef6f900c09a1fc342516e708af58..9bfe3bc0e9993280e5dac75e858f76d246b16c20 100644
--- a/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
+++ b/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
@@ -11,11 +11,11 @@ public record ServerboundChatCommandPacket(String command) implements Packet<Ser
);
private ServerboundChatCommandPacket(FriendlyByteBuf buffer) {
- this(buffer.readUtf());
+ this(buffer.readUtf(org.leavesmc.leaves.LeavesConfig.mics.chatCommandMaxLength)); // Leaves - chat command max length
}
private void write(FriendlyByteBuf buffer) {
- buffer.writeUtf(this.command);
+ buffer.writeUtf(this.command, org.leavesmc.leaves.LeavesConfig.mics.chatCommandMaxLength); // Leaves - chat command max length
}
@Override
diff --git a/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java b/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java
index 07943553b562b95076bdce232d6f0796f469400f..d1976d89ddc29e77db498c50f961634e76868521 100644
--- a/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java
+++ b/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java
@@ -16,11 +16,11 @@ public record ServerboundChatCommandSignedPacket(
);
private ServerboundChatCommandSignedPacket(FriendlyByteBuf buffer) {
- this(buffer.readUtf(), buffer.readInstant(), buffer.readLong(), new ArgumentSignatures(buffer), new LastSeenMessages.Update(buffer));
+ this(buffer.readUtf(org.leavesmc.leaves.LeavesConfig.mics.chatCommandMaxLength), buffer.readInstant(), buffer.readLong(), new ArgumentSignatures(buffer), new LastSeenMessages.Update(buffer)); // Leaves - chat command max length
}
private void write(FriendlyByteBuf buffer) {
- buffer.writeUtf(this.command);
+ buffer.writeUtf(this.command, org.leavesmc.leaves.LeavesConfig.mics.chatCommandMaxLength); // Leaves - chat command max length
buffer.writeInstant(this.timeStamp);
buffer.writeLong(this.salt);
this.argumentSignatures.write(buffer);