Hi, I want that when a player (Minecraft) is thrown too far from a certain block in the direction of the block (Velocity). Unfortunately I don't know how to do this!
There's a method setVelocity (Vector) of the class Player. All you have to do is calculate the vector and use it with it.
I don't exactly know how to calculate the vector.
If the player looks in the direction of the block I can take his direction times -1 but if he walks in the reverse value it's the direction and I don't know how to implement it
I haven't tried it, but it doesn't have to be done with a multiple of the difference between the block and the player
Event.getPlayer (). SetVelocity (location.getDirection (). Subtract (location.toVector ()). Add (new Vector (0, 10, 0;
No, I don't have either Spigot or Minecraft on my PC, so I can't test anything… But something like that could work
player.setVelocity ((player.getLocation (). ToVector (). Subtract (block.getLocation (). ToVector ()). Multiply (x