@Override
  public void run(Server server, CommandSender sender, String commandLabel, String[] args)
      throws Exception {
    if (args.length < 1) {
      throw new NotEnoughArgumentsException();
    }

    if (server.matchPlayer(args[0]).isEmpty()) {
      ((CraftServer) server).getHandle().a(args[0]);
      sender.sendMessage(Util.format("playerBanned", args[0]));
    } else {
      final User player = ess.getUser(server.matchPlayer(args[0]).get(0));
      String banReason;
      if (args.length > 1) {
        banReason = getFinalArg(args, 1);
        player.setBanReason(commandLabel);
      } else {
        banReason = Util.i18n("defaultBanReason");
      }
      player.kickPlayer(banReason);
      ((CraftServer) server).getHandle().a(player.getName());
      sender.sendMessage(Util.format("playerBanned", player.getName()));
    }
    ess.loadBanList();
  }
	@Override
	public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
	{
		if (args.length < 1)
		{
			throw new NotEnoughArgumentsException();
		}
		final User user = getPlayer(server, args, 0, true);
		if (!user.isOnline())
		{
			if (sender instanceof Player
				&& !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
			{
				sender.sendMessage(_("banExempt"));
				return;
			}
		}
		else
		{
			if (user.isAuthorized("essentials.ban.exempt"))
			{
				sender.sendMessage(_("banExempt"));
				return;
			}
		}
		
		final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
		String banReason;
		if (args.length > 1)
		{
			banReason = _("banFormat", getFinalArg(args, 1), senderName);
		}
		else
		{
			banReason = _("banFormat", _("defaultBanReason"), senderName);
		}
		
		user.setBanReason(banReason);
		user.setBanned(true);
		user.kickPlayer(banReason);

		for (Player onlinePlayer : server.getOnlinePlayers())
		{
			final User player = ess.getUser(onlinePlayer);
			if (player.isAuthorized("essentials.ban.notify"))
			{
				onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
			}
		}
	}