Add treasure chest stats

This commit is contained in:
Shaun Bennett 2015-08-14 21:34:37 -05:00
parent e89961380b
commit fda052ea90
5 changed files with 25 additions and 6 deletions

View File

@ -15,7 +15,8 @@ import mineplex.core.stats.StatsManager;
public enum AchievementCategory public enum AchievementCategory
{ {
GLOBAL("Global", null, GLOBAL("Global", null,
new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null, new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote") }, new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null,
new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
Material.EMERALD, 0, GameCategory.GLOBAL, "None"), Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
BRIDGES("The Bridges", null, BRIDGES("The Bridges", null,

View File

@ -61,7 +61,6 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
getPlayer(), _target); getPlayer(), _target);
lore.add(" "); lore.add(" ");
addAchievements(category, lore, 9); addAchievements(category, lore, 9);
lore.add(" ");
lore.add(ChatColor.RESET + "Click for more details!"); lore.add(ChatColor.RESET + "Click for more details!");
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(),
@ -100,5 +99,8 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
achievementCount++; achievementCount++;
} }
} }
if (achievementCount > 0)
lore.add(" ");
} }
} }

View File

@ -97,6 +97,7 @@ public class TreasureLocation implements Listener
return; return;
} }
// Treasure is now being opened
setHoloChestVisible(false); setHoloChestVisible(false);
if (treasureType == TreasureType.ANCIENT) if (treasureType == TreasureType.ANCIENT)
@ -123,6 +124,7 @@ public class TreasureLocation implements Listener
player.teleport(teleportLocation); player.teleport(teleportLocation);
_treasureManager.addOpenStat(player, treasureType);
} }
private boolean chargeAccount(Player player, TreasureType treasureType) private boolean chargeAccount(Player player, TreasureType treasureType)

View File

@ -31,6 +31,7 @@ public class TreasureManager extends MiniPlugin
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private HologramManager _hologramManager; private HologramManager _hologramManager;
private StatsManager _statsManager;
private List<TreasureLocation> _treasureLocations; private List<TreasureLocation> _treasureLocations;
public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager) public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager)
@ -40,6 +41,7 @@ public class TreasureManager extends MiniPlugin
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_blockRestore = blockRestore; _blockRestore = blockRestore;
_hologramManager = hologramManager; _hologramManager = hologramManager;
_statsManager = statsManager;
_rewardManager = new RewardManager(clientManager, donationManager, _inventoryManager, petManager, statsManager, _rewardManager = new RewardManager(clientManager, donationManager, _inventoryManager, petManager, statsManager,
100, 250, 100, 250,
500, 1000, 500, 1000,
@ -121,6 +123,11 @@ public class TreasureManager extends MiniPlugin
} }
} }
public void addOpenStat(Player player, TreasureType treasureType)
{
_statsManager.incrementStat(player, "Global.Treasure." + treasureType.getStatName(), 1);
}
public Reward[] getRewards(Player player, RewardType rewardType) public Reward[] getRewards(Player player, RewardType rewardType)
{ {
return _rewardManager.getRewards(player, rewardType); return _rewardManager.getRewards(player, rewardType);

View File

@ -7,22 +7,24 @@ import mineplex.core.reward.RewardType;
public enum TreasureType public enum TreasureType
{ {
OLD(C.cYellow + "Old Chest", "Old Chest", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD), OLD(C.cYellow + "Old Chest", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD),
ANCIENT(C.cGold + "Ancient Chest", "Ancient Chest", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT), ANCIENT(C.cGold + "Ancient Chest", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT),
MYTHICAL(C.cRed + "Mythical Chest", "Mythical Chest", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL); MYTHICAL(C.cRed + "Mythical Chest", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL);
private final String _name; private final String _name;
private final RewardType _rewardType; private final RewardType _rewardType;
private final Material _material; private final Material _material;
private final TreasureStyle _treasureStyle; private final TreasureStyle _treasureStyle;
private final String _itemName; private final String _itemName;
private final String _statName;
TreasureType(String name, String itemName, RewardType rewardType, Material material, TreasureStyle treasureStyle) TreasureType(String name, String itemName, String statName, RewardType rewardType, Material material, TreasureStyle treasureStyle)
{ {
_name = name; _name = name;
_itemName = itemName; _itemName = itemName;
_statName = statName;
_rewardType = rewardType; _rewardType = rewardType;
_material = material; _material = material;
_treasureStyle = treasureStyle; _treasureStyle = treasureStyle;
@ -52,4 +54,9 @@ public enum TreasureType
{ {
return _itemName; return _itemName;
} }
public String getStatName()
{
return _statName;
}
} }