diff options
author | ementalo <suror@gmx.co.uk> | 2011-07-15 22:58:03 +0100 |
---|---|---|
committer | ementalo <suror@gmx.co.uk> | 2011-07-15 22:58:03 +0100 |
commit | f104c2e8f6bd471388f84e67009faeb0d6a779bf (patch) | |
tree | 63ca136efa4eff36752950dc4a1e752fcbd68b8d | |
parent | 4dc92a144ef17d21d270f3c703c9b5e68fc7f0e3 (diff) | |
download | Essentials-f104c2e8f6bd471388f84e67009faeb0d6a779bf.tar Essentials-f104c2e8f6bd471388f84e67009faeb0d6a779bf.tar.gz Essentials-f104c2e8f6bd471388f84e67009faeb0d6a779bf.tar.lz Essentials-f104c2e8f6bd471388f84e67009faeb0d6a779bf.tar.xz Essentials-f104c2e8f6bd471388f84e67009faeb0d6a779bf.zip |
offline player validation for banning
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandban.java | 26 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandunban.java | 4 |
2 files changed, 13 insertions, 17 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 1cb79241d..1499b10ac 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -26,26 +26,20 @@ public class Commandban extends EssentialsCommand sender.sendMessage(Util.i18n("banExempt")); return; } - if (server.matchPlayer(args[0]).isEmpty()) + + String banReason; + if (args.length > 1) { - ess.getBans().banByName(args[0]); - server.broadcastMessage(Util.format("playerBanned", args[0], Util.i18n("defaultBanReason"))); + banReason = getFinalArg(args, 1); + player.setBanReason(commandLabel); } else { - String banReason; - if (args.length > 1) - { - banReason = getFinalArg(args, 1); - player.setBanReason(commandLabel); - } - else - { - banReason = Util.i18n("defaultBanReason"); - } - player.kickPlayer(banReason); - ess.getBans().banByName(args[0]); - server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason)); + banReason = Util.i18n("defaultBanReason"); } + player.kickPlayer(banReason); + ess.getBans().banByName(player.getName()); + server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason)); } } + diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index 794988867..88e7f10ba 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -20,7 +21,8 @@ public class Commandunban extends EssentialsCommand throw new NotEnoughArgumentsException(); } - ess.getBans().unbanByName(args[0]); + User u = getPlayer(server, args, 0, true); + ess.getBans().unbanByName(u.getName()); sender.sendMessage(Util.i18n("unbannedPlayer")); } } |