Warn when banning a player who has never connected to the server.

This commit is contained in:
KHobbits 2012-10-14 13:01:40 +01:00
parent ced192e8fd
commit bdef1780ac
14 changed files with 21 additions and 2 deletions

View file

@ -20,6 +20,7 @@ public class Commandban extends EssentialsCommand
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
boolean nomatch = false;
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
@ -31,6 +32,7 @@ public class Commandban extends EssentialsCommand
}
catch (NoSuchFieldException e)
{
nomatch = true;
user = ess.getUser(new OfflinePlayer(args[0], ess));
}
if (!user.isOnline())
@ -65,13 +67,17 @@ public class Commandban extends EssentialsCommand
user.setBanReason(banReason);
user.setBanned(true);
user.kickPlayer(banReason);
server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason));
if (nomatch) {
sender.sendMessage(_("userUnknown", user.getName()));
}
for (Player onlinePlayer : server.getOnlinePlayers())
{
final User player = ess.getUser(onlinePlayer);
if (player.isAuthorized("essentials.ban.notify"))
if (onlinePlayer == sender || player.isAuthorized("essentials.ban.notify"))
{
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
}

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -462,3 +462,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.

View file

@ -459,3 +459,4 @@ antiBuildDrop=\u00a74You are not permitted to drop\u00a7c {0}\u00a74.
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.