From 502aa78c3b41fbec7ac091b0dbb1c005adacc4f8 Mon Sep 17 00:00:00 2001 From: Danbka4Z <92846456+danbka4z@users.noreply.github.com> Date: Sun, 31 Aug 2025 17:49:37 +0300 Subject: [PATCH] Fix: Send minimal DeclareCommands packet when no Limbo commands available Previously, when the command list was empty, the server returned null and did not send a DeclareCommands packet. This caused the client to lose the slash UI and tab completion entirely. Now, when there are no available commands, the server sends a minimal valid tree (only a root node with no children). This keeps the client UI functional while still reflecting the fact that no commands are available. --- .../com/loohp/limbo/utils/DeclareCommands.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/loohp/limbo/utils/DeclareCommands.java b/src/main/java/com/loohp/limbo/utils/DeclareCommands.java index 28576ba..96716c9 100644 --- a/src/main/java/com/loohp/limbo/utils/DeclareCommands.java +++ b/src/main/java/com/loohp/limbo/utils/DeclareCommands.java @@ -34,13 +34,19 @@ public class DeclareCommands { public static PacketPlayOutDeclareCommands getDeclareCommandsPacket(CommandSender sender) throws IOException { List commands = Limbo.getInstance().getPluginManager().getTabOptions(sender, new String[0]); - if (commands.isEmpty()) { - return null; - } - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream output = new DataOutputStream(buffer); + if (commands.isEmpty()) { + DataTypeIO.writeVarInt(output, 1); + + output.writeByte(0); + DataTypeIO.writeVarInt(output, 0); + DataTypeIO.writeVarInt(output, 0); + + return new PacketPlayOutDeclareCommands(buffer.toByteArray()); + } + DataTypeIO.writeVarInt(output, commands.size() * 2 + 1); output.writeByte(0);