diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index e56f9d67b..c23161c0e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -31,7 +31,7 @@ public class Commandkill extends EssentialsCommand continue; } - matchPlayer.setHealth(0); + matchPlayer.damage(1000); sender.sendMessage(_("kill", matchPlayer.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java index 0afcf1650..c13c1489d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java @@ -15,40 +15,40 @@ public class Commandnear extends EssentialsCommand { super("near"); } - + @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { long radius = 200; User otherUser = null; - + if (args.length > 0) { try { - otherUser = getPlayer(server, args, 0); + radius = Long.parseLong(args[0]); } - catch (Exception ex) + catch (NumberFormatException e) { try { - radius = Long.parseLong(args[0]); + otherUser = getPlayer(server, args, 0); + } + catch (Exception ex) + { + } + } + if (args.length > 1 && otherUser != null) + { + try + { + radius = Long.parseLong(args[1]); } catch (NumberFormatException e) { } } } - if (args.length > 1 && otherUser != null) - { - try - { - radius = Long.parseLong(args[1]); - } - catch (NumberFormatException e) - { - } - } if (otherUser == null || user.isAuthorized("essentials.near.others")) { user.sendMessage(_("nearbyPlayers", getLocal(server, otherUser == null ? user : otherUser, radius))); @@ -58,20 +58,15 @@ public class Commandnear extends EssentialsCommand user.sendMessage(_("noAccessCommand")); } } - + @Override protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - - User otherUser = null; - if (args.length > 0) - { - otherUser = getPlayer(server, args, 0); - } - else + if (args.length == 0) { throw new NotEnoughArgumentsException(); } + final User otherUser = getPlayer(server, args, 0); long radius = 200; if (args.length > 1) { @@ -85,14 +80,14 @@ public class Commandnear extends EssentialsCommand } sender.sendMessage(_("nearbyPlayers", getLocal(server, otherUser, radius))); } - + private String getLocal(final Server server, final User user, final long radius) { final Location loc = user.getLocation(); final World world = loc.getWorld(); final StringBuilder output = new StringBuilder(); final long radiusSquared = radius * radius; - + for (Player onlinePlayer : server.getOnlinePlayers()) { final User player = ess.getUser(onlinePlayer); @@ -103,7 +98,7 @@ public class Commandnear extends EssentialsCommand { continue; } - + final long delta = (long)playerLoc.distanceSquared(loc); if (delta < radiusSquared) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index 7ef012d0d..7d8ee481d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -53,7 +53,7 @@ public class Commandr extends EssentialsCommand final CommandSender target = replyTo.getReplyTo(); final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME; - if (target == null) + if (target == null || ((target instanceof Player) && ((Player)target).isOnline())) { throw new Exception(_("foreverAlone")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java index aa2ed5567..6ccb3f7b6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; +import org.bukkit.event.entity.EntityDamageEvent; public class Commandsuicide extends EssentialsCommand @@ -15,9 +16,10 @@ public class Commandsuicide extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - user.setHealth(0); + EntityDamageEvent ede = new EntityDamageEvent(user, EntityDamageEvent.DamageCause.SUICIDE, 1000); + server.getPluginManager().callEvent(ede); + user.damage(1000); user.sendMessage(_("suicideMessage")); - ess.broadcastMessage(user, - _("suicideSuccess", user.getDisplayName())); + ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 0cece3310..2e3e024a3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -26,6 +26,11 @@ public class Commandtpaccept extends EssentialsCommand { throw new Exception(_("noPendingRequest")); } + + if (args.length > 0 && !target.getName().contains(args[0])) + { + throw new Exception(_("noPendingRequest")); + } long timeout = ess.getSettings().getTpaAcceptCancellation(); if (timeout != 0 && (System.currentTimeMillis() - user.getTeleportRequestTime()) / 1000 > timeout) diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 3ad4e3ce8..63770a293 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -157,6 +157,7 @@ player-commands: - xmpp # Note: All items MUST be followed by a quantity! +# All kit names should be lower case, and will be treated as lower in permissions/costs. # Times are measured in seconds. kits: tools: diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 7d8db28bb..0ec1ee6d9 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -348,7 +348,7 @@ commands: aliases: [etpaall] tpaccept: description: Accepts a teleport request. - usage: / + usage: / [otherplayer] aliases: [tpyes,etpaccept,etpyes] tpahere: description: Request that the specified player teleport to you.