mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Add basic /spy support
This commit is contained in:
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() {
|
||||
|
||||
Reference in new issue
Block a user