Moved too quickly

Discussion in 'Plugin Development' started by BasBloem, Apr 26, 2011.

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

    BasBloem

    Hi there,
    I'm working on a plugin which involves teleporting the player, but I keep getting the 'Moved too quickly error...'
    Is there any way I can fix this?
    I see other people making teleport plugins, so what's the trick? :|
    I tried to look for a variable to set the maximum allowed moving distance, but couldn't find it...

    Cheers!
     
  2. Offline

    Evenprime

    If you teleport a player from within a PLAYER_MOVE event, you'll have to do something like this to make it work correctly:

    Code:
    if(event.getPlayer().teleport(teleportTargetLocation)) {
    
        event.setTo(teleportTargetLocation);
        event.setFrom(teleportTargetLocation);
        event.setCancelled(true);
    }
    
    That means, if the teleport was successful, completely cancel the move event in every way possible.
     
  3. Offline

    BasBloem

    Great, thanks! I'll try some stuff :)

    EDIT:
    Too bad, that didn't work either :(

    EDIT2:
    Misread the code xD
    Works perfectly! :D Thanks ;)
     
Thread Status:
Not open for further replies.

Share This Page