Player moved wrongly.

Discussion in 'Plugin Development' started by Afforess, Feb 8, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Afforess

    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.
     
  2. Offline

    Raphfrk

    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.
     
  3. Offline

    Afforess

    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...
     
  4. Offline

    Raphfrk

  5. Offline

    FelTiatix

    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);
     
  6. Offline

    Afforess

    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.
     
  7. Offline

    FelTiatix

    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.
     
  8. Offline

    Afforess

    Not if I don't use a onPlayerMoveEvent. My plugin has no events of any kind.
     
  9. Offline

    FelTiatix

    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.
     
  10. Offline

    xZise

    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
     
  11. Offline

    xZise

    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
     
  12. Offline

    TheGurw

    Code:
    if (player.getWorld() != teleportLocation.getWorld()) {
    player.teleportTo(teleportLocation.getWorld().getSpawnLocation());
    player.teleportTo(teleportLocation);
    }
    else {
    player.teleportTo(teleportLocation);
    }


    It's ugly but should work.
     
  13. Offline

    DreadKyller

    @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.
     
Thread Status:
Not open for further replies.

Share This Page