[SPIGOT-166] Player.teleport command is rounded Created: 09/Dec/14  Updated: 04/Mar/16  Resolved: 09/Dec/14

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Intangir Assignee: Thinkofname
Resolution: Cannot Reproduce Votes: 0
Labels: teleport
Environment:

CraftBukkit version git-Spigot-b8f6402-a646500


Issue Links:
Cloners
is cloned by SPIGOT-1729 Player.teleport command is rounded af... Resolved

 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 [ 01/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)

Comment by Intangir [ 09/Dec/14 ]

its citizens2

Comment by Intangir [ 09/Dec/14 ]

someone close this.. it must be one of the other mods

i ran it with just my mods and it didn't do it..

maybe no cheat plus or something

Comment by Intangir [ 09/Dec/14 ]

what version are you on? when did you update last?

when you get out of the chair it doesn't round your position?

Comment by Thinkofname [ 09/Dec/14 ]

Seems fine with that one too

Comment by Intangir [ 09/Dec/14 ]

Ive noticed it on 3 separate plugins, all of them are using the same function

one teleports you over your vehicle when you get out
one teleports you to where you were standing when you get up from a chair
and one teleports you upto a spawn point

all three are on the corners now, and none were before

i did a fresh upto-date build to see if that fixed it, but it didn't

Comment by Thinkofname [ 09/Dec/14 ]

I used a plugin, i'll try with that plugin in a bit

Comment by Intangir [ 09/Dec/14 ]

did you use a command or a plugin?

im talking about the Player class, teleport function (with Location arg)

can you try chairs reloaded and see if it returns you to your previous location when you get off of a chair (stair)

Comment by Thinkofname [ 09/Dec/14 ]

Teleporting to -3.5, 209.5, -2.5 worked for me http://i.imgur.com/dd5M5TA.png

Comment by Intangir [ 09/Dec/14 ]

heres another mod that is effected:
http://dev.bukkit.org/bukkit-plugins/chairsreloaded/

used to be it would teleport you back to exactly where you were before you sat down, now it doesn't (puts you on the nearby corner)

Comment by Intangir [ 09/Dec/14 ]

using the same code from 1.7.2 through 1.7.10 (on spigot) to correct vehicle dismount position, and to do some custom warping
now it is offset, my code hasn't changed

another example, teleporting to x=-3.5,y=209.5,z=-2.5
put me at -4 211 -3 (ontop of something normally i would be next to, not sure if Y change was because blocks where in the way)

Comment by Intangir [ 09/Dec/14 ]

you can literally do player.teleport(player.getLocation()) and it will move you to a nearby block corner

Generated at Sat Apr 05 07:14:52 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.