package me.bauer.BauerCam.Commands;

import me.bauer.BauerCam.Main;
import me.bauer.BauerCam.Utils;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;

public final class CamCommand extends CommandBase {

	private static final ISubCommand[] commands = { new SubClear(), new SubGoto(), new SubReplace(), new SubStart(),
			new SubStop(), new SubUndo(), new SubExport(), new SubImport() };

	@Override
	public String getCommandName() {
		return "cam";
	}

	@Override
	public String getCommandUsage(final ICommandSender sender) {
		final StringBuilder s = new StringBuilder();
		s.append(Main.commands);
		for (final ISubCommand c : commands) {
			s.append("\n");
			s.append(c.getDescription());
		}
		return s.toString();
	}

	@Override
	public int getRequiredPermissionLevel() {
		return 0;
	}

	@Override
	public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args)
			throws CommandException {
		if (sender != Utils.mc.thePlayer) {
			throw new CommandException(Main.commandHasToBePlayer.toString(), new Object[0]);
		}
		if (args.length == 0) {
			throw new CommandException(getCommandUsage(sender), new Object[0]);
		}

		final String base = args[0].toLowerCase();

		for (final ISubCommand c : commands) {
			if (c.getBase().equals(base)) {
				c.execute(args);
				return;
			}
		}

		throw new CommandException(getCommandUsage(sender), new Object[0]);
	}

}

@@ -386,13 +386,28 @@
  Sub
-Clear
+Start(), new SubStop
 (), 
@@ -438,32 +438,16 @@
 place(),
- new SubStart(),
 %0A%09%09%09new 
@@ -445,28 +445,28 @@
 ,%0A%09%09%09new Sub
-Stop
+Undo
 (), new SubU
@@ -460,28 +460,29 @@
 o(), new Sub
-Undo
+Clear
 (), new SubE

Properly order commands