teleport cooldown

Discussion in 'Plugin Development' started by creppii, Jul 28, 2014.

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

    creppii

    hey

    i did a command /spawn which teleports you after a 5 seconds cooldown to the spawn. if you walk in that 5 seconds, teleport will cancel... but i want, that if you type spawn, you can watch around, jump, but not walk! how can i do this?

    what i have at the moment is, if you type spawn u have to stand still in that 5 seconds... if u watch just a little around, teleport will cancel..

    if some1 type /spawn, i save playername and location in a hasmap and then i check at PlayerMoveEvent if the player is in hashmap. if yes, i get the position of the player and check with the position in hashmap... if position in hasmap equal to current position nothing happens, thats good, but if he look around the position isnt equal :$

    thx for help and i hope u understand it ^^
    if u don't, ask!
     
  2. Offline

    GameplayJDK

    creppii That requires a few lines of code:
    Let me explain that quickly: You have to listen fo player movement and have to check the hashmap, but only, if the event.getFrom().getX() or getZ() is not equal event.getTo().getX() or getZ(). That allows the player to jump, look around and sneak without cancelling the teleport as long as he does not touch his wasd keys :D
     
    creppii likes this.
  3. Offline

    creppii

    GameplayJDK im not at my computer, but i will test it tomorrow ^^ i know what u mean and i think that could work haha :b thx a lot and have a nice day :)
     
  4. Offline

    GameplayJDK

    creppii You're welcome :)
    Btw: I've used this method before and it is working well
     
  5. Offline

    creppii

    GameplayJDK ah du bist deutsch ^^ haha hast du skype?
     
Thread Status:
Not open for further replies.

Share This Page