From a75c65dbeb1eda2304e759a65d1f7eba0b5a241a Mon Sep 17 00:00:00 2001 From: jascotty2 Date: Sat, 7 Sep 2019 08:29:24 -0500 Subject: [PATCH] clean up guimanager reference --- .../java/com/songoda/ultimatestacker/UltimateStacker.java | 8 ++------ .../songoda/ultimatestacker/commands/CommandConvert.java | 7 +++++-- .../songoda/ultimatestacker/commands/CommandSettings.java | 7 +++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java b/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java index 1e072f0..b07a601 100644 --- a/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java +++ b/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java @@ -107,11 +107,11 @@ public class UltimateStacker extends SongodaPlugin { // Setup plugin commands this.commandManager = new CommandManager(this); this.commandManager.addCommand(new CommandUltimateStacker()) - .addSubCommand(new CommandSettings()) + .addSubCommand(new CommandSettings(guiManager)) .addSubCommand(new CommandRemoveAll()) .addSubCommand(new CommandReload()) .addSubCommand(new CommandGiveSpawner()) - .addSubCommand(new CommandConvert()); + .addSubCommand(new CommandConvert(guiManager)); this.entityUtils = new EntityUtils(); @@ -243,10 +243,6 @@ public class UltimateStacker extends SongodaPlugin { } } - public GuiManager getGuiManager() { - return guiManager; - } - @Override public List getExtraConfig() { return Arrays.asList(mobFile, itemFile, spawnerFile); diff --git a/src/main/java/com/songoda/ultimatestacker/commands/CommandConvert.java b/src/main/java/com/songoda/ultimatestacker/commands/CommandConvert.java index b1a2058..81fccc9 100644 --- a/src/main/java/com/songoda/ultimatestacker/commands/CommandConvert.java +++ b/src/main/java/com/songoda/ultimatestacker/commands/CommandConvert.java @@ -1,6 +1,7 @@ package com.songoda.ultimatestacker.commands; import com.songoda.core.commands.AbstractCommand; +import com.songoda.core.gui.GuiManager; import com.songoda.ultimatestacker.UltimateStacker; import com.songoda.ultimatestacker.gui.GUIConvert; import com.songoda.ultimatestacker.utils.Methods; @@ -13,9 +14,11 @@ import java.util.List; public class CommandConvert extends AbstractCommand { UltimateStacker instance; + GuiManager guiManager; - public CommandConvert() { + public CommandConvert(GuiManager guiManager) { super(true, "convert"); + this.guiManager = guiManager; instance = UltimateStacker.getInstance(); } @@ -23,7 +26,7 @@ public class CommandConvert extends AbstractCommand { protected ReturnType runCommand(CommandSender sender, String... args) { if (Bukkit.getPluginManager().isPluginEnabled("WildStacker") || Bukkit.getPluginManager().isPluginEnabled("StackMob")) { - instance.getGuiManager().showGUI((Player) sender, new GUIConvert()); + guiManager.showGUI((Player) sender, new GUIConvert()); } else { sender.sendMessage(Methods.formatText("&cYou need to have the plugin &4WildStacker &cor &4StackMob &cenabled " + "in order to convert data.")); diff --git a/src/main/java/com/songoda/ultimatestacker/commands/CommandSettings.java b/src/main/java/com/songoda/ultimatestacker/commands/CommandSettings.java index 23df581..99bab0e 100644 --- a/src/main/java/com/songoda/ultimatestacker/commands/CommandSettings.java +++ b/src/main/java/com/songoda/ultimatestacker/commands/CommandSettings.java @@ -2,6 +2,7 @@ package com.songoda.ultimatestacker.commands; import com.songoda.core.commands.AbstractCommand; import com.songoda.core.configuration.editor.PluginConfigGui; +import com.songoda.core.gui.GuiManager; import com.songoda.ultimatestacker.UltimateStacker; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -11,15 +12,17 @@ import java.util.List; public class CommandSettings extends AbstractCommand { UltimateStacker instance; + GuiManager guiManager; - public CommandSettings() { + public CommandSettings(GuiManager guiManager) { super(true, "Settings"); + this.guiManager = guiManager; instance = UltimateStacker.getInstance(); } @Override protected ReturnType runCommand(CommandSender sender, String... args) { - instance.getGuiManager().showGUI((Player) sender, new PluginConfigGui(instance)); + guiManager.showGUI((Player) sender, new PluginConfigGui(instance)); return ReturnType.SUCCESS; }