From 1d2f61db8c45d5068bc7183cdfcd906c7fac4eb2 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 8 Jan 2016 03:15:05 -0500 Subject: [PATCH] Disable purchasing Christmas Treasure --- .../mineplex/core/treasure/TreasureType.java | 24 +++++++++++++---- .../core/treasure/gui/TreasurePage.java | 27 +++++++++++-------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index bab37072b..159bd4f83 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -8,13 +8,13 @@ import mineplex.core.reward.RewardType; public enum TreasureType { - OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL), + OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000), - ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL), + ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000), - MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL), + MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000), - CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY); + CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000); private final String _name; private final RewardType _rewardType; @@ -23,8 +23,10 @@ public enum TreasureType private final String _itemName; private final String _statName; private final RewardPool.Type _rewardPool; + private final int _purchasePrice; + private final boolean _purchasable; - TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool) + TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle, RewardPool.Type rewardPool, boolean purchasable, int purchasePrice) { _name = name; _itemName = itemName; @@ -33,6 +35,8 @@ public enum TreasureType _material = material; _treasureStyle = treasureStyle; _rewardPool = rewardPool; + _purchasePrice = purchasePrice; + _purchasable = purchasable; } public RewardType getRewardType() @@ -69,4 +73,14 @@ public enum TreasureType { return _rewardPool; } + + public int getPurchasePrice() + { + return _purchasePrice; + } + + public boolean isPurchasable() + { + return _purchasable; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index a0ad48354..ae345c49c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -122,9 +122,11 @@ public class TreasurePage extends ShopPageBase christmasLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); else { + /* christmasLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "15000 Treasure Shards"); christmasLore.add(" "); christmasLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + */ } List cosmicLore = new ArrayList(); @@ -143,18 +145,21 @@ public class TreasurePage extends ShopPageBase addItem(40, shards); - if (basicCount > 0) addButton(20, basic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.OLD)); - else addButton(20, basic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Old Chest", Material.CHEST, 1000)); - - if (heroicCount > 0) addButton(22, heroic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.ANCIENT)); - else addButton(22, heroic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000)); - - if (legendaryCount > 0) addButton(24, legendary, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.MYTHICAL)); - else addButton(24, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000)); - - if (christmasCount > 0) addButton(12, christmas, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.CHRISTMAS)); - else addButton(12, christmas, new BuyChestButton(getPlayer(), _inventoryManager, this, TreasureType.CHRISTMAS.getItemName(), Material.SNOW_BALL, 15000)); + addChest(20, basic, TreasureType.OLD, basicCount); + addChest(22, heroic, TreasureType.ANCIENT, heroicCount); + addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount); + addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount); addItem(14, cosmic); } + + private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) + { + if (owned > 0) + addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); + else if (treasureType.isPurchasable()) + addButton(slot, item, new BuyChestButton(getPlayer(), _inventoryManager, this, treasureType.getName(), Material.CHEST, treasureType.getPurchasePrice())); + else + setItem(slot, item); + } }