mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-24 09:01:54 +01:00
Root node should be at index 0 (to facilitate the future ArgumentCommand)
This commit is contained in:
parent
dffb90e1b4
commit
779490064e
@ -297,6 +297,11 @@ public final class CommandManager {
|
|||||||
// Contains the children of the main node (all commands name)
|
// Contains the children of the main node (all commands name)
|
||||||
IntList rootChildren = new IntArrayList();
|
IntList rootChildren = new IntArrayList();
|
||||||
|
|
||||||
|
// Root node
|
||||||
|
DeclareCommandsPacket.Node rootNode = new DeclareCommandsPacket.Node();
|
||||||
|
rootNode.flags = 0;
|
||||||
|
nodes.add(rootNode);
|
||||||
|
|
||||||
// Brigadier-like commands
|
// Brigadier-like commands
|
||||||
for (Command command : dispatcher.getCommands()) {
|
for (Command command : dispatcher.getCommands()) {
|
||||||
// Check if player should see this command
|
// Check if player should see this command
|
||||||
@ -373,14 +378,11 @@ public final class CommandManager {
|
|||||||
nodes.add(literalNode);
|
nodes.add(literalNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeclareCommandsPacket.Node rootNode = new DeclareCommandsPacket.Node();
|
// Add root node children
|
||||||
rootNode.flags = 0;
|
|
||||||
rootNode.children = ArrayUtils.toArray(rootChildren);
|
rootNode.children = ArrayUtils.toArray(rootChildren);
|
||||||
|
|
||||||
nodes.add(rootNode);
|
|
||||||
|
|
||||||
declareCommandsPacket.nodes = nodes.toArray(new DeclareCommandsPacket.Node[0]);
|
declareCommandsPacket.nodes = nodes.toArray(new DeclareCommandsPacket.Node[0]);
|
||||||
declareCommandsPacket.rootIndex = nodes.size() - 1;
|
declareCommandsPacket.rootIndex = 0;
|
||||||
|
|
||||||
return declareCommandsPacket;
|
return declareCommandsPacket;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user