-
Notifications
You must be signed in to change notification settings - Fork 0
Addons
Addons can be incredibly helpful to add to the MythBoard plugin, without having to make your own entire plugin!
An addon for MythBoard is a jar that simply implements the MythBoardAddon interface!
Instead of putting this jar in your plugins folder, you'll put it in plugins/MythBoard/addons
Each addon jar file (if structured correctly) in the addons folder, will be automatically loaded by MythBoard.
Don't want to read all this documentation? Rather learn by seeing an example?
I've got you covered, I've made an example here!
However, please remember to include the addon.properties file in your resources!
Step 1)
Add the MythBoard API to your project.
Follow this repository's README to add the API to your project!
Step 2)
Create a addon.properties file inside your resources!
This file only needs one line:
main=your.main.classExample
main=me.mantice.exampleaddon.ExampleAddonStep 3)
Create your addon's main class!
Do not extend JavaPlugin, as you're not making a full plugin!
Instead, you must implement MythBoardAddon!
public class ExampleAddon implements MythBoardAddon {
@Override
public boolean onEnable() {
return true;
}
@Override
public void onDisable() {
}
@Override
public String getId() {
return "";
}
@Override
public String getName() {
return "";
}
@Override
public String getAuthor() {
return "";
}
}onEnable is just like a plugin's onEnable. This will be called when your addon is enabled!
The difference here is, it returns a boolean. This is to tell the API if your addon was successfully enabled.
This is in case you have some dependencies or something that's required for your addon.
onDisable is just like a plugin's onDisable. This will be called to disable your addon.
Ensure you clean up anything you need, like un-registering any criteria you register.
getId simply returns the ID of your addon. This must be unique.
getName simply returns a display name of your addon. This does not need to be unique.
getAuthor simply returns the author of this addon, you should put your username here!
Once you're done creating your addon, all you have to do is build it and place it in plugins/MythBoard/addons!
Again, here's an example addon that registers an example criteria!