Search in sources :

Example 1 with SubCommandRegion

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

the class CommandRegion method handleEntityPlayerCommand.

@Override
public boolean handleEntityPlayerCommand(EntityPlayer player, String[] args) {
    if (args.length > 0) {
        String name = args[0];
        Region region = RegionManager.getControllerForWorld(player.worldObj).getRegion(name);
        if (region != null) {
            if (args.length > 1) {
                for (AbstractCommand command : subCommands) {
                    if (command instanceof SubCommandRegion && command.getCommandName().equalsIgnoreCase(args[1])) {
                        if (((SubCommandRegion) command).handle(player, region, removeFront(args, 2))) {
                            return true;
                        }
                    }
                }
            }
            player.addChatMessage(new ChatComponentText("Unknown region sub command"));
        } else {
            player.addChatMessage(new ChatComponentText("Unknown region"));
        }
    } else {
        player.addChatMessage(new ChatComponentText("Missing region name"));
    }
    return true;
}
Also used : SubCommandRegion(com.builtbroken.mc.core.commands.ext.SubCommandRegion) AbstractCommand(com.builtbroken.mc.prefab.commands.AbstractCommand) Region(com.builtbroken.mc.lib.modflags.Region) SubCommandRegion(com.builtbroken.mc.core.commands.ext.SubCommandRegion) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

SubCommandRegion (com.builtbroken.mc.core.commands.ext.SubCommandRegion)1 Region (com.builtbroken.mc.lib.modflags.Region)1 AbstractCommand (com.builtbroken.mc.prefab.commands.AbstractCommand)1 ChatComponentText (net.minecraft.util.ChatComponentText)1