diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java index a14d161d7..5465f386f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameAchievementManager.java @@ -1,11 +1,18 @@ package nautilus.game.arcade.managers; +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; + import mineplex.core.achievement.Achievement; import mineplex.core.achievement.AchievementData; import mineplex.core.achievement.AchievementLog; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; @@ -16,14 +23,6 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; -import org.bukkit.ChatColor; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; - public class GameAchievementManager implements Listener { ArcadeManager Manager; @@ -84,13 +83,21 @@ public class GameAchievementManager implements Listener //Display for (final Achievement type : log.keySet()) { - - AchievementData data = Manager.GetAchievement().get(player, type); String nameLevel = F.elem(C.cGold + C.Bold + type.getName()); - if (type.getMaxLevel() > 1) - nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel()); + if (type.getMaxLevel() > 1) + { + if (type.hasLevelNames()) + { + String tier = data.getLevel() == 0 ? type.getDefaultLevelName() : type.getLevelNames()[Math.min(data.getLevel(), type.getLevelNames().length) - 1]; + nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + "Tier: " + tier); + } + else + { + nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel()); + } + } String progress = F.elem(C.cGreen + "+" + log.get(type).Amount); @@ -102,17 +109,51 @@ public class GameAchievementManager implements Listener //Finishing for the first time if (!Manager.GetTaskManager().hasCompletedTask(player, type.getName())) { + int gems = type.getGemReward(); + int crowns = 0; + int xp = 0; + if (type.getLevelUpRewards().length > 0) + { + int[] rewards = type.getLevelUpRewards()[type.getLevelUpRewards().length - 1]; + gems += rewards[0]; + crowns += rewards[1]; + xp += rewards[2]; + } UtilPlayer.message(player, ""); - UtilPlayer.message(player, nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!") + - " " + F.elem(C.cGreen + C.Bold + "+" + type.getGemReward() + " Gems")); + String inform = nameLevel + " " + F.elem(C.cAqua + C.Bold + "Completed!"); + if (gems > 0) + { + inform += " " + F.elem(C.cGreen + C.Bold + "+" + gems + " Gems"); + } + if (crowns > 0) + { + inform += " " + F.elem(C.cGold + C.Bold + "+" + crowns + " Crowns"); + } + if (xp > 0 && !Manager.GetTaskManager().hasCompletedTask(player, Achievement.GLOBAL_MINEPLEX_LEVEL.getName())) + { + inform += " " + F.elem(C.cYellow + C.Bold + "+" + xp + " XP"); + } + UtilPlayer.message(player, inform); player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); - Manager.GetTaskManager().completedTask(new Callback() + final int finalGems = gems; + final int finalCrowns = crowns; + final int finalXp = xp; + + Manager.GetTaskManager().completedTask(completed -> { - public void run(Boolean completed) + if (finalGems > 0) { - Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, player, type.getName(), type.getGemReward()); + Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, player, type.getName(), finalGems); + } + if (finalCrowns > 0) + { + Manager.GetDonation().rewardCrowns(finalCrowns, player); + } + if (finalXp > 0) + { + Manager.GetStatsManager().incrementStat(player, Achievement.GLOBAL_MINEPLEX_LEVEL.getStats()[0], finalXp); } }, player, type.getName()); } @@ -125,9 +166,31 @@ public class GameAchievementManager implements Listener //Multi-Level Achievements else if (log.get(type).LevelUp) { + int gems = 0; + int crowns = 0; + int xp = 0; + if (type.getLevelUpRewards().length > 0) + { + int[] rewards = type.getLevelUpRewards()[Math.min(data.getLevel(), type.getLevelUpRewards().length) - 1]; + gems += rewards[0]; + crowns += rewards[1]; + xp += rewards[2]; + } UtilPlayer.message(player, ""); - UtilPlayer.message(player, nameLevel + " " + progress + - " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!")); + String inform = nameLevel + " " + progress + " " + F.elem(C.cAqua + C.Bold + "LEVEL UP!"); + if (gems > 0) + { + inform += " " + F.elem(C.cGreen + C.Bold + "+" + gems + " Gems"); + } + if (crowns > 0) + { + inform += " " + F.elem(C.cGold + C.Bold + "+" + crowns + " Crowns"); + } + if (xp > 0 && !Manager.GetTaskManager().hasCompletedTask(player, Achievement.GLOBAL_MINEPLEX_LEVEL.getName())) + { + inform += " " + F.elem(C.cYellow + C.Bold + "+" + xp + " XP"); + } + UtilPlayer.message(player, inform); player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); } @@ -179,4 +242,4 @@ public class GameAchievementManager implements Listener UtilPlayer.message(player, ""); UtilPlayer.message(player, ArcadeFormat.Line); } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java index 6491ee32c..fd043926f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/ProgressingKitManager.java @@ -263,6 +263,10 @@ public class ProgressingKitManager implements Listener { return; } + if (!data.getKit().usesXp()) + { + return; + } player.sendMessage(SPACE);