From 54f0b9975665170ec80974943e46e8ddddb2a66f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 21 Apr 2016 11:41:16 +1000 Subject: [PATCH] Add fountain gui command --- .../core/brawl/fountain/Fountain.java | 16 +++++++++++- .../core/brawl/fountain/FountainManager.java | 7 ++++-- .../fountain/command/FountainCommand.java | 1 + .../brawl/fountain/command/GuiCommand.java | 25 +++++++++++++++++++ .../core/brawl/fountain/gui/FountainPage.java | 3 +-- .../core/brawl/fountain/gui/FountainShop.java | 12 ++++++++- .../src/mineplex/hub/HubManager.java | 2 +- 7 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/GuiCommand.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/Fountain.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/Fountain.java index 319b37420..eea7a4146 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/Fountain.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/Fountain.java @@ -1,6 +1,9 @@ package mineplex.core.brawl.fountain; +import mineplex.core.account.CoreClientManager; +import mineplex.core.brawl.fountain.gui.FountainShop; import mineplex.core.common.util.UtilText; +import mineplex.core.donation.DonationManager; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; import mineplex.core.stats.StatsManager; @@ -23,7 +26,11 @@ public class Fountain private final Hologram _hologram; private final Counter _counter; - public Fountain(Location location, String name, String dataKey, long goal, HologramManager hologramManager, StatsManager statsManager) + private final FountainShop _shop; + + public Fountain(Location location, String name, String dataKey, long goal, FountainManager fountainManager, + CoreClientManager clientManager, DonationManager donationManager, HologramManager hologramManager, + StatsManager statsManager) { _hologramManager = hologramManager; _statsManager = statsManager; @@ -34,6 +41,8 @@ public class Fountain _hologram = new Hologram(hologramManager, location.clone().add(0, 2, 0), name).start(); _counter = new Counter(dataKey, goal); + _shop = new FountainShop(this, fountainManager, clientManager, donationManager); + updateHologram(); } @@ -70,4 +79,9 @@ public class Fountain { return _dataKey; } + + public void openShop(Player player) + { + _shop.attemptShopOpen(player); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java index 03697dd76..efdff59c3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/FountainManager.java @@ -1,10 +1,13 @@ package mineplex.core.brawl.fountain; import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; import mineplex.core.brawl.fountain.command.FountainCommand; +import mineplex.core.brawl.fountain.gui.FountainShop; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilWorld; +import mineplex.core.donation.DonationManager; import mineplex.core.hologram.HologramManager; import mineplex.core.stats.StatsManager; import mineplex.core.updater.UpdateType; @@ -26,7 +29,7 @@ public class FountainManager extends MiniPlugin private Fountain _gemFountain; - public FountainManager(JavaPlugin plugin, HologramManager hologramManager, StatsManager statsManager) + public FountainManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, HologramManager hologramManager, StatsManager statsManager) { super("Counter", plugin); @@ -34,7 +37,7 @@ public class FountainManager extends MiniPlugin _statsManager = statsManager; _gemFountain = new Fountain(new Location(Bukkit.getWorlds().get(0), -32.5, 72, -23.5), - C.cGreen + "Gem Fountain", "GemFountain", 1000000, _hologramManager, _statsManager); + C.cGreen + "Gem Fountain", "GemFountain", 1000000, this, clientManager, donationManager, _hologramManager, _statsManager); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/FountainCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/FountainCommand.java index 9268549ae..12397b482 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/FountainCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/FountainCommand.java @@ -15,6 +15,7 @@ public class FountainCommand extends MultiCommandBase super(plugin, Rank.ADMIN, "fountain"); AddCommand(new AddCommand(plugin)); + AddCommand(new GuiCommand(plugin)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/GuiCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/GuiCommand.java new file mode 100644 index 000000000..f5f190671 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/command/GuiCommand.java @@ -0,0 +1,25 @@ +package mineplex.core.brawl.fountain.command; + +import mineplex.core.brawl.fountain.FountainManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import org.bukkit.entity.Player; + +/** + * @author Shaun Bennett + */ +public class GuiCommand extends CommandBase +{ + public GuiCommand(FountainManager plugin) + { + super(plugin, Rank.ADMIN, "gui"); + } + + @Override + public void Execute(Player caller, String[] args) + { + Plugin.getGemFountain().openShop(caller); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainPage.java index e82d1ef56..b41660b12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainPage.java @@ -13,7 +13,7 @@ public class FountainPage extends ShopPageBase { public FountainPage(FountainManager plugin, FountainShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Counter Keeper", player); + super(plugin, shop, clientManager, donationManager, "Counter Keeper", player, 9); buildPage(); } @@ -21,6 +21,5 @@ public class FountainPage extends ShopPageBase @Override protected void buildPage() { - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainShop.java b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainShop.java index 0180d4088..9296211d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/brawl/fountain/gui/FountainShop.java @@ -1,6 +1,7 @@ package mineplex.core.brawl.fountain.gui; import mineplex.core.account.CoreClientManager; +import mineplex.core.brawl.fountain.Fountain; import mineplex.core.brawl.fountain.FountainManager; import mineplex.core.donation.DonationManager; import mineplex.core.shop.ShopBase; @@ -12,9 +13,13 @@ import org.bukkit.entity.Player; */ public class FountainShop extends ShopBase { - public FountainShop(FountainManager plugin, CoreClientManager clientManager, DonationManager donationManager) + private final Fountain _fountain; + + public FountainShop(Fountain fountain, FountainManager plugin, CoreClientManager clientManager, DonationManager donationManager) { super(plugin, clientManager, donationManager, "Counter Shop"); + + _fountain = fountain; } @Override @@ -22,4 +27,9 @@ public class FountainShop extends ShopBase { return new FountainPage(getPlugin(), this, getClientManager(), getDonationManager(), player); } + + public Fountain getFountain() + { + return _fountain; + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 99ada65fe..46a3b2e55 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -227,7 +227,7 @@ public class HubManager extends MiniClientPlugin new SoccerManager(this, _gadgetManager); new KothManager(this, _gadgetManager); - new FountainManager(plugin, hologramManager, statsManager); + new FountainManager(plugin, clientManager, donationManager, hologramManager, statsManager); //new TrickOrTreatManager(_plugin, this, taskManager, donationManager, clientManager);