Add basic /spy support

This commit is contained in:
Draycia authored and Josh (Vicarious) committed 2020-07-08 20:50:06 -07:00
1 parent 53d9086939
commit b3dded7852
10 files changed
+237 -27

No files matched your search

@@ -35,6 +35,16 @@ public class CommandManager {
return completions;
});
commandManager.getCommandCompletions().registerCompletion("channel", (context) -> {
ArrayList<String> completions = new ArrayList<>();
for (ChatChannel chatChannel : simpleChat.getChannels()) {
completions.add(chatChannel.getName());
}
return completions;
});
commandManager.getCommandContexts().registerContext(ChatChannel.class, (context) -> {
String name = context.popFirstArg();
@@ -63,6 +73,12 @@ public class CommandManager {
}
});
commandManager.getCommandConditions().addCondition(ChatChannel.class,"exists", (context, execution, value) -> {
if (value == null) {
throw new ConditionFailedException(simpleChat.getConfig().getString("language.cannot-use-channel"));
}
});
setupCommands(commandManager);
}
@@ -79,6 +95,7 @@ public class CommandManager {
manager.registerCommand(new MuteCommand(simpleChat));
manager.registerCommand(new ChannelColorCommand(simpleChat));
manager.registerCommand(new SetColorCommand(simpleChat));
manager.registerCommand(new SpyChannelCommand(simpleChat));
}
public co.aikar.commands.CommandManager getCommandManager() {