Merge branch 'master' into release

This commit is contained in:
KHobbits 2012-01-29 05:00:04 +00:00
commit 5a7f38fa29
7 changed files with 35 additions and 32 deletions

View file

@ -31,7 +31,7 @@ public class Commandkill extends EssentialsCommand
continue; continue;
} }
matchPlayer.setHealth(0); matchPlayer.damage(1000);
sender.sendMessage(_("kill", matchPlayer.getDisplayName())); sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
} }
} }

View file

@ -23,12 +23,6 @@ public class Commandnear extends EssentialsCommand
User otherUser = null; User otherUser = null;
if (args.length > 0) if (args.length > 0)
{
try
{
otherUser = getPlayer(server, args, 0);
}
catch (Exception ex)
{ {
try try
{ {
@ -36,7 +30,12 @@ public class Commandnear extends EssentialsCommand
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
try
{
otherUser = getPlayer(server, args, 0);
} }
catch (Exception ex)
{
} }
} }
if (args.length > 1 && otherUser != null) if (args.length > 1 && otherUser != null)
@ -49,6 +48,7 @@ public class Commandnear extends EssentialsCommand
{ {
} }
} }
}
if (otherUser == null || user.isAuthorized("essentials.near.others")) if (otherUser == null || user.isAuthorized("essentials.near.others"))
{ {
user.sendMessage(_("nearbyPlayers", getLocal(server, otherUser == null ? user : otherUser, radius))); user.sendMessage(_("nearbyPlayers", getLocal(server, otherUser == null ? user : otherUser, radius)));
@ -62,16 +62,11 @@ public class Commandnear extends EssentialsCommand
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{ {
if (args.length == 0)
User otherUser = null;
if (args.length > 0)
{
otherUser = getPlayer(server, args, 0);
}
else
{ {
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
final User otherUser = getPlayer(server, args, 0);
long radius = 200; long radius = 200;
if (args.length > 1) if (args.length > 1)
{ {

View file

@ -53,7 +53,7 @@ public class Commandr extends EssentialsCommand
final CommandSender target = replyTo.getReplyTo(); final CommandSender target = replyTo.getReplyTo();
final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME; 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")); throw new Exception(_("foreverAlone"));
} }

View file

@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.event.entity.EntityDamageEvent;
public class Commandsuicide extends EssentialsCommand public class Commandsuicide extends EssentialsCommand
@ -15,9 +16,10 @@ public class Commandsuicide extends EssentialsCommand
@Override @Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception 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")); user.sendMessage(_("suicideMessage"));
ess.broadcastMessage(user, ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName()));
_("suicideSuccess", user.getDisplayName()));
} }
} }

View file

@ -27,6 +27,11 @@ public class Commandtpaccept extends EssentialsCommand
throw new Exception(_("noPendingRequest")); throw new Exception(_("noPendingRequest"));
} }
if (args.length > 0 && !target.getName().contains(args[0]))
{
throw new Exception(_("noPendingRequest"));
}
long timeout = ess.getSettings().getTpaAcceptCancellation(); long timeout = ess.getSettings().getTpaAcceptCancellation();
if (timeout != 0 && (System.currentTimeMillis() - user.getTeleportRequestTime()) / 1000 > timeout) if (timeout != 0 && (System.currentTimeMillis() - user.getTeleportRequestTime()) / 1000 > timeout)
{ {

View file

@ -157,6 +157,7 @@ player-commands:
- xmpp - xmpp
# Note: All items MUST be followed by a quantity! # 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. # Times are measured in seconds.
kits: kits:
tools: tools:

View file

@ -348,7 +348,7 @@ commands:
aliases: [etpaall] aliases: [etpaall]
tpaccept: tpaccept:
description: Accepts a teleport request. description: Accepts a teleport request.
usage: /<command> usage: /<command> [otherplayer]
aliases: [tpyes,etpaccept,etpyes] aliases: [tpyes,etpaccept,etpyes]
tpahere: tpahere:
description: Request that the specified player teleport to you. description: Request that the specified player teleport to you.