mirror of https://github.com/LOOHP/Limbo.git
Merge pull request #92 from danbka4z/fix/declarecommands-null
Fix: Send minimal DeclareCommands packet when no Limbo commands available
This commit is contained in:
commit
04ed353ab9
|
|
@ -34,13 +34,19 @@ public class DeclareCommands {
|
|||
public static PacketPlayOutDeclareCommands getDeclareCommandsPacket(CommandSender sender) throws IOException {
|
||||
List<String> 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue