diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index ab821003d..07dab815f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -708,7 +708,43 @@ public enum Achievement new String[]{"Evolution.EvolveKill"}, new String[]{"Kill 25 people while they", "Are trying to evolve"}, new int[]{25}, - AchievementCategory.EVOLUTION) + AchievementCategory.EVOLUTION), + + MONSTER_MAZE_WINS("Maze Master", 1200, + new String[]{"Monster Maze.Wins"}, + new String[]{"Win 40 games of Monster Maze"}, + new int[]{40}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_HARD_MODE("Hard Mode", 1000, + new String[]{"Monster Maze.Hard Mode"}, + new String[]{"Win a game without using", "any kit abilities"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_NINJA("Ninja", 1200, + new String[]{"Monster Maze.Ninja"}, + new String[]{"Win a game without", "touching a monster"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_SPEEDSTER("Speedy McGee", 1000, + new String[]{"Monster Maze.Speed"}, + new String[]{"Be the first to the", "Safe Pad 50 times"}, + new int[]{50}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_SURVIVAL("Die Already!", 1200, + new String[]{"Monster Maze.ToughCompetition"}, + new String[]{"Survive past the 15th Safe Pad"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), + + MONSTER_MAZE_PILOT("Pilot", 800, //TODO + new String[]{"Monster Maze.Pilot"}, + new String[]{"Get hit by a monster and", "land on the Safe Pad"}, + new int[]{1}, + AchievementCategory.MONSTER_MAZE), ; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 5b81e40ea..3da6b4c94 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -127,7 +127,13 @@ public enum AchievementCategory EVOLUTION("Evolution", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, - Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"); + Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"), + + MONSTER_MAZE("Monster Maze", null, + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, + Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"), + + ; private String _name; private String[] _statsToPull; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java index 51804fc23..2f48175a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MMMazes.java @@ -3,13 +3,12 @@ package nautilus.game.arcade.game.games.monstermaze; import java.util.ArrayList; import java.util.Iterator; +import mineplex.core.common.util.UtilMath; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilWorld; - public class MMMazes { public static MazePreset getRandomMapPreset(Location loc) @@ -95,16 +94,30 @@ public class MMMazes } } + @SuppressWarnings("deprecation") public void build() { - for(Location loc : _maze) - { - loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.QUARTZ_BLOCK); + for (Location loc : _maze) + { + Location mod = loc.clone(); + + mod.subtract(0, 1, 0).getBlock().setType(Material.QUARTZ_BLOCK); + + mod.subtract(0, 1, 0).getBlock().setType(Material.QUARTZ_BLOCK); + mod.getBlock().setData((byte) 2); + + mod.subtract(0, 1, 0).getBlock().setType(Material.STEP); + mod.getBlock().setData((byte) 15); } for(Location loc : _spawns) { - loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.GOLD_BLOCK); + Location mod = loc.clone(); + + for (int i = 0 ; i < 3 ; i++) + { + mod.subtract(0, i, 0).getBlock().setType(Material.GOLD_BLOCK); + } } for(Location loc : _centerSafeZone) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java index a26761e88..e00ebc29c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/Maze.java @@ -8,6 +8,31 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.RadarData; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilRadar; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset; +import nautilus.game.arcade.game.games.monstermaze.MazeMobWaypoint.CardinalDirection; +import nautilus.game.arcade.game.games.monstermaze.events.AbilityUseEvent; +import nautilus.game.arcade.game.games.monstermaze.events.SafepadBuildEvent; +import nautilus.game.arcade.game.games.monstermaze.events.SnowmanHitEvent; +import nautilus.game.arcade.game.games.monstermaze.kits.KitSmasher; + +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; @@ -22,34 +47,10 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.entity.Zombie; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.RadarData; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilRadar; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilTextTop; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset; -import nautilus.game.arcade.game.games.monstermaze.MazeMobWaypoint.CardinalDirection; -import nautilus.game.arcade.game.games.monstermaze.kits.KitSmasher; - public class Maze implements Listener { private MonsterMaze Host; @@ -78,6 +79,7 @@ public class Maze implements Listener private HashMap _ents = new HashMap(); + @SuppressWarnings("deprecation") public Maze(MonsterMaze host, MazePreset maze) { Host = host; @@ -110,6 +112,14 @@ public class Maze implements Listener pickNextLocForSafePad(); } + public boolean isOnPad(Player player) + { + if (_safePad == null) + return false; + + return _safePad.isOn(player); + } + public void update() { if(_safePad != null) // TODO probably a good idea to check if this will screw up compasses in inventories before the game starts @@ -117,7 +127,7 @@ public class Maze implements Listener for(Player p : Host.GetPlayers(true)) { p.setCompassTarget(_nextSafePadLoc); - UtilRadar.displayRadar(p, Arrays.asList(_safePadRadarData), false); + UtilRadar.displayRadar(p, Arrays.asList(_safePadRadarData), true); } } @@ -135,7 +145,7 @@ public class Maze implements Listener p.setExp(0); } - UtilTextTop.displayProgress(C.cAqua + C.Bold + "Be the first player to get to the Safe Pad!", 100, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); +// UtilTextTop.displayProgress(C.cAqua + C.Bold + "Be the first player to get to the Safe Pad!", 100, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } else { @@ -143,13 +153,14 @@ public class Maze implements Listener for(Player p : Host.GetPlayers(true)) { p.setExp((float)percentage); - if(_safePad.isOn(p)) - { - UtilTextTop.displayProgress(C.cGreen + C.Bold + "Stay on the Safe Pad for " + _phaseTimer + " more seconds!", percentage, p); - } - else { - UtilTextTop.displayProgress(C.cRed + C.Bold + "You have " + _phaseTimer + " seconds to get to the Safe Pad!", percentage, p); - } +// if(_safePad.isOn(p)) +// { +// UtilTextTop.displayProgress(C.cGreen + C.Bold + "Stay on the Safe Pad for " + _phaseTimer + " more seconds!", percentage, p); +// } +// else +// { +// UtilTextTop.displayProgress(C.cRed + C.Bold + "You have " + _phaseTimer + " seconds to get to the Safe Pad!", percentage, p); +// } } } } @@ -212,6 +223,8 @@ public class Maze implements Listener Host.Manager.GetDamage().NewDamageEvent(player, (LivingEntity)ent, null, DamageCause.ENTITY_ATTACK, 4, false, false, false, "Monster", "Monster Attack"); + + Bukkit.getPluginManager().callEvent(new SnowmanHitEvent(player)); } } } @@ -465,6 +478,8 @@ public class Maze implements Listener e.remove(); } } + + Bukkit.getPluginManager().callEvent(new SafepadBuildEvent()); } public void decrementSafePadTime() @@ -545,34 +560,34 @@ public class Maze implements Listener _phaseTimer--; if(_phaseTimer == 20) // only gets to this by running out of time naturally, not by player { - Host.Announce(C.cRed + C.Bold + "Nobody has gotten to the Safe Pad yet! Twenty seconds left."); + UtilTextMiddle.display(C.cGreen + C.Bold + "20", C.cWhite + "Seconds Left", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } if(_phaseTimer == 15 || _phaseTimer == 10) { - UtilTextMiddle.display("", C.cAqua + C.Bold + _phaseTimer + " seconds to get to the Safe Pad!", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); + UtilTextMiddle.display(C.cGreen + C.Bold + _phaseTimer, C.cWhite + "Seconds Left", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } if(_phaseTimer == 5 || _phaseTimer == 4) { - UtilTextMiddle.display("", C.cGreen + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); + UtilTextMiddle.display(C.cGreen + C.Bold + _phaseTimer, C.cWhite + "Seconds Left", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } if(_phaseTimer == 3) { - UtilTextMiddle.display("", C.cYellow + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); + UtilTextMiddle.display(C.cYellow + C.Bold + _phaseTimer, C.cWhite + "Seconds Left", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } if(_phaseTimer == 2) { pickNextLocForSafePad(); UtilFirework.playFirework(_nextSafePadLoc, Type.BALL, Color.ORANGE, false, false); - UtilTextMiddle.display("", C.cGold + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); + UtilTextMiddle.display(C.cGold + C.Bold + _phaseTimer, C.cWhite + "Seconds Left", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } if(_phaseTimer == 1) { - UtilTextMiddle.display("", C.cRed + C.Bold + _phaseTimer + "...", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); + UtilTextMiddle.display(C.cRed + C.Bold + _phaseTimer, C.cWhite + "Seconds Left", 5, 40, 5, Host.GetPlayers(true).toArray(new Player[Host.GetPlayers(true).size()])); } if(_phaseTimer == 0) @@ -582,15 +597,15 @@ public class Maze implements Listener if(_safePad.isOn(p)) { // maybe send them a happy message? =) - UtilPlayer.message(p, F.main("Game", C.cGreen + "Since you were on the Safe Pad, you didn't die!")); +// UtilPlayer.message(p, F.main("Game", "Since you were on the Safe Pad, you didn't die!")); } else { Host.Manager.GetDamage().NewDamageEvent(p, null, null, DamageCause.CUSTOM, 500, false, false, false, "Game", "Map damage"); - UtilTextMiddle.display(C.cDRed + C.Bold + "Failure", C.cRed + "You didn't make it to the Safe Pad in time!", 5, 40, 5, p); - UtilPlayer.message(p, F.main("Game", C.cRed + "You died because you weren't on the Safe Pad!")); + UtilTextMiddle.display("", C.cRed + "You didn't make it to the Safe Pad!", 5, 40, 5, p); + UtilPlayer.message(p, F.main("Game", "You didn't make it to the Safe Pad!")); } } spawn(15); @@ -608,7 +623,7 @@ public class Maze implements Listener { if(_safePad.isOn(p) && !_playersOnPad.contains(p)) { - UtilPlayer.message(p, F.main("Game", C.cGreen + "Great, you made it. Stay on the Safe Pad!")); + UtilPlayer.message(p, F.main("Game", "You made it to the Safe Pad!")); _playersOnPad.add(p); Host.AddGems(p, 2, "Got to Safe Pad", true, true); if(_playersOnPad.size() == 1) // first player @@ -621,23 +636,23 @@ public class Maze implements Listener pElse.remove(p); for(Player i : pElse) { - UtilPlayer.message(i, C.cRed + C.Bold + p.getName() + " was the first to make it to the Safe Pad!"); - UtilPlayer.message(i, C.cGray + "Everyone not on the Safe Pad in 15 seconds will die!"); // I don't like this message + UtilPlayer.message(i, F.main("Game", F.name(p.getName()) + " made it to the Safe Pad first!")); + UtilPlayer.message(i, F.main("Game", "You have " + F.time("15 Seconds") + " to make it to the Safe Pad!")); } } - UtilTextMiddle.display(C.cGold + C.Bold + "AWESOME!", C.cGold + "You were the first to make it to the Safe Pad!", 5, 40, 5, p); + UtilTextMiddle.display(C.cYellow + C.Bold + "Safe Pad", C.cWhite + "You got to the Safe Pad first!", 5, 40, 5, p); Host.AddGems(p, 7.5, "First to Safe Pad", true, true); p.playSound(p.getLocation(), Sound.SUCCESSFUL_HIT, 1.0f, 1.0f); } else // not the first { p.playSound(p.getLocation(), Sound.SUCCESSFUL_HIT, 1.0f, 1.0f); - UtilTextMiddle.display(C.cGreen + C.Bold + "Great!", C.cGreen + "Stay on the Safe Pad!", 5, 40, 5, p); + UtilTextMiddle.display(C.cYellow + C.Bold + "Safe Pad", C.cWhite + "You got to the Safe Pad!", 5, 40, 5, p); } } if(!_safePad.isOn(p) && _playersOnPad.contains(p)) { - UtilTextMiddle.display(C.cDRed + C.Bold + "Danger!", C.cRed + "Get back to the Safe Pad!", 0, 10, 0, p); + UtilTextMiddle.display(C.cRed + C.Bold + "DANGER", C.cWhite + "Get back to the Safe Pad!", 0, 10, 0, p); //UtilTextBottom.display(C.cRed + "Get back to the Safe Pad!", p); } } @@ -677,6 +692,8 @@ public class Maze implements Listener ent.teleport(UtilAlg.Random(_spawns)); } } + + Bukkit.getPluginManager().callEvent(new AbilityUseEvent(player)); } public void removePlayerContainmentUnit() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java index fc2d6ae00..fb90af88b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/MonsterMaze.java @@ -1,8 +1,29 @@ package nautilus.game.arcade.game.games.monstermaze; -import java.util.HashMap; -import java.util.UUID; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset; +import nautilus.game.arcade.game.games.monstermaze.events.AbilityUseEvent; +import nautilus.game.arcade.game.games.monstermaze.kits.KitJumper; +import nautilus.game.arcade.game.games.monstermaze.kits.KitSmasher; +import nautilus.game.arcade.game.games.monstermaze.trackers.AbilityUseTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.FirstToSafepadTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.PilotTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.SnowmanHitTracker; +import nautilus.game.arcade.game.games.monstermaze.trackers.SurvivePast15thSafepadTracker; +import nautilus.game.arcade.kit.Kit; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -16,25 +37,8 @@ import org.bukkit.event.block.EntityBlockFormEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.Team; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.monstermaze.MMMazes.MazePreset; -import nautilus.game.arcade.game.games.monstermaze.kits.KitJumper; -import nautilus.game.arcade.game.games.monstermaze.kits.KitSmasher; -import nautilus.game.arcade.kit.Kit; - public class MonsterMaze extends SoloGame { private Maze _maze; @@ -43,9 +47,8 @@ public class MonsterMaze extends SoloGame private MazePreset _preset; private Location _center; - - private HashMap _jumperData = new HashMap<>(); - + + @SuppressWarnings("unchecked") public MonsterMaze(ArcadeManager manager) { super(manager, GameType.MonsterMaze, @@ -58,7 +61,9 @@ public class MonsterMaze extends SoloGame new String[] { - "Be the first to make it to the Safe Pad, but avoid the monsters!" + "Run over the maze and don't fall off,", + "but make sure you avoid the monsters!", + "Make it to a Safe Pad or be killed!" }); this.DamagePvP = false; @@ -66,9 +71,21 @@ public class MonsterMaze extends SoloGame this.PrepareFreeze = false; + registerStatTrackers( + new SnowmanHitTracker(this), + new AbilityUseTracker(this), + new FirstToSafepadTracker(this), + new PilotTracker(this), + new SurvivePast15thSafepadTracker(this) + ); //_maze = new SnowmanMaze(this, WorldData.GetDataLocs("GRAY")/*, WorldData.GetCustomLocs("103")*/); } + public Maze getMaze() + { + return _maze; + } + @EventHandler public void Update(UpdateEvent event) { @@ -83,17 +100,29 @@ public class MonsterMaze extends SoloGame if(event.GetState() == GameState.Prepare) { //if(WorldData.MapName.contains("MonsterTest")) _monsterType = EntityType.CREEPER; - _maze.spawnSafePad(); + setupJumpers(); } else if(event.GetState() == GameState.Live) { _maze.removePlayerContainmentUnit(); - UtilTextMiddle.display(C.cAqua + C.Bold + "Push F5", C.cWhite + "Monster Maze is best played in 3rd Person", 10, 70, 10); + Announce(C.cYellow + C.Scramble + "@@" + C.cAqua + C.Bold + " Monster Maze is best played in 3rd Person! (Push F5) " + C.cYellow + C.Scramble + "@@"); for (Team team : GetScoreboard().GetScoreboard().getTeams()) team.setCanSeeFriendlyInvisibles(true); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + if (!IsLive()) + return; + + _maze.spawnSafePad(); + } + }, 80); } else if(event.GetState() == GameState.Recruit) { @@ -113,30 +142,53 @@ public class MonsterMaze extends SoloGame { if(GetKit(p) instanceof KitJumper) { - _jumperData.put(p.getUniqueId(), 5); + setJumpsLeft(p, 5); } } } + private void setJumpsLeft(Player player, int jumps) + { + if (jumps <= 0) + { + player.getInventory().setItem(8, null); + } + else + { + player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, jumps, C.cYellow + C.Bold + jumps + " Jumps Remaining")); + } + } + @EventHandler public void smasher(PlayerInteractEvent event) { + if (!IsLive()) + return; + _maze.smasher(event); } @EventHandler public void jumpEvent(UpdateEvent event) { - if(event.getType() != UpdateType.TICK) return; - if(GetState() != GameState.Live) return; - for(Player p : GetPlayers(true)) + if(event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + for (Player p : GetPlayers(true)) { - if(!_jumperData.containsKey(p.getUniqueId()) || !Recharge.Instance.usable(p, "MM Player Jump") || p.getLocation().getY()-_center.getY() <= 0 || !Recharge.Instance.usable(p, "Monster Launch")) continue; + if (!UtilInv.contains(p, "Jumps Remaining", Material.FEATHER, (byte) 0, 1) || p.getLocation().getY()-_center.getY() <= 0 || !Recharge.Instance.usable(p, "MM Player Jump") || !Recharge.Instance.usable(p, "Monster Launch")) + continue; - _jumperData.put(p.getUniqueId(), _jumperData.get(p.getUniqueId())-1); + setJumpsLeft(p, p.getInventory().getItem(8).getAmount() - 1); + p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1.0f, 1.0f); Recharge.Instance.useForce(p, "MM Player Jump", 750); + + Bukkit.getPluginManager().callEvent(new AbilityUseEvent(p)); } } @@ -145,25 +197,29 @@ public class MonsterMaze extends SoloGame { if(event.getType() != UpdateType.TICK) return; if(!InProgress()) return; + for(Player pl : GetPlayers(true)) { - if(_jumperData.containsKey(pl.getUniqueId()) && _jumperData.get(pl.getUniqueId()) > 0) + if (IsLive() && UtilInv.contains(pl, Material.FEATHER, (byte) 0, 1)) { - pl.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.FEATHER, (byte)0, _jumperData.get(pl.getUniqueId()), - C.cYellow + C.Bold + _jumperData.get(pl.getUniqueId()) + " Jumps Remaining")); + while (Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null)) + Manager.GetCondition().GetActiveCondition(pl, ConditionType.JUMP).Expire(); } else { - pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000000, 250)); - pl.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.AIR, (byte)0, 1, "" )); + if (!Manager.GetCondition().HasCondition(pl, ConditionType.JUMP, null)) + Manager.GetCondition().Factory().Jump("No jumping", pl, null, 9999999, 250, true, false, false); } - if(GetPlayers(true).size() > 4) + + if (GetPlayers(true).size() > 4) { - pl.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000000000, 250)); + if (!Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null)) + Manager.GetCondition().Factory().Invisible("Hide players", pl, null, 9999999, 2, true, false, false); } else { - pl.removePotionEffect(PotionEffectType.INVISIBILITY); + while (Manager.GetCondition().HasCondition(pl, ConditionType.INVISIBILITY, null)) + Manager.GetCondition().GetActiveCondition(pl, ConditionType.INVISIBILITY).Expire(); } } } @@ -216,32 +272,36 @@ public class MonsterMaze extends SoloGame return; Scoreboard.Reset(); - + Scoreboard.WriteBlank(); - Scoreboard.Write(C.cDPurple + C.Bold + "Beacon Timer"); - if(IsLive()) + if (GetPlayers(true).size() > 6) { - Scoreboard.Write(_maze.getPhaseTimer() + " Seconds"); + Scoreboard.Write(C.cYellow + C.Bold + "Players"); + + Scoreboard.Write(C.cWhite + GetPlayers(true).size()); } else { - Scoreboard.Write("--"); - } - Scoreboard.WriteBlank(); - - if(GetPlayers(true).size() > 5) - { - Scoreboard.Write(C.cWhite + GetPlayers(true).size() + " Players"); - } - else - { - for(Player p : GetPlayers(true)) + for (Player p : GetPlayers(true)) { - Scoreboard.Write(p.getName()); + Scoreboard.Write(C.cWhite + p.getName()); } } - + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cGreen + C.Bold + "Safe Pad"); + + if (IsLive()) + { + Scoreboard.Write(C.cWhite + UtilTime.MakeStr(_maze.getPhaseTimer() * 1000)); + } + else + { + Scoreboard.Write("Unknown"); + } + Scoreboard.Draw(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java index e2d9e5a73..855f95749 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/SafePad.java @@ -20,7 +20,7 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutBlockBreakAnimation; public class SafePad { private MonsterMaze Host; - private Maze _maze; +// private Maze _maze; private Location _loc; @@ -29,7 +29,7 @@ public class SafePad public SafePad(MonsterMaze host, Maze maze, Location loc) { Host = host; - _maze = maze; +// _maze = maze; _loc = loc; @@ -91,6 +91,7 @@ public class SafePad Location _loc; + @SuppressWarnings("deprecation") public SafePadBlock(Location loc, Material newMat, byte newData) { _origM = loc.getBlock().getType(); @@ -102,12 +103,14 @@ public class SafePad _loc = loc; } + @SuppressWarnings("deprecation") public void setMaterial(Material m) { _tempMat = m; MapUtil.QuickChangeBlockAt(_loc, _tempMat.getId(), _tempData); } + @SuppressWarnings("deprecation") public void setData(byte b) // for glass changing { _tempData = b; @@ -119,6 +122,7 @@ public class SafePad return _loc.getBlock().getType(); } + @SuppressWarnings("deprecation") public byte getBlockData() { return _loc.getBlock().getData(); @@ -129,11 +133,13 @@ public class SafePad return _loc; } + @SuppressWarnings("deprecation") public void build() { MapUtil.QuickChangeBlockAt(_loc, _tempMat.getId(), _tempData); } + @SuppressWarnings("deprecation") public void restore() { MapUtil.QuickChangeBlockAt(_loc, _origM.getId(), _origD); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/AbilityUseEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/AbilityUseEvent.java new file mode 100644 index 000000000..8b07fda5e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/AbilityUseEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class AbilityUseEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public AbilityUseEvent(Player player) + { + super(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/FirstToSafepadEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/FirstToSafepadEvent.java new file mode 100644 index 000000000..532905fff --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/FirstToSafepadEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class FirstToSafepadEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public FirstToSafepadEvent(Player player) + { + super(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SafepadBuildEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SafepadBuildEvent.java new file mode 100644 index 000000000..6a3e381f4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SafepadBuildEvent.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SafepadBuildEvent extends Event +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SnowmanHitEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SnowmanHitEvent.java new file mode 100644 index 000000000..745a2bccb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/events/SnowmanHitEvent.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.monstermaze.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class SnowmanHitEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static final HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + public SnowmanHitEvent(Player player) + { + super(player); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java index 6a60d0521..8e3f91787 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitJumper.java @@ -1,17 +1,17 @@ package nautilus.game.arcade.game.games.monstermaze.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitJumper extends Kit { @@ -21,23 +21,27 @@ public class KitJumper extends Kit new String[] { - "Your legs are reinforced with metal braces,", - "so you can jump an extra five times!" + "Your legs are reinforced with metal braces." }, new Perk[] { - + new Perk("Jumper", new String[] + { + C.cGray + "You can jump " + C.cYellow + "5 Times" + C.cGray + "." + }) + { + + } }, EntityType.SKELETON, new ItemStack(Material.FEATHER)); - } @Override public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1, - C.cYellow + "Safe Pad Tracking Device™")); + F.item("Safe Pad Finder"))); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSmasher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSmasher.java index 60995e4d6..cee1b1436 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSmasher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/kits/KitSmasher.java @@ -1,17 +1,17 @@ package nautilus.game.arcade.game.games.monstermaze.kits; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class KitSmasher extends Kit { @@ -21,26 +21,30 @@ public class KitSmasher extends Kit new String[] { - "You can perform three smashing actions,", - "which helps you clear your path!" + "You really hate monsters..." }, new Perk[] { - + new Perk("Smasher", new String[] + { + F.elem("Click") + " to use " + F.skill("Smash"), + }) + { + + } }, EntityType.SKELETON, new ItemStack(Material.ANVIL)); - } @Override public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1, - C.cYellow + "Safe Pad Tracking Device™")); + F.item("Safe Pad Finder"))); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ANVIL, (byte)0, 3, - C.cYellow + C.Bold + "Right-click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smash")); + C.cYellow + C.Bold + "Right Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smash")); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/AbilityUseTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/AbilityUseTracker.java new file mode 100644 index 000000000..5291aa42e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/AbilityUseTracker.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import java.util.ArrayList; +import java.util.List; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.AbilityUseEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class AbilityUseTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private List _out = new ArrayList(); + + public AbilityUseTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onAbilityUse(AbilityUseEvent event) + { + if (!getGame().IsLive()) + return; + + if (isOut(event.getPlayer())) + return; + + setOut(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + if (getGame().getWinners() == null) + return; + + for (Player player : getGame().getWinners()) + { + if (isOut(player)) + continue; + + addStat(player); + } + + _out.clear(); + } + + private boolean isOut(Player player) + { + for (String out : _out) + { + if (out.equalsIgnoreCase(player.getName())) + { + return true; + } + } + return false; + } + + private void setOut(Player player) + { + if (isOut(player)) + return; + + _out.add(player.getName()); + } + + private void addStat(Player player) + { + addStat(player, "Hard Mode", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/FirstToSafepadTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/FirstToSafepadTracker.java new file mode 100644 index 000000000..694c7e873 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/FirstToSafepadTracker.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.FirstToSafepadEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class FirstToSafepadTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + public FirstToSafepadTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSafepadFirst(FirstToSafepadEvent event) + { + if (!getGame().IsLive()) + return; + + addStat(event.getPlayer()); + } + + private void addStat(Player player) + { + addStat(player, "Speed", 1, false, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/PilotTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/PilotTracker.java new file mode 100644 index 000000000..730764b74 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/PilotTracker.java @@ -0,0 +1,104 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import java.util.concurrent.ConcurrentHashMap; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.SnowmanHitEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PilotTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private ConcurrentHashMap _launched = new ConcurrentHashMap(); + + public PilotTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSnowmanHit(SnowmanHitEvent event) + { + if (!getGame().IsLive()) + return; + + if (isLaunched(event.getPlayer())) + return; + + setLaunched(event.getPlayer()); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!getGame().IsLive()) + { + _launched.clear(); + return; + } + + for (Player player : _launched.keySet()) + { + if (player == null || !player.isOnline() || !getGame().IsAlive(player) || UtilPlayer.isSpectator(player)) + { + _launched.remove(player); + + if (_launched.contains(player)) System.out.println("CONCURRENT HASHMAP BROKE AND STILL HAS THE PLAYER IN IT!"); + + continue; + } + + if (UtilEnt.isGrounded(player)) + { + _launched.remove(player); + + if (_launched.contains(player)) System.out.println("CONCURRENT HASHMAP BROKE AND STILL HAS THE PLAYER IN IT!"); + + if (getGame().getMaze().isOnPad(player)) + { + addStat(player); + } + + continue; + } + + if (UtilTime.elapsed(_launched.get(player), 2000)) + { + _launched.remove(player); + + if (_launched.contains(player)) System.out.println("CONCURRENT HASHMAP BROKE AND STILL HAS THE PLAYER IN IT!"); + + continue; + } + } + } + + private boolean isLaunched(Player player) + { + return _launched.containsKey(player); + } + + private void setLaunched(Player player) + { + _launched.put(player, System.currentTimeMillis()); + } + + private void addStat(Player player) + { + addStat(player, "Pilot", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SnowmanHitTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SnowmanHitTracker.java new file mode 100644 index 000000000..43d0e958c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SnowmanHitTracker.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import java.util.ArrayList; +import java.util.List; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.SnowmanHitEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class SnowmanHitTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private List _out = new ArrayList(); + + public SnowmanHitTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSnowmanHit(SnowmanHitEvent event) + { + if (!getGame().IsLive()) + return; + + if (isOut(event.getPlayer())) + return; + + setOut(event.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + if (getGame().getWinners() == null) + return; + + for (Player player : getGame().getWinners()) + { + if (isOut(player)) + continue; + + addStat(player); + } + + _out.clear(); + } + + private boolean isOut(Player player) + { + for (String out : _out) + { + if (out.equalsIgnoreCase(player.getName())) + { + return true; + } + } + return false; + } + + private void setOut(Player player) + { + if (isOut(player)) + return; + + _out.add(player.getName()); + } + + private void addStat(Player player) + { + addStat(player, "Ninja", 1, true, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SurvivePast15thSafepadTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SurvivePast15thSafepadTracker.java new file mode 100644 index 000000000..a82ac4e14 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monstermaze/trackers/SurvivePast15thSafepadTracker.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.game.games.monstermaze.trackers; + +import nautilus.game.arcade.game.games.monstermaze.MonsterMaze; +import nautilus.game.arcade.game.games.monstermaze.events.SafepadBuildEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class SurvivePast15thSafepadTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private int _cur = 0; + + public SurvivePast15thSafepadTracker(MonsterMaze game) + { + super(game); + } + + @EventHandler + public void onSafepadBuild(SafepadBuildEvent event) + { + if (!getGame().IsLive()) + return; + + _cur++; + + if (_cur > 15) + { + for (Player player : getGame().GetPlayers(true)) + { + addStat(player); + } + } + } + + private void addStat(Player player) + { + addStat(player, "ToughCompetition", 1, true, false); + } +}