Add fountain gui command

This commit is contained in:
Shaun Bennett 2016-04-21 11:41:16 +10:00
parent cb48df6a3d
commit 54f0b99756
7 changed files with 59 additions and 7 deletions

View File

@ -1,6 +1,9 @@
package mineplex.core.brawl.fountain; 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.common.util.UtilText;
import mineplex.core.donation.DonationManager;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
@ -23,7 +26,11 @@ public class Fountain
private final Hologram _hologram; private final Hologram _hologram;
private final Counter _counter; 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; _hologramManager = hologramManager;
_statsManager = statsManager; _statsManager = statsManager;
@ -34,6 +41,8 @@ public class Fountain
_hologram = new Hologram(hologramManager, location.clone().add(0, 2, 0), name).start(); _hologram = new Hologram(hologramManager, location.clone().add(0, 2, 0), name).start();
_counter = new Counter(dataKey, goal); _counter = new Counter(dataKey, goal);
_shop = new FountainShop(this, fountainManager, clientManager, donationManager);
updateHologram(); updateHologram();
} }
@ -70,4 +79,9 @@ public class Fountain
{ {
return _dataKey; return _dataKey;
} }
public void openShop(Player player)
{
_shop.attemptShopOpen(player);
}
} }

View File

@ -1,10 +1,13 @@
package mineplex.core.brawl.fountain; package mineplex.core.brawl.fountain;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.brawl.fountain.command.FountainCommand; 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.C;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.core.donation.DonationManager;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -26,7 +29,7 @@ public class FountainManager extends MiniPlugin
private Fountain _gemFountain; 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); super("Counter", plugin);
@ -34,7 +37,7 @@ public class FountainManager extends MiniPlugin
_statsManager = statsManager; _statsManager = statsManager;
_gemFountain = new Fountain(new Location(Bukkit.getWorlds().get(0), -32.5, 72, -23.5), _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 @Override

View File

@ -15,6 +15,7 @@ public class FountainCommand extends MultiCommandBase<FountainManager>
super(plugin, Rank.ADMIN, "fountain"); super(plugin, Rank.ADMIN, "fountain");
AddCommand(new AddCommand(plugin)); AddCommand(new AddCommand(plugin));
AddCommand(new GuiCommand(plugin));
} }
@Override @Override

View File

@ -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<FountainManager>
{
public GuiCommand(FountainManager plugin)
{
super(plugin, Rank.ADMIN, "gui");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.getGemFountain().openShop(caller);
}
}

View File

@ -13,7 +13,7 @@ public class FountainPage extends ShopPageBase<FountainManager, FountainShop>
{ {
public FountainPage(FountainManager plugin, FountainShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) 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(); buildPage();
} }
@ -21,6 +21,5 @@ public class FountainPage extends ShopPageBase<FountainManager, FountainShop>
@Override @Override
protected void buildPage() protected void buildPage()
{ {
} }
} }

View File

@ -1,6 +1,7 @@
package mineplex.core.brawl.fountain.gui; package mineplex.core.brawl.fountain.gui;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.brawl.fountain.Fountain;
import mineplex.core.brawl.fountain.FountainManager; import mineplex.core.brawl.fountain.FountainManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
@ -12,9 +13,13 @@ import org.bukkit.entity.Player;
*/ */
public class FountainShop extends ShopBase<FountainManager> public class FountainShop extends ShopBase<FountainManager>
{ {
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"); super(plugin, clientManager, donationManager, "Counter Shop");
_fountain = fountain;
} }
@Override @Override
@ -22,4 +27,9 @@ public class FountainShop extends ShopBase<FountainManager>
{ {
return new FountainPage(getPlugin(), this, getClientManager(), getDonationManager(), player); return new FountainPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
} }
public Fountain getFountain()
{
return _fountain;
}
} }

View File

@ -227,7 +227,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
new SoccerManager(this, _gadgetManager); new SoccerManager(this, _gadgetManager);
new KothManager(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); //new TrickOrTreatManager(_plugin, this, taskManager, donationManager, clientManager);