1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-29 09:19:51 +02:00

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 b446df78e2
commit 209efb3ac9
14 changed files with 21 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ public class Commandban extends EssentialsCommand
@Override @Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{ {
boolean nomatch = false;
if (args.length < 1) if (args.length < 1)
{ {
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
@@ -31,6 +32,7 @@ public class Commandban extends EssentialsCommand
} }
catch (NoSuchFieldException e) catch (NoSuchFieldException e)
{ {
nomatch = true;
user = ess.getUser(new OfflinePlayer(args[0], ess)); user = ess.getUser(new OfflinePlayer(args[0], ess));
} }
if (!user.isOnline()) if (!user.isOnline())
@@ -65,13 +67,17 @@ public class Commandban extends EssentialsCommand
user.setBanReason(banReason); user.setBanReason(banReason);
user.setBanned(true); user.setBanned(true);
user.kickPlayer(banReason); user.kickPlayer(banReason);
server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason)); server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason));
if (nomatch) {
sender.sendMessage(_("userUnknown", user.getName()));
}
for (Player onlinePlayer : server.getOnlinePlayers()) for (Player onlinePlayer : server.getOnlinePlayers())
{ {
final User player = ess.getUser(onlinePlayer); 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)); 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp 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 gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00a76 entities
invalidHomeName=\u00a74Invalid home name invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.