Compare commits

..

3 Commits

Author SHA1 Message Date
LOOHP 75191a83f7
Update pom.xml 2025-08-31 16:09:55 +01:00
LOOHP 04ed353ab9
Merge pull request #92 from danbka4z/fix/declarecommands-null
Fix: Send minimal DeclareCommands packet when no Limbo commands available
2025-08-31 16:09:27 +01:00
Danbka4Z 502aa78c3b
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.
2025-08-31 17:49:37 +03:00
2 changed files with 11 additions and 5 deletions

View File

@ -24,7 +24,7 @@
<groupId>com.loohp</groupId> <groupId>com.loohp</groupId>
<artifactId>Limbo</artifactId> <artifactId>Limbo</artifactId>
<name>Limbo</name> <name>Limbo</name>
<version>0.7.15-ALPHA</version> <version>0.7.16-ALPHA</version>
<description>Standalone Limbo Minecraft Server.</description> <description>Standalone Limbo Minecraft Server.</description>
<url>https://github.com/LOOHP/Limbo</url> <url>https://github.com/LOOHP/Limbo</url>

View File

@ -34,13 +34,19 @@ public class DeclareCommands {
public static PacketPlayOutDeclareCommands getDeclareCommandsPacket(CommandSender sender) throws IOException { public static PacketPlayOutDeclareCommands getDeclareCommandsPacket(CommandSender sender) throws IOException {
List<String> commands = Limbo.getInstance().getPluginManager().getTabOptions(sender, new String[0]); List<String> commands = Limbo.getInstance().getPluginManager().getTabOptions(sender, new String[0]);
if (commands.isEmpty()) {
return null;
}
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(buffer); 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); DataTypeIO.writeVarInt(output, commands.size() * 2 + 1);
output.writeByte(0); output.writeByte(0);