diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java index f38efda26..0e0e846ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/alieninvasion/AlienInvasion.java @@ -1,10 +1,10 @@ package nautilus.game.arcade.game.games.alieninvasion; import mineplex.core.common.Pair; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.*; +import mineplex.core.titles.tracks.Track; +import mineplex.core.titles.tracks.TrackManager; +import mineplex.core.titles.tracks.award.AlienInvasionTrack; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.utils.UtilVariant; @@ -15,7 +15,6 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.alieninvasion.kit.KitPlayer; import nautilus.game.arcade.game.games.dragonescape.DragonScore; import nautilus.game.arcade.kit.Kit; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -24,8 +23,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scoreboard.Team; @@ -335,8 +332,32 @@ public class AlienInvasion extends SoloGame if (newScore > currentScore) { - Bukkit.broadcastMessage(player.getName() + "=" + newScore); score.Score = newScore; + + // Reward title + if (score.Score == _path.size() - 1) + { + TrackManager trackManager = Manager.getTrackManager(); + Track track = trackManager.getTrack(AlienInvasionTrack.class); + + if (trackManager.hasTrack(player, track)) + { + continue; + } + + trackManager.unlockTrack(player, track, result -> + { + switch (result) + { + case UNKNOWN_ERROR: + player.sendMessage(F.main("Game", "Oops, somehow I could not give you the title track, you should inform a staff member!")); + break; + case SUCCESS: + player.sendMessage(F.main("Game", "Unlocked " + track.getColor() + track.getLongName() + C.mBody + " Title!")); + break; + } + }); + } } } }