[SPIGOT-1729] Player.teleport command is rounded after VehicleExitEvent Created: 04/Mar/16 Updated: 02/Jul/22 Resolved: 02/Jul/22 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Werter | Assignee: | Doc |
Resolution: | Fixed | Votes: | 0 |
Labels: | teleport | ||
Environment: |
CraftBukkit version git-Spigot-b8f6402-a646500 |
Issue Links: |
|
Description |
the teleport(Location) function of Player is consistently off from where i attempt to teleport looks like its forcing it to int or something i try to teleport , for example, to 0.5 10 0.5 and it puts me at 0 10 0 |
Comments |
Comment by Werter [ 04/Mar/16 ] |
This can be reproduced like this: Listener on VehicleExitEvent teleports to an uneven Location and Player is teleported to rounded Coordinates: @EventHandler(priority = EventPriority.LOWEST) public void onVehicleExit(VehicleExitEvent e) { final Player player = (Player) e.getExited(); e.getExited().teleport(e.getVehicle().getLocation().add(1.2, 0, 1.2)); System.out.println("Location of Vehicle: " + e.getVehicle().getLocation()); System.out.println("Location Player is expected " + e.getVehicle().getLocation().add(1.2, 0, 1.2)); Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { public void run() { System.out.println("Location Player is really at " + player.getLocation()); } }, 5L); } output of that: Location of Vehicle:Location{world=CraftWorld{name=world},x=-1.5300206626858506,y=3.0,z=25.81147721686968,pitch=0.0,yaw=-40.836147} Location Player is expectedLocation{world=CraftWorld{name=world},x=-0.3300206626858506,y=3.0,z=27.01147721686968,pitch=0.0,yaw=-40.836147} Location Player is expectedLocation{world=CraftWorld{name=world},x=-0.5,y=3.2315237975870112,z=26.5,pitch=0.0,yaw=-40.836147} Tested in newest version of Spigot (1.9) |