summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandkick.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkick.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
index 287a3cc62..d977055e2 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import java.util.logging.Level;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -24,23 +25,34 @@ public class Commandkick extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- final User user = getPlayer(server, args, 0);
- if (sender instanceof Player && user.isAuthorized("essentials.kick.exempt"))
+ final User target = getPlayer(server, args, 0, true);
+ if (sender instanceof Player)
{
- throw new Exception(_("kickExempt"));
+ User user = ess.getUser(sender);
+ if (target.isHidden() && !user.isAuthorized("essentials.list.hidden"))
+ {
+ throw new PlayerNotFoundException();
+ }
+ if (target.isAuthorized("essentials.kick.exempt"))
+ {
+ throw new Exception(_("kickExempt"));
+ }
}
- final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
- user.kickPlayer(kickReason);
+
+ String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
+ kickReason = Util.replaceFormat(kickReason.replace("\\n", "\n"));
+
+ target.kickPlayer(kickReason);
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
-
- server.getLogger().log(Level.INFO, _("playerKicked", senderName, user.getName(), kickReason));
+
+ server.getLogger().log(Level.INFO, _("playerKicked", senderName, target.getName(), kickReason));
for (Player onlinePlayer : server.getOnlinePlayers())
{
User player = ess.getUser(onlinePlayer);
if (player.isAuthorized("essentials.kick.notify"))
{
- onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
+ onlinePlayer.sendMessage(_("playerKicked", senderName, target.getName(), kickReason));
}
}
}