Search in sources :

Example 1 with ISubCommand

use of WayofTime.alchemicalWizardry.api.command.ISubCommand in project BloodMagic by WayofTime.

the class CommandBloodMagic method processCommand.

@Override
public void processCommand(ICommandSender commandSender, String[] args) {
    if (args.length > 0 && subCommands.containsKey(args[0])) {
        ISubCommand subCommand = subCommands.get(args[0]);
        String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
        if (subCommand.canSenderUseSubCommand(commandSender))
            subCommand.processSubCommand(commandSender, subArgs);
        else
            commandSender.addChatMessage(new ChatComponentTranslation("commands.error.perm").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
    } else {
        commandSender.addChatMessage(new ChatComponentTranslation("commands.error.unknown").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
    }
}
Also used : ChatStyle(net.minecraft.util.ChatStyle) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ISubCommand(WayofTime.alchemicalWizardry.api.command.ISubCommand)

Aggregations

ISubCommand (WayofTime.alchemicalWizardry.api.command.ISubCommand)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 ChatStyle (net.minecraft.util.ChatStyle)1