|
@@ -32,6 +32,7 @@ public class ModCommandManager extends Commands {
|
|
private final Scripts scripts;
|
|
private final Scripts scripts;
|
|
|
|
|
|
private final ArrayList<CommandNode> customNodes = new ArrayList<>();
|
|
private final ArrayList<CommandNode> customNodes = new ArrayList<>();
|
|
|
|
+ private final HashSet<String> ignoredCommands = new HashSet<>();
|
|
|
|
|
|
public ModCommandManager(boolean isDedicatedServer, PermissionManager perms, ScriptEvents events, Scripts scripts, ISnuviScheduler scheduler) {
|
|
public ModCommandManager(boolean isDedicatedServer, PermissionManager perms, ScriptEvents events, Scripts scripts, ISnuviScheduler scheduler) {
|
|
super(isDedicatedServer);
|
|
super(isDedicatedServer);
|
|
@@ -48,12 +49,25 @@ public class ModCommandManager extends Commands {
|
|
this.perms = perms;
|
|
this.perms = perms;
|
|
this.events = events;
|
|
this.events = events;
|
|
this.scripts = scripts;
|
|
this.scripts = scripts;
|
|
|
|
+
|
|
|
|
+ // forge command which fails ...
|
|
|
|
+ ignoredCommands.add("config");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public void clearCustomNodes() {
|
|
public void clearCustomNodes() {
|
|
customNodes.clear();
|
|
customNodes.clear();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void addIgnoredCommands(String command) {
|
|
|
|
+ ignoredCommands.add(command);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void clearIgnoredCommands() {
|
|
|
|
+ ignoredCommands.clear();
|
|
|
|
+ // forge command which fails ...
|
|
|
|
+ ignoredCommands.add("config");
|
|
|
|
+ }
|
|
|
|
+
|
|
public void addCustomNodes(CommandNode node) {
|
|
public void addCustomNodes(CommandNode node) {
|
|
customNodes.add(node);
|
|
customNodes.add(node);
|
|
}
|
|
}
|
|
@@ -190,6 +204,9 @@ public class ModCommandManager extends Commands {
|
|
CommandSource source,
|
|
CommandSource source,
|
|
Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> map) {
|
|
Map<CommandNode<CommandSource>, CommandNode<ISuggestionProvider>> map) {
|
|
for(CommandNode<CommandSource> commandnode : node.getChildren()) {
|
|
for(CommandNode<CommandSource> commandnode : node.getChildren()) {
|
|
|
|
+ if(first && ignoredCommands.contains(commandnode.getName())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
if((first && perms.hasPermission(source, commandnode.getName()) || (!first && commandnode.canUse(source)))) {
|
|
if((first && perms.hasPermission(source, commandnode.getName()) || (!first && commandnode.canUse(source)))) {
|
|
ArgumentBuilder<ISuggestionProvider, ?> argumentbuilder = (ArgumentBuilder) commandnode.createBuilder();
|
|
ArgumentBuilder<ISuggestionProvider, ?> argumentbuilder = (ArgumentBuilder) commandnode.createBuilder();
|
|
argumentbuilder.requires(a -> true);
|
|
argumentbuilder.requires(a -> true);
|