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?
@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.
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.