private void registerCompleter(String commandName, Method method, Object obj) {
        String origCommandName = commandName;
        commandName = commandName.split("\\.")[0].toLowerCase();
        org.bukkit.command.Command command = bukkitCommandMap.getCommand(commandName);

        if (bukkitCommandMap.getCommand(commandName) == null) {
            command = new BukkitCommand(commandName, plugin);
            bukkitCommandMap.register(plugin.getName(), command);
        }
        if (command instanceof BukkitCommand) {
            BukkitCommand bukkitCommand = (BukkitCommand) command;
            if (bukkitCommand.completer == null) {
                bukkitCommand.completer = new BukkitCompleter();
            }
            bukkitCommand.completer.addCompleter(origCommandName, method, obj);
        } else if (command instanceof PluginCommand) {
            try {
                PluginCommand pluginCommand = (PluginCommand) command;
                Field field = pluginCommand.getClass().getDeclaredField("completer");
                field.setAccessible(true);
                if (field.get(pluginCommand) == null) {
                    BukkitCompleter completer = new BukkitCompleter();
                    completer.addCompleter(origCommandName, method, obj);
                    field.set(pluginCommand, completer);
                } else if (field.get(pluginCommand) instanceof BukkitCompleter) {
                    BukkitCompleter completer = (BukkitCompleter) field.get(pluginCommand);
                    completer.addCompleter(origCommandName, method, obj);
                } else {
                    printMessage("Unable to register tab completer " + method.getName() + ". A tab completer is already registered for this command!");
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }