Repository navigation
Knockback Profiles
Knockback profiles are collections of values for how to apply knockback to players. They can be configured in the profiles.yml file in the plugin directory.
Knockback profiles can be created in the plugin's profiles.yml configuration file.
Here is an example profile:
example:
base:
horizontal: 0.4
vertical: 0.4
sprint-bonus:
horizontal: 0.5
vertical: 0.1
knockback-enchantment-bonus:
horizontal: 0.5
vertical: 0.05
pre-multiplier:
horizontal: 0.5
vertical: 0.5
limit:
vertical: 0.5
fishing_hook:
base:
horizontal: 0.4
vertical: 0.5Here's an explanation of the settings:
- The
examplekey at the beginning is the profile name. It is used in order to reference the profile in the API and commands.-
base: This is the base knockback, and is the first thing the plugin uses to calculate knockback. It adds velocity to the victim pushing them away from the attacker. -
sprint-bonus: This is a bonus applied if the attacker is sprinting when they hit the victim. It is applied to the victim based on the direction the attacker is facing. Keep in mind that the server stops considering players sprinting after they hit an entity, and players will need to start sprinting again for this bonus to apply. -
knockback-enchantment-bonus: This is a bonus applied for each level of the knockback enchantment on the weapon the attacker is holding. It is applied to the victim based on the direction the attacker is facing. -
pre-multiplier: This is the multiplier to apply to the victim's pre-existing server velocity. This is the equivalent of thefrictionsetting in PandaSpigot's built-in knockback configuration, except acting as a multiplier. -
limit: This clamps the resulting velocity (excluding bonuses) to be no greater than the specified value. -
fishing_hook: This is an example of how you can customize knockback depending on the attacker entity type. Inside of this value, you can use any of the above settings to customize how much knockback will be applied to the victim. Any settings not specified will be inherited from the settings for all attacker types. You can create settings for any entity type, not just fishing hooks. Some examples aresnowball,zombie,egg, andarrow.
-
The plugin also features the ability to set values on profiles using a command, making it easy to test values and find out your preferred settings. You can use /pandaknockback editprofile <profile> <setting> [value] to set a value on a profile.
As an example; to set the base horizontal knockback on a profile named "default" to 1, you can use the following command: /pandaknockback editprofile default base.horizontal 1
To see the current value of a setting, you can leave out the value argument when executing the command.
You can also use the min-max value syntax to set a setting to a value which will generate a uniformly distributed value every time it is retrieved.
Here is an example profile that uses a random base horizontal knockback value between 0.1 and 0.5:
example:
base:
horizontal: 0.1-0.5After you've created a profile, it needs to be applied before it takes effect on players.
You can set the default-profile setting in the config.yml configuration file to set a profile to take effect on all players if they don't have another profile explicitly set.
If the server has WorldGuard installed, it is possible to use the knockback-profile region flag to set a knockback profile that is applied to players when they are inside a region. To set the flag, use the /rg flag <region> knockback-profile <profile> command.
The plugin has a command to apply a profile to players manually: /pandaknockback applyprofile <player> <profile>
This command will apply a profile to the specified player, and will stay applied until they log out.
Other plugins are able to interact with PandaKnockback to set a player's profile programmatically. See the API Page for more details. If you are a developer, consider that you can execute the command in your plugin to apply profiles as well without depending on PandaKnockback.