I can't seem to get teleportation between worlds working. The player always ends up somewhere around the spawn instead of where I want them to go, and the console says the player moved wrongly. I have a 100% working nether portal plugin, except for this ghastly issue.
Are you triggering with onPlayerMove? If so, you need to change the from and to locations in the event. This means that the player move check thinks your player hasn't moved at all.
Yes and no. I use onPlayerMove to check if a player enters a portal, but from there I use the event schedular to create new threads to handle everything. Nothing happens for 3 seconds after the initial movement. --- merged: Feb 8, 2011 5:46 PM --- Okay - I even rewrote the plugin not to use any events at all - and it still says Player moved wrongly when I teleport a player to the nether...
It is a known bug, http://leaky.bukkit.org/issues/389 It might be possible to implement a work around by seeing what the move event actually changes.
If you update the Move Event To and From to the position you are teleporting the player (including world), you will not receive this warning and the player will teleport properly. Location exit = getExitForPortal(); event.setFrom(exit); event.setTo(exit); player.teleportTo(exit);
Great. I have a 100% working portal system (just like how Notch has it in SP), and have to sit on it because of this ridiculousness.
No, you don't have to wait. The code I mentioned above solves this problem. I wrote a working portal system (just like SP has) and I do not receive the invalid move errors you are talking about.
I guess I'm confused by your issue. In the same plugin I have that handles teleporting to the Nether via onPlayerMove() also has a command override for ops to teleport. In the onCommand() handler, I simply issue a player.teleportTo(loc);. I've only seen the Moved Wrongly error in the actual onPlayerMove event. Is there a need for using an event scheduler to delay the teleport? Or could you move the code into a move event and/or command.
Hello, I also got this error and I only call “teleportTo()” within “onPlayerCommand()” and “onBlockRightClick()”. So what I can do to fix this issue? Fabian
Is there a fix for this warning? I have no event object which I could modify so this work-around here is not applicable. Fabian
Code: if (player.getWorld() != teleportLocation.getWorld()) { player.teleportTo(teleportLocation.getWorld().getSpawnLocation()); player.teleportTo(teleportLocation); } else { player.teleportTo(teleportLocation); } It's ugly but should work.
@TheGurw : with teleporting between world it teleports you to the point you want, but then instantly moves you to the spawn, which that sudden movement is what causes the error and not the teleport, so good idea about teleporting to the spawn first and then teleporting to the actual location, then you'll avoid the problem altogether. That script should work, and you should really ad a delay between the teleports though, you might cause some problems trying to teleport when the player still might be in a tele.