Knockback
Before using this API, you have to know that the knockback system of ImanitySpigot3 is unique and a bit more complexe than the others, BUT is for sure the more powerful and give you unlimited possibilities of knockback profiles.
This is advised to learn how this knockback system work before using the API: ImanityKnockback Documentation
KnockbackService
You can get the KnockbackService that give you a large amount of methods to manage the knockback profiles on your server. This can be very useful for a lot of game mode like Practice server.
Bukkit#imanity()#getKnockbackService()
All Methods
boolean #isInitialized()
- is KnockbackService initializedKnockback #getKnockback(Player player)
- get player's current knockback profilevoid #setKnockback(Player player, Knockback knockback)
- set specific knockback profile for playerFile #getFileForKnockback(Knockback knockback)
- get Json File for Knockback profile, It will pick a file name based on knockback name within '/imanity/knockback'. for example if knockback were called 'example', the file will be ' /imanity/knockback/example.json'KnockbackBehaviourDescription #getRegisteredBehaviourByName(String name)
- get Registered behaviour description by name<T extends KnockbackBehaviour> T #createBehaviourByName(String name)
- Create an instance by behaviour namevoid #registerBehaviour(Plugin plugin, String name, KnockbackBehaviourDescription knockbackBehaviour)
- Register a behaviour so it can be found in both APIs and commandsvoid #unregisterBehaviour(String name)
- Unregister a behaviour by namevoid #unregisterBehaviour(KnockbackBehaviour knockbackBehaviour)
- Unregister behaviour by behaviour instancevoid #unregisterAllBehavioursByPlugin(Plugin plugin)
- Unregistering all behaviours registered by the target pluginCollection<KnockbackBehaviourDescription> #getAllKnockbackBehaviours()
- get All knockback behaviours that has been registeredKnockback #getKnockbackByName(String name)
- get knockback Profile by Namevoid #registerKnockback(Plugin plugin, Knockback knockback)
- register a Knockback Profilevoid #unregisterKnockback(Knockback knockback)
- Unregistering a knockback profilevoid #unregisterAllKnockbackByPlugin(Plugin plugin)
- Unregistering All Knockback Profiles registered by target PluginKnockback #getRandomKnockback(World world)
- get Default Knockback based on configurations by the World. This will first search if there is any valid knockback from world. If not, it will search by default configuration. finally, if still not valid, it will return vanilla knockback profile.Collection<Knockback> #getAllKnockback()
- get All Knockback Profilesvoid #registerModifier(Plugin plugin, String name, KnockbackValueModifierDescription knockbackModifier)
- Register a modifier so it can be found in both APIs and commandsKnockbackValueModifierDescription #getRegisteredModifierByName(String name)
- get Registered modifier description by name<T> KnockbackValueModifier<T> #createModifierByName(String name)
- Create an instance by modifier namevoid #unregisterModifier(String name)
- Unregister a modifier by namevoid #unregisterAllModifiersByPlugin(Plugin plugin)
- Unregistering all modifiers registered by the target pluginCollection<KnockbackValueModifierDescription> #getAllModifiers()
- get All knockback modifiers that has been registeredCollection<KnockbackEntity> #getAllKnockbackEntities(Knockback knockback)
- get All Knockback Entities that applied with target knockback profileboolean #reload()
- Reload every knockback profile that is based on file from their own files
Class: dev.imanity.knockback.api.KnockbackService
Knockback
String #getName()
- get the Name of the knockbackvoid #setName(String name)
- set the Name of the knockbackFile #getFile()
- get the File of the knockbackvoid #setFile(File file)
- set the File of the knockbackPlugin #getOwningPlugin()
- get the owner pluginvoid #setOwningPlugin(Plugin plugin)
- set the owner pluginList<KnockbackBehaviour> #getBehaviours()
- get List of Behaviours in the knockback profileboolean #loadFromJson()
- Load all behaviour and values from json file. This should not be executed if there wasn't a file to loadvoid #save()
- Save the knockback profile to Json File. This should not be executed if there wasn't a file to saveJsonObject #toJsonObject()
- store data of the knockback profile to jsonvoid #addBehaviour(String id, KnockbackBehaviour behaviour)
- Add behaviour to the knockback profileKnockbackBehaviour #getBehaviour(String id)
- get Behaviour by ID<T> T #getBehaviourByType(Class<T> type)
- get Behaviour by Class Typevoid removeBehaviour(KnockbackBehaviour behaviour)
- Remove specific behaviour from the knockback profile
Class: dev.imanity.knockback.api.Knockback
KnockbackBuilder
You can easily create a knockack profile thanks to the KnockBackBuilder.
All Methods
KnockbackBuilder #name(String name)
KnockbackBuilder #behaviour(String id, KnockbackBehaviour behaviour)
KnockbackBuilder #behaviour(String id, String type, int priority)
KnockbackBuilder #behaviour(String id, String type, int priority, Consumer<T> onCreate)
Knockback #build()
Class: dev.imanity.knockback.api.KnockbackBuilder