diff --git a/src/me/tychsen/enchantgui/EshopConfig.java b/src/me/tychsen/enchantgui/EshopConfig.java index a859afd..000b7c0 100644 --- a/src/me/tychsen/enchantgui/EshopConfig.java +++ b/src/me/tychsen/enchantgui/EshopConfig.java @@ -9,8 +9,8 @@ public class EshopConfig { private JavaPlugin plugin; private FileConfiguration config; - public EshopConfig(JavaPlugin plugin) { - this.plugin = plugin; + public EshopConfig() { + this.plugin = Main.getInstance(); config = plugin.getConfig(); } diff --git a/src/me/tychsen/enchantgui/EshopEventManager.java b/src/me/tychsen/enchantgui/EshopEventManager.java index e79b5d7..bd80546 100644 --- a/src/me/tychsen/enchantgui/EshopEventManager.java +++ b/src/me/tychsen/enchantgui/EshopEventManager.java @@ -14,8 +14,8 @@ public class EshopEventManager { private EshopSystem esys; /* Constructor */ - public EshopEventManager(JavaPlugin plugin) { - esys = new EshopSystem(plugin); + public EshopEventManager() { + esys = new EshopSystem(); } /* Public methods */ diff --git a/src/me/tychsen/enchantgui/EshopSystem.java b/src/me/tychsen/enchantgui/EshopSystem.java index de45d9a..5bdb715 100644 --- a/src/me/tychsen/enchantgui/EshopSystem.java +++ b/src/me/tychsen/enchantgui/EshopSystem.java @@ -23,13 +23,13 @@ public class EshopSystem { private EshopConfig config; private EshopVault vault; - public EshopSystem(JavaPlugin plugin) { + public EshopSystem() { playerNavigation = new HashMap<>(); inventorySize = 36; enchants = new EshopEnchants(); permsys = new EshopPermissionSys(); - config = new EshopConfig(plugin); - vault = new EshopVault(plugin); + config = new EshopConfig(); + vault = new EshopVault(); } public void showMainMenu(Player p) { diff --git a/src/me/tychsen/enchantgui/EshopVault.java b/src/me/tychsen/enchantgui/EshopVault.java index 5dc9565..258eb28 100644 --- a/src/me/tychsen/enchantgui/EshopVault.java +++ b/src/me/tychsen/enchantgui/EshopVault.java @@ -10,8 +10,8 @@ public class EshopVault { private Economy econ = null; private JavaPlugin plugin; - public EshopVault(JavaPlugin plugin) { - this.plugin = plugin; + public EshopVault() { + this.plugin = Main.getInstance(); if (!setupEconomy()) { plugin.getLogger().severe("Dependency (Vault) not found. Disabling the plugin!"); diff --git a/src/me/tychsen/enchantgui/Main.java b/src/me/tychsen/enchantgui/Main.java index 40a8995..5f642fa 100644 --- a/src/me/tychsen/enchantgui/Main.java +++ b/src/me/tychsen/enchantgui/Main.java @@ -11,14 +11,16 @@ import java.io.IOException; public class Main extends JavaPlugin implements Listener { + public static Main instance; private EshopEventManager eshop; @Override public void onEnable() { + instance = this; getLogger().info("Loading configs and stuff..."); getServer().getPluginManager().registerEvents(this, this); - eshop = new EshopEventManager(this); + eshop = new EshopEventManager(); // Generate config.yml if there is none saveDefaultConfig(); @@ -32,6 +34,10 @@ public void onEnable() { } } + public static Main getInstance() { + return instance; + } + @EventHandler public void onInventoryClickEvent(InventoryClickEvent e) { if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)