Search in sources :

Example 1 with GroupSubCommand

use of com.builtbroken.mc.core.commands.ext.GroupSubCommand in project Engine by VoltzEngine-Project.

the class CommandGroup method handleConsoleCommand.

@Override
public boolean handleConsoleCommand(ICommandSender sender, String[] args) {
    String name = args[0];
    AccessGroup group = GroupProfileHandler.GLOBAL.getAccessProfile().getGroup(name);
    if (group != null) {
        if (args.length > 1) {
            for (AbstractCommand command : subCommands) {
                if (command instanceof GroupSubCommand && command.getCommandName().equalsIgnoreCase(args[1])) {
                    if (((GroupSubCommand) command).handle(sender, group, "", removeFront(args, 2))) {
                        return true;
                    }
                }
            }
        }
        sender.addChatMessage(new ChatComponentText("Unknown group sub command"));
    } else {
        sender.addChatMessage(new ChatComponentText("Unknown group"));
    }
    return true;
}
Also used : AccessGroup(com.builtbroken.mc.framework.access.AccessGroup) AbstractCommand(com.builtbroken.mc.core.commands.prefab.AbstractCommand) ChatComponentText(net.minecraft.util.ChatComponentText) GroupSubCommand(com.builtbroken.mc.core.commands.ext.GroupSubCommand)

Aggregations

GroupSubCommand (com.builtbroken.mc.core.commands.ext.GroupSubCommand)1 AbstractCommand (com.builtbroken.mc.core.commands.prefab.AbstractCommand)1 AccessGroup (com.builtbroken.mc.framework.access.AccessGroup)1 ChatComponentText (net.minecraft.util.ChatComponentText)1