From fda052ea90d8ba932ac553453bd8d5c1432352d9 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 14 Aug 2015 21:34:37 -0500 Subject: [PATCH] Add treasure chest stats --- .../core/achievement/AchievementCategory.java | 3 ++- .../achievement/ui/page/AchievementMainPage.java | 4 +++- .../mineplex/core/treasure/TreasureLocation.java | 2 ++ .../mineplex/core/treasure/TreasureManager.java | 7 +++++++ .../src/mineplex/core/treasure/TreasureType.java | 15 +++++++++++---- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index d19f0e93a..e383ffcdb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -15,7 +15,8 @@ import mineplex.core.stats.StatsManager; public enum AchievementCategory { 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"), BRIDGES("The Bridges", null, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java index 7867fab9a..68d43a09e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java @@ -61,7 +61,6 @@ public class AchievementMainPage extends ShopPageBase 0) + lore.add(" "); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 7f4ef7667..7368f718a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -97,6 +97,7 @@ public class TreasureLocation implements Listener return; } + // Treasure is now being opened setHoloChestVisible(false); if (treasureType == TreasureType.ANCIENT) @@ -123,6 +124,7 @@ public class TreasureLocation implements Listener player.teleport(teleportLocation); + _treasureManager.addOpenStat(player, treasureType); } private boolean chargeAccount(Player player, TreasureType treasureType) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index fbd14ea54..30d1a2335 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -31,6 +31,7 @@ public class TreasureManager extends MiniPlugin private InventoryManager _inventoryManager; private BlockRestore _blockRestore; private HologramManager _hologramManager; + private StatsManager _statsManager; private List _treasureLocations; 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; _blockRestore = blockRestore; _hologramManager = hologramManager; + _statsManager = statsManager; _rewardManager = new RewardManager(clientManager, donationManager, _inventoryManager, petManager, statsManager, 100, 250, 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) { return _rewardManager.getRewards(player, rewardType); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 861f47a91..1d6a5a399 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -7,22 +7,24 @@ import mineplex.core.reward.RewardType; 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 RewardType _rewardType; private final Material _material; private final TreasureStyle _treasureStyle; 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; _itemName = itemName; + _statName = statName; _rewardType = rewardType; _material = material; _treasureStyle = treasureStyle; @@ -52,4 +54,9 @@ public enum TreasureType { return _itemName; } + + public String getStatName() + { + return _statName; + } }