package de.st_ddt.crazylogin.commands;

import java.util.List;

import org.bukkit.command.CommandSender;

import de.st_ddt.crazylogin.CrazyLogin;
import de.st_ddt.crazylogin.data.LoginPlayerData;
import de.st_ddt.crazyplugin.exceptions.CrazyCommandNoSuchException;
import de.st_ddt.crazyplugin.exceptions.CrazyCommandUsageException;
import de.st_ddt.crazyplugin.exceptions.CrazyException;
import de.st_ddt.crazyutil.locales.Localized;
import de.st_ddt.crazyutil.modules.permissions.PermissionModule;
import de.st_ddt.crazyutil.paramitrisable.PlayerDataParamitrisable;

public class CommandPlayerReverify extends CommandExecutor
{

	public CommandPlayerReverify(final CrazyLogin plugin)
	{
		super(plugin);
	}

	@Override
	@Localized("CRAZYLOGIN.COMMAND.PLAYER.REVERIFY.SUCCESS $Name$")
	public void command(final CommandSender sender, final String[] args) throws CrazyException
	{
		if (args.length != 1)
			throw new CrazyCommandUsageException("<Player>");
		final String arg = args[0];
		if (arg.equals("*"))
		{
			for (final LoginPlayerData data : plugin.getPlayerData())
				data.setLoggedIn(false);
			plugin.sendLocaleMessage("COMMAND.PLAYER.REVERIFY.SUCCESS", sender, arg);
		}
		else
		{
			final LoginPlayerData data = plugin.getPlayerData(arg);
			if (data == null)
				throw new CrazyCommandNoSuchException("Player (with Account)", arg);
			data.setLoggedIn(false);
			plugin.sendLocaleMessage("COMMAND.PLAYER.REVERIFY.SUCCESS", sender, data.getName());
		}
	}

	@Override
	public List<String> tab(final CommandSender sender, final String[] args)
	{
		if (args.length != 1)
			return null;
		else
			return PlayerDataParamitrisable.tabHelp(plugin, args[0]);
	}

	@Override
	public boolean hasAccessPermission(final CommandSender sender)
	{
		return PermissionModule.hasPermission(sender, "crazylogin.player.reverify");
	}
}

@@ -102,16 +102,50 @@
 Sender;%0D
+%0Aimport org.bukkit.entity.Player;%0D
 %0A%0D%0Aimpor
@@ -305,77 +305,8 @@
 n;%0D%0A
-import de.st_ddt.crazyplugin.exceptions.CrazyCommandUsageException;%0D%0A
 impo
@@ -350,32 +350,72 @@
 razyException;%0D%0A
+import de.st_ddt.crazyutil.ChatHelper;%0D%0A
 import de.st_ddt
@@ -912,113 +912,62 @@
 %0D%0A%09%09
-if (args.length != 1)%0D%0A%09%09%09throw new CrazyCommandUsageException(%22%3CPlayer%3E%22);%0D%0A%09%09final String arg =
+final String arg = ChatHelper.listingString(%22 %22,
  args
-%5B0%5D
+)
 ;%0D%0A%09
@@ -1338,16 +1338,16 @@
  arg);%0D%0A
-
 %09%09%09data.
@@ -1359,32 +1359,134 @@
 ggedIn(false);%0D%0A
+%09%09%09final Player player = data.getPlayer();%0D%0A%09%09%09if (player != null)%0D%0A%09%09%09%09plugin.requestLogin(player);%0D%0A
 %09%09%09plugin.sendLo

send message to player who should reverify