Getting Started
First Step
If you want to create an addon for BedWars2023 make sure to use the following steps:
Add it as a softdepend in the plugin.yml:
softdepend: [BedWars2023]
Check if BedWars2023 is on the server:
@Override
public void onEnable() {
//Disable if plugin is not found
if (Bukkit.getPluginManager().getPlugin("BedWars2023") == null) {
getLogger().severe("BedWars2023 was not found. Disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
}Register your addon within BedWars2023 by extending the addon class. (This can be done within the main class or a separate class.)
public class BW2023 extends Addon {
@Override
public String getAuthor() {
//This gets the information directly from the plugin.yml file.
return Main.getInstance().getDescription().getAuthors().get(0);
}
@Override
public Plugin getPlugin() {
return Main.getInstance();
}
@Override
public String getVersion() {
return Main.getInstance().getDescription().getVersion();
}
@Override
public String getDescription() {
return Main.getInstance().getDescription().getDescription();
}
@Override
public String getName() {
return Main.getInstance().getDescription().getName();
}
@Override
public void load() {
Bukkit.getPluginManager().enablePlugin(Main.getInstance());
}
@Override
public void unload() {
Bukkit.getPluginManager().disablePlugin(Main.getInstance());
}
}In your main class, after getting the API methods, you need to register your addon.
BedWars bedwarsAPI = Bukkit.getServicesManager().getRegistration(BedWars.class).getProvider();
bedwarsAPI.getAddonsUtil().registerAddon(this);
Getting API Methods
Initializing the API:
BedWars bedwarsAPI = Bukkit.getServicesManager().getRegistration(BedWars.class).getProvider();
JavaDoc
Click here for JavaDocs.
Configuration
If you want to create a config file for your add-on, you should use the build-in config manager and create it in plugins/BedWars2023/Addons/{addonName}/config.yml
.