Add functionality to PowerPlayData
This commit is contained in:
parent
992a6aafe9
commit
0e9bbd7176
@ -149,7 +149,26 @@ public class PowerPlayData
|
||||
|
||||
public static enum SubscriptionDuration
|
||||
{
|
||||
MONTH, YEAR
|
||||
MONTH("Month", 1), YEAR("Year", 12);
|
||||
|
||||
private String _name;
|
||||
private int _length;
|
||||
|
||||
SubscriptionDuration(String name, int length)
|
||||
{
|
||||
_name = name;
|
||||
_length = length;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public int getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
}
|
||||
|
||||
private PowerPlayData(List<Subscription> subscriptions, Optional<LocalDate> nextClaimDate, Set<YearMonth> unclaimedMonths, Set<YearMonth> cosmeticMonths)
|
||||
|
@ -373,7 +373,7 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
_items[slot] = item;
|
||||
}
|
||||
|
||||
protected void addButton(int slot, ItemStack item, IButton button)
|
||||
public void addButton(int slot, ItemStack item, IButton button)
|
||||
{
|
||||
if (_items.length <= slot)
|
||||
{
|
||||
|
@ -2,6 +2,7 @@ package mineplex.staffServer.ui;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -12,6 +13,7 @@ import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.staffServer.customerSupport.CustomerSupport;
|
||||
import mineplex.staffServer.ui.chest.SupportChestPage;
|
||||
import mineplex.staffServer.ui.currency.SupportCurrencyPage;
|
||||
import mineplex.staffServer.ui.ppc.SupportPowerplayPage;
|
||||
import mineplex.staffServer.ui.rank.SupportRankBonusPage;
|
||||
|
||||
public class SupportHomePage extends SupportPage
|
||||
@ -61,6 +63,18 @@ public class SupportHomePage extends SupportPage
|
||||
});
|
||||
}
|
||||
|
||||
private void buildPageButton(int slot, ShopItem item, Class<? extends SupportPage> clazz, Supplier<Boolean> isValid)
|
||||
{
|
||||
if (isValid.get())
|
||||
{
|
||||
buildPageButton(slot, item, clazz);
|
||||
}
|
||||
else
|
||||
{
|
||||
buildUnavailableButton(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
@ -76,18 +90,14 @@ public class SupportHomePage extends SupportPage
|
||||
C.mBody + "shards for " + C.cYellow + _target.getName()
|
||||
}, 1, false, true), SupportCurrencyPage.class);
|
||||
|
||||
if (getShop().getBonusLog(_target.getAccountId()) != null)
|
||||
{
|
||||
buildPageButton(getSlotIndex(1, 5), new ShopItem(Material.ENCHANTED_BOOK, "Rank Bonus", new String[] {
|
||||
C.mBody + "Click to view rank",
|
||||
C.mBody + "bonus log for " + C.cYellow + _target.getName()
|
||||
}, 1, false, true), SupportRankBonusPage.class);
|
||||
}
|
||||
else
|
||||
{
|
||||
buildUnavailableButton(getSlotIndex(1, 5));
|
||||
}
|
||||
|
||||
buildPageButton(getSlotIndex(1, 5), new ShopItem(Material.ENCHANTED_BOOK, "Rank Bonus", new String[] {
|
||||
C.mBody + "Click to view rank",
|
||||
C.mBody + "bonus log for " + C.cYellow + _target.getName()
|
||||
}, 1, false, true), SupportRankBonusPage.class, () -> getShop().getBonusLog().get(_target.getAccountId()) != null);
|
||||
|
||||
buildPageButton(getSlotIndex(1, 7), new ShopItem(Material.GOLD_INGOT, "PowerPlay Club", new String[] {
|
||||
C.mBody + "Click to view PowerPlay",
|
||||
C.mBody + "club info for " + C.cYellow + _target.getName()
|
||||
}, 1, false, true), SupportPowerplayPage.class, () -> getShop().getPowerPlayData().get(_target.getAccountId()) != null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user