Plugin help

Discussion in 'Plugin Development' started by hostadam, Aug 25, 2017.

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

    hostadam

    I am currently working on a custom border plugin. I want it so whenever you run past the border it bounces you back a few blocks facing towards spawn. Currently the way I've coded it is using p.setVelocity(p.getLocation().getDirection().multiply(-2), but then if you walk backwards into the border you fly away. Any suggestions how I can make it?
     
  2. Offline

    Zombie_Striker

    @hostadam
    Instead of multiplying the direction the player is looking by -2, multiply their current velocity by -2. Also, since I do not know which method/event you are using for checking the player's location, make sure you only multiply the direction by -2 if the player is moving towards the boarder. If not, the player may be stick being forced going back-and-forth.
     
  3. Offline

    hostadam

    Thank you! <3

    I'm using like Math.abs(playerX > border || playerZ > border)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 26, 2017
Thread Status:
Not open for further replies.

Share This Page