1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-19 13:01:20 +02:00

Merge pull request #386 from gmfreaky/patch-1

Keep player orientation when teleporting
This commit is contained in:
KHobbits
2013-03-16 05:14:11 -07:00

View File

@@ -21,7 +21,8 @@ public class Commandtppos extends EssentialsCommand
final int x = Integer.parseInt(args[0]);
final int y = Integer.parseInt(args[1]);
final int z = Integer.parseInt(args[2]);
final Location location = new Location(user.getPlayer().getWorld(), x, y, z);
final Location playerLocation = user.getPlayer().getLocation();
final Location location = new Location(user.getPlayer().getWorld(), x, y, z, playerLocation.getYaw(), playerLocation.getPitch());
if (args.length > 3)
{
location.setYaw((Float.parseFloat(args[3]) + 180 + 360) % 360);
@@ -53,7 +54,8 @@ public class Commandtppos extends EssentialsCommand
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.getPlayer().getWorld(), x, y, z);
final Location playerLocation = user.getPlayer().getLocation();
final Location location = new Location(user.getPlayer().getWorld(), x, y, z, playerLocation.getYaw(), playerLocation.getPitch());
if (args.length > 4)
{
location.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360);