From b70d0ceed6ab9e6cba91f7d9e3bcb46477845cc8 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 14 Aug 2016 14:43:23 +0200 Subject: [PATCH] Added plugin API, WIP --- src/buttondevteam/MainPlugin.java | 21 ++++++++++++++------- src/buttondevteam/core/TBMCPluginsAPI.java | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 src/buttondevteam/core/TBMCPluginsAPI.java diff --git a/src/buttondevteam/MainPlugin.java b/src/buttondevteam/MainPlugin.java index 35c12c8..7dc3b30 100644 --- a/src/buttondevteam/MainPlugin.java +++ b/src/buttondevteam/MainPlugin.java @@ -2,6 +2,7 @@ package buttondevteam; import java.util.logging.Logger; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; @@ -9,36 +10,42 @@ import buttondevteam.alisolarflare.aliarrow.AliArrowSubPlugin; import buttondevteam.core.CoreSubPlugin; public class MainPlugin extends JavaPlugin { + public static MainPlugin Instance; + private PluginDescriptionFile pdfFile; private Logger logger; private AliArrowSubPlugin aliArrowSubPlugin; private CoreSubPlugin playerSubPlugin; - public void onEnable(){ - //Logs "Plugin Enabled", registers commands + public void onEnable() { + // Logs "Plugin Enabled", registers commands + Instance = this; pdfFile = getDescription(); logger = getLogger(); - logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ")."); + logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion() + ")."); registerSubPlugins(); registerCommands(); registerEvents(); - logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion()+ ")."); + logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion() + ")."); } + private void registerSubPlugins() { aliArrowSubPlugin = new AliArrowSubPlugin(this); aliArrowSubPlugin.register(); playerSubPlugin = new CoreSubPlugin(this); playerSubPlugin.register(); } + private void registerCommands() { // TODO Auto-generated method stub - + } + private void registerEvents() { // TODO Auto-generated method stub - + } - + } diff --git a/src/buttondevteam/core/TBMCPluginsAPI.java b/src/buttondevteam/core/TBMCPluginsAPI.java new file mode 100644 index 0000000..f8a7cfc --- /dev/null +++ b/src/buttondevteam/core/TBMCPluginsAPI.java @@ -0,0 +1,16 @@ +package buttondevteam.core; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.plugin.Plugin; + +public final class TBMCPluginsAPI { + private static List plugins = new ArrayList<>(); //TODO: Automatically load + + public static boolean UpdatePlugin(String name) { + + } + + public static List GetPluginNames() +}