summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNecrodoom <doomed.war@gmail.com>2014-07-04 17:11:27 +0300
committerKHobbits <rob@khobbits.co.uk>2014-07-06 18:41:01 +0100
commit52f0dd91492479bb2d43c6d4c1052b5b1cf341f5 (patch)
tree6bbbc9267b49d47f0ee856917e7942fb19b6bb66
parent58bc6116de3a3059c45b6cb8026f05e98f499698 (diff)
downloadEssentials-52f0dd91492479bb2d43c6d4c1052b5b1cf341f5.tar
Essentials-52f0dd91492479bb2d43c6d4c1052b5b1cf341f5.tar.gz
Essentials-52f0dd91492479bb2d43c6d4c1052b5b1cf341f5.tar.lz
Essentials-52f0dd91492479bb2d43c6d4c1052b5b1cf341f5.tar.xz
Essentials-52f0dd91492479bb2d43c6d4c1052b5b1cf341f5.zip
Add support for vanilla /tp <x> <y> <z> teleport syntax.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index c352f217f..a4d94bcde 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -40,6 +40,22 @@ public class Commandtp extends EssentialsCommand
charge.isAffordableFor(user);
user.getTeleport().teleport(player.getBase(), charge, TeleportCause.COMMAND);
throw new NoChargeException();
+ case 3:
+ final double x2 = args[0].startsWith("~") ? user.getLocation().getX() + Integer.parseInt(args[0].substring(1)) : Integer.parseInt(args[0]);
+ final double y2 = args[1].startsWith("~") ? user.getLocation().getY() + Integer.parseInt(args[1].substring(1)) : Integer.parseInt(args[1]);
+ final double z2 = args[2].startsWith("~") ? user.getLocation().getZ() + Integer.parseInt(args[2].substring(1)) : Integer.parseInt(args[2]);
+ if (x2 > 30000000 || y2 > 30000000 || z2 > 30000000 || x2 < -30000000 || y2 < -30000000 || z2 < -30000000)
+ {
+ throw new NotEnoughArgumentsException(tl("teleportInvalidLocation"));
+ }
+ final Location loc2 = new Location(user.getWorld(), x2, y2, z2, user.getLocation().getYaw(), user.getLocation().getPitch());
+ if (!user.isTeleportEnabled())
+ {
+ throw new Exception(tl("teleportDisabled", user.getDisplayName()));
+ }
+ user.getTeleport().now(loc2, false, TeleportCause.COMMAND);
+ user.sendMessage(tl("teleporting", loc2.getWorld().getName(), loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ()));
+ break;
case 4:
if (!user.isAuthorized("essentials.tp.others"))
{