mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 08:47:35 +01:00
Add yaw and rotation to default TeleportCommand. Fixes BUKKIT-2774
By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
parent
c5eaa31741
commit
7d31c12b25
@ -55,20 +55,24 @@ public class TeleportCommand extends VanillaCommand {
|
||||
return true;
|
||||
}
|
||||
player.teleport(target, TeleportCause.COMMAND);
|
||||
Command.broadcastCommandMessage(sender, "Teleported " + player.getName() + " to " + target.getName());
|
||||
Command.broadcastCommandMessage(sender, "Teleported " + player.getDisplayName() + " to " + target.getDisplayName());
|
||||
} else if (player.getWorld() != null) {
|
||||
double x = getCoordinate(sender, player.getLocation().getX(), args[args.length - 3]);
|
||||
double y = getCoordinate(sender,player.getLocation().getY(), args[args.length - 2], 0, 0);
|
||||
double z = getCoordinate(sender, player.getLocation().getZ(), args[args.length - 1]);
|
||||
Location playerLocation = player.getLocation();
|
||||
double x = getCoordinate(sender, playerLocation.getX(), args[args.length - 3]);
|
||||
double y = getCoordinate(sender, playerLocation.getY(), args[args.length - 2], 0, 0);
|
||||
double z = getCoordinate(sender, playerLocation.getZ(), args[args.length - 1]);
|
||||
|
||||
if (x == MIN_COORD_MINUS_ONE || y == MIN_COORD_MINUS_ONE || z == MIN_COORD_MINUS_ONE) {
|
||||
sender.sendMessage("Please provide a valid location!");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location location = new Location(player.getWorld(), x, y, z);
|
||||
player.teleport(location);
|
||||
Command.broadcastCommandMessage(sender, "Teleported " + player.getName() + " to " + + x + "," + y + "," + z);
|
||||
playerLocation.setX(x);
|
||||
playerLocation.setY(y);
|
||||
playerLocation.setZ(z);
|
||||
|
||||
player.teleport(playerLocation);
|
||||
Command.broadcastCommandMessage(sender, String.format("Teleported %s to %.2f, %.2f, %.2f", player.getDisplayName(), x, y, z));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user