Knockback effect / velocity
How do i implement a feature on my server that knockbacks players on command?
7 Replies
Thanks for asking your question!
Once you have finished, please close your thread.
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
command to close
/close
!close
!solved
Requested by bambizo#0
For example if a player steps on the diamond block, he would be launched forward
https://www.spigotmc.org/resources/custom-jumppads-1-8-1-19.44876/ would probably be a better option
SpigotMC - High Performance Minecraft
Custom Jumppads | [1.8 - 1.19]
You know how to register a command and implement it in a bukkit plugin?
If so, make sure that the argument length of the command is 1. The argument is the name of the player you want to knock back. To get the player instance, use "Bukkit.getPlayer(args[0])" and check the returned value for null. If the value is != null, then you can take this player instance and use the setVelocity(Vector vec) method. You can either determine the vector with fixed values or set it dynamically with your or the player's look direction (or some other vector)
If you want to implement the whole thing with a diamond block, then listen to the PlayerMoveEvent, check whether the player stands on a diamond block and set the velocity of the triggering player via setVelocity(Vector vec)
Ok, well not exaclty jump pads
And no, i've never done it. To be more specific, I need to implement a feature where a player is knocked back on command, so lets a player has a menu open, aand when clicking on one of the items, he would be launched / knocked in a specific direction.
That's kind of specific, so it will be difficult to find an already developed plugin either... Difficult when you never did something like that yourself I guess. But do you have Java knowledge?
Ok, i guess ill look into it later. Seems like a difficult work