diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportChestPage.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportChestPage.java index 8c2a63072..fd63ba314 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportChestPage.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportChestPage.java @@ -30,7 +30,7 @@ public class SupportChestPage extends SupportPage private Map _treasureRecieved; - public SupportChestPage(CustomerSupport plugin, SupportShop shop, Player player, CoreClient target, SupportHomePage homePage) + public SupportChestPage(CustomerSupport plugin, SupportShop shop, Player player, CoreClient target, SupportPage homePage) { super(plugin, shop, player, target, homePage, "Chests"); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportHomePage.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportHomePage.java new file mode 100644 index 000000000..76ed55c50 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportHomePage.java @@ -0,0 +1,64 @@ +package mineplex.staffServer.ui; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.Managers; +import mineplex.core.account.CoreClient; +import mineplex.core.common.util.C; +import mineplex.core.shop.item.ShopItem; +import mineplex.staffServer.customerSupport.CustomerSupport; + +public class SupportHomePage extends SupportPage +{ + public SupportHomePage(CustomerSupport plugin, SupportShop shop, Player player, CoreClient target) + { + super(plugin, shop, player, target, null); + + buildPage(); + } + + private void buildPageButton(int slot,ShopItem shopItem, Class clazz) + { + Constructor pageConstructor; + try + { + pageConstructor = clazz.getConstructor(CustomerSupport.class, SupportShop.class, Player.class, CoreClient.class, SupportPage.class); + } catch (NoSuchMethodException e) + { + System.out.println("Could not get page constructor:"); + e.printStackTrace(); + return; + } + + addButton(slot, shopItem, (p, c) -> { + try + { + getShop().openPageForPlayer(getPlayer(), (SupportPage) pageConstructor.newInstance(getPlugin(), getShop(), getPlayer(), _target, this)); + } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) + { + System.out.println("Could not instantiate page:"); + e.printStackTrace(); + } + }); + } + + @Override + protected void buildPage() + { + super.buildPage(); + + buildPageButton(getSlotIndex(1, 1), new ShopItem(Material.CHEST, "Chests", new String[] { + C.mBody + "Click to view or add", + C.mBody + "chests for " + C.cYellow + _target.getName() + }, 1, false, true), SupportChestPage.class); + + buildPageButton(getSlotIndex(1, 3), new ShopItem(Material.EMERALD, "Currency", new String[] { + C.mBody + "Click to add gems or", + C.mBody + "shards for " + C.cYellow + _target.getName() + }, 1, false, true), SupportCurrencyPage.class); + } +}