9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Chat command max length

This commit is contained in:
violetc
2025-07-30 18:00:20 +08:00
parent cadc126902
commit e68eb3fe98
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
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

View File

@@ -1132,6 +1132,9 @@ public final class LeavesConfig {
@GlobalConfig("leaves-packet-event") @GlobalConfig("leaves-packet-event")
public boolean leavesPacketEvent = true; public boolean leavesPacketEvent = true;
@GlobalConfig("chat-command-max-length")
public int chatCommandMaxLength = 32767;
} }
public static RegionConfig region = new RegionConfig(); public static RegionConfig region = new RegionConfig();