summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-04-02 02:47:10 +0100
committerKHobbits <rob@khobbits.co.uk>2012-04-02 02:47:44 +0100
commit5e936523f5ca92af2711e64149895c772d2b0fbe (patch)
treede8845a8a4e4aa94141056b040f4b63dc919730c
parentf0f6747082b9fa372180546a8187c1eac4345e88 (diff)
downloadEssentials-5e936523f5ca92af2711e64149895c772d2b0fbe.tar
Essentials-5e936523f5ca92af2711e64149895c772d2b0fbe.tar.gz
Essentials-5e936523f5ca92af2711e64149895c772d2b0fbe.tar.lz
Essentials-5e936523f5ca92af2711e64149895c772d2b0fbe.tar.xz
Essentials-5e936523f5ca92af2711e64149895c772d2b0fbe.zip
Allow tppos to be used in console.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtppos.java27
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