mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-05 23:11:48 +01:00
Merge branch 'master' into release
This commit is contained in:
commit
5a7f38fa29
@ -31,7 +31,7 @@ public class Commandkill extends EssentialsCommand
|
||||
continue;
|
||||
}
|
||||
|
||||
matchPlayer.setHealth(0);
|
||||
matchPlayer.damage(1000);
|
||||
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -348,7 +348,7 @@ commands:
|
||||
aliases: [etpaall]
|
||||
tpaccept:
|
||||
description: Accepts a teleport request.
|
||||
usage: /<command>
|
||||
usage: /<command> [otherplayer]
|
||||
aliases: [tpyes,etpaccept,etpyes]
|
||||
tpahere:
|
||||
description: Request that the specified player teleport to you.
|
||||
|
Loading…
Reference in New Issue
Block a user