Adding Booster Hooks
What is a booster hook?
It is the base of all boosters, this is what you can add to a booster configuration file (also known as Booster Type)
More information: Explanation of Some Words
How to add your own booster hook?
Next, you will have to create a class that implements com.artillexstudios.axboosters.hooks.booster.BoosterHook
.
I will also implement the Listener class, because we want to boost XP gained.
Next, you will have to register the hook! (instance
should be your main class' instance) You can only load booster hooks right when the plugin is being loaded, so make sure to listen to the AxBoostersLoadEvent event.
Make sure to register the listener, you should set up the listener in your onEnable() method, so it works right when your plugin loads, this is very important!
And If this is done, restart the server and you can use the booster, using the name specified:
You can also customize some other stuff in the plugins/AxBoosters/hooks.yml
file, your hook should be automatically added if it was registered successfully.
That's all! Just start the server and everything should work! Activate the booster and test it: /axboosteradmin activateserver <BOOSTER TYPE> 100 10m
(this command starts +100% global server booster for 10 minutes, you can use other commands)
Full example source code
This is not the same as in the tutorial below, however it should help if you need further help!
Link: https://github.com/Artillex-Studios/AxBoostersExampleHook