|
@@ -180,6 +180,7 @@ public class ModCommandManager extends Commands
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println("execute: " + rawCommand + " " + cs.hasPermissionLevel(4));
|
|
|
return super.handleCommand(cs, rawCommand);
|
|
|
}
|
|
|
events.onMissingPermission(getSource(cs), commandName);
|
|
@@ -196,16 +197,15 @@ public class ModCommandManager extends Commands
|
|
|
Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> map = Maps.newHashMap();
|
|
|
RootCommandNode<ISuggestionProvider> rootcommandnode = new RootCommandNode<>();
|
|
|
map.put(getDispatcher().getRoot(), rootcommandnode);
|
|
|
- this.commandSourceNodesToSuggestionNodes(getDispatcher().getRoot(), rootcommandnode, player.getCommandSource(), map);
|
|
|
+ this.commandSourceNodesToSuggestionNodes(true, getDispatcher().getRoot(), rootcommandnode, player.getCommandSource(), map);
|
|
|
player.connection.sendPacket(new SCommandListPacket(rootcommandnode));
|
|
|
}
|
|
|
|
|
|
- private void commandSourceNodesToSuggestionNodes(CommandNode<CommandSource> node, CommandNode<ISuggestionProvider> suggestion, CommandSource source, Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> commandNodeToSuggestionNode)
|
|
|
+ private void commandSourceNodesToSuggestionNodes(boolean first, CommandNode<CommandSource> node, CommandNode<ISuggestionProvider> suggestion, CommandSource source, Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> commandNodeToSuggestionNode)
|
|
|
{
|
|
|
for(CommandNode<CommandSource> commandnode : node.getChildren())
|
|
|
{
|
|
|
- if(perms.hasPermission(source, commandnode.getName()))
|
|
|
- //if(commandnode.canUse(source))
|
|
|
+ if((first && perms.hasPermission(source, commandnode.getName()) || (!first && commandnode.canUse(source))))
|
|
|
{
|
|
|
ArgumentBuilder<ISuggestionProvider, ?> argumentbuilder = (ArgumentBuilder) commandnode.createBuilder();
|
|
|
argumentbuilder.requires((p_197060_0_) ->
|
|
@@ -239,7 +239,7 @@ public class ModCommandManager extends Commands
|
|
|
suggestion.addChild(commandnode1);
|
|
|
if(!commandnode.getChildren().isEmpty())
|
|
|
{
|
|
|
- this.commandSourceNodesToSuggestionNodes(commandnode, commandnode1, source, commandNodeToSuggestionNode);
|
|
|
+ this.commandSourceNodesToSuggestionNodes(false, commandnode, commandnode1, source, commandNodeToSuggestionNode);
|
|
|
}
|
|
|
}
|
|
|
}
|