diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-04-02 02:47:10 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-04-02 02:47:44 +0100 |
commit | bf1e073ef4d5126b1122ad2bca05ffbc7af42359 (patch) | |
tree | 9dafc3d00cc65804d573f6544b8fbc97fd7293ca | |
parent | 767703bfc9107b05f413c129457c7c30f6833d7f (diff) | |
download | Essentials-bf1e073ef4d5126b1122ad2bca05ffbc7af42359.tar Essentials-bf1e073ef4d5126b1122ad2bca05ffbc7af42359.tar.gz Essentials-bf1e073ef4d5126b1122ad2bca05ffbc7af42359.tar.lz Essentials-bf1e073ef4d5126b1122ad2bca05ffbc7af42359.tar.xz Essentials-bf1e073ef4d5126b1122ad2bca05ffbc7af42359.zip |
Allow tppos to be used in console.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandtppos.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 226fa44e3..75910cd85 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.command.CommandSender; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -41,4 +42,30 @@ public class Commandtppos extends EssentialsCommand user.getTeleport().teleport(location, charge, TeleportCause.COMMAND); throw new NoChargeException(); } + + @Override + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 4) + { + throw new NotEnoughArgumentsException(); + } + + User user = ess.getUser(server.getPlayer(args[0])); + final int x = Integer.parseInt(args[1]); + final int y = Integer.parseInt(args[2]); + final int z = Integer.parseInt(args[3]); + final Location location = new Location(user.getWorld(), x, y, z); + if (args.length > 4) + { + location.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360); + } + if (args.length > 5) + { + location.setPitch(Float.parseFloat(args[5])); + } + sender.sendMessage(_("teleporting")); + user.sendMessage(_("teleporting")); + user.getTeleport().teleport(location, null, TeleportCause.COMMAND); + } }
\ No newline at end of file |