package de.philworld.bukkit.compassex;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import de.philworld.bukkit.compassex.command.CommandContext;
import de.philworld.bukkit.compassex.command.CommandManager;
import de.philworld.bukkit.compassex.util.PermissionException;

public class CompassExCommandExecutor implements CommandExecutor {

	private final CompassEx plugin;
	private final CommandManager commands;

	public CompassExCommandExecutor(CompassEx plugin) {
		this.plugin = plugin;
		commands = new CommandManager(plugin.getLogger());
		commands.register(plugin.tracking);
		commands.register(plugin.info);
		commands.register(plugin.saving);
		commands.register(plugin.hiding);
		commands.register(plugin.death);
		commands.register(plugin.general);

		plugin.getCommand("compass").setExecutor(this);
	}

	@Override
	public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
		if (commands.onCommand(sender, command, label, args))
			return true;
		Player p = (Player) sender;
		try {
			if (args.length == 3) {
				plugin.general.position(new CommandContext(command, label, args), p);
			} else if (p.hasPermission("compassex.player") && args.length == 1) {
				plugin.general.player(new CommandContext(command, label, args), p);
			} else {
				plugin.general.help(new CommandContext(command, label, args), p);
			}
		} catch (PermissionException e) {
			e.send(p);
		}
		return true;
	}
}

@@ -1481,36 +1481,47 @@
 command, label, 
-args
+new String%5B%5D %7B%7D
 ), p);%0D%0A%09%09%09%7D%0D%0A%09%09

Fix help asking for a valid number after entering an invalid base command with arguments