diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 6f36f0dd3..20ae48d70 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -656,6 +656,52 @@ public enum Achievement new int[]{1}, AchievementCategory.MINE_STRIKE), + //MineWare + MINEWARE_VETERAN("Mineware Veteran", 1500, + new String[]{"MineWare.Veteran"}, + new String[]{"Win 50 games of Mineware"}, + new int[] {50}, + AchievementCategory.MINEWARE), + + MINEWARE_LAURA_CRAFT("Laura Craft", 800, + new String[]{"MineWare.LauraCraft"}, + new String[]{"Complete the maze challenge in under 8 seconds 3 times"}, + new int[] {3}, + AchievementCategory.MINEWARE), + + MINEWARE_PINATA_MASTER("Pinata Master", 800, + new String[]{"MineWare.PinataMaster"}, + new String[]{"In chicken shooter, hit 6 chickens without missing one"}, + new int[] {1}, + AchievementCategory.MINEWARE), + + MINEWARE_MILK_MAN("Professional Milk Man", 700, + new String[]{"MineWare.MilkMan"}, + new String[]{"In Milk the Cows, Collect 100 buckets of milk to the Farmer"}, + new int[] {100}, + AchievementCategory.MINEWARE), + + MINEWARE_TAG_MASTER("Tag Master", 700, + new String[]{"MineWare.TagMaster"}, + new String[]{"In reverse tag, Win an entire round without losing the tag"}, + new int[] {1}, + AchievementCategory.MINEWARE), + + MINEWARE_SURF_UP("Surf Up", 850, + new String[]{"MineWare.SurfUp"}, + new String[]{"Avoid 250 waves in Wave Crush"}, + new int[] {250}, + AchievementCategory.MINEWARE), + + MINEWARE_KANGAROO_AT_HEART("Kangaroo at Heart", 900, + new String[]{"MineWare.Kangaroo"}, + new String[]{"Complete Kangaroo Jump without falling once, 15 times"}, + new int[] {15}, + AchievementCategory.MINEWARE), + + + + //Bomb Lobbers BOMB_LOBBERS_WINS("Master Bomber", 1200, new String[]{"Bomb Lobbers.Wins"}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 2bf9be288..a3ed93543 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -58,6 +58,10 @@ public enum AchievementCategory new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED }, Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null), + MINEWARE("Mineware", null, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, + Material.SPONGE, 0, GameCategory.CLASSICS, null), + BLOCK_HUNT("Block Hunt", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"), 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 7056d8b8e..40ec84525 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 @@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase getWinners() + { + return Completed; + } public void setLost(Player player, boolean invis) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index e7d503b5a..573358076 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -1,19 +1,17 @@ package nautilus.game.arcade.game.games.mineware; import java.lang.reflect.InvocationTargetException; -import java.sql.Time; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; -import java.util.UUID; +import mineplex.core.account.CoreClient; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.UUIDFetcher; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -22,7 +20,6 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; -import mineplex.core.itemstack.ItemBuilder; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; @@ -38,8 +35,8 @@ import nautilus.game.arcade.game.games.holeinwall.KitNormal; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeAnvilDance; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeArrowRampage; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockLobbers; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockRunner; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBouncingBlock; -import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBuildRace; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeChestLoot; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeCloudFall; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDogvsCat; @@ -65,17 +62,23 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeShootChicken import nautilus.game.arcade.game.games.mineware.challenges.ChallengeSmashOff; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeStandOnColor; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTntLauncher; -import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTreasureDigger; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeVolleyPig; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeWaveCrush; -import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent; +import nautilus.game.arcade.game.games.mineware.stats.MinewareKangarooAtHeart; +import nautilus.game.arcade.game.games.mineware.stats.MinewareLauraCraftTracker; +import nautilus.game.arcade.game.games.mineware.stats.MinewareMilkManTracker; +import nautilus.game.arcade.game.games.mineware.stats.MinewarePinataMasterTracker; +import nautilus.game.arcade.game.games.mineware.stats.MinewareSurfUpTracker; +import nautilus.game.arcade.game.games.mineware.stats.MinewareTagMasterTracker; +import nautilus.game.arcade.game.games.mineware.stats.MinewareVeteranTracker; import nautilus.game.arcade.kit.Kit; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.block.Banner; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -84,6 +87,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; @@ -93,8 +97,6 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; -import com.sun.xml.internal.ws.resources.UtilMessages; - public class MineWare extends SoloGame implements IThrown { private HashMap _lives = new HashMap(); @@ -137,6 +139,15 @@ public class MineWare extends SoloGame implements IThrown Manager.GetCreature().SetDisableCustomDrops(true); PopulateOrders(); + + registerStatTrackers( + new MinewareVeteranTracker(this), + new MinewareSurfUpTracker(this), + new MinewareLauraCraftTracker(this), + new MinewareMilkManTracker(this), + new MinewarePinataMasterTracker(this), + new MinewareTagMasterTracker(this), + new MinewareKangarooAtHeart(this)); } @Override @@ -186,46 +197,39 @@ public class MineWare extends SoloGame implements IThrown public void PopulateOrders() { -// _challenges.add(ChallengeFallingBlocks.class); -// _challenges.add(ChallengeAnvilDance.class); -// _challenges.add(ChallengeBuildRace.class); -// _challenges.add(ChallengeFastFood.class); -// _challenges.add(ChallengeTreasureDigger.class); + _challenges.add(ChallengeAnvilDance.class); + _challenges.add(ChallengeFallingBlocks.class); + _challenges.add(ChallengeWaveCrush.class); + _challenges.add(ChallengePickASide.class);// + _challenges.add(ChallengeKOTL.class); + _challenges.add(ChallengePunchThePig.class); + _challenges.add(ChallengeDogvsCat.class); + _challenges.add(ChallengeShootChickens.class); + _challenges.add(ChallengeReverseTag.class); + _challenges.add(ChallengeKangarooJump.class); + _challenges.add(ChallengeMiniOITQ.class); + _challenges.add(ChallengeMineADiamond.class); + _challenges.add(ChallengeRushPush.class); + _challenges.add(ChallengeBlockLobbers.class); + _challenges.add(ChallengeStandOnColor.class); + _challenges.add(ChallengeMilkACow.class); + _challenges.add(ChallengeDragonEgg.class); + _challenges.add(ChallengeChestLoot.class); + _challenges.add(ChallengeLavaRun.class); + _challenges.add(ChallengeNavigateMaze.class); + _challenges.add(ChallengeVolleyPig.class); + _challenges.add(ChallengeSmashOff.class); + _challenges.add(ChallengeTntLauncher.class); + _challenges.add(ChallengeArrowRampage.class); + _challenges.add(ChallengeCloudFall.class); + _challenges.add(ChallengeInfestation.class); + _challenges.add(ChallengeBouncingBlock.class); + _challenges.add(ChallengeBlockRunner.class); + _challenges.add(ChallengeFastFood.class); + _challenges.add(ChallengeMinecartDance.class); + _challenges.add(ChallengeRedLightGreenLight.class); _challenges.add(ChallengeFishingDay.class); -// _challenges.add(ChallengeAnvilDance.class); -// _challenges.add(ChallengeFallingBlocks.class); -// _challenges.add(ChallengeWaveCrush.class); -// _challenges.add(ChallengePickASide.class);// -// _challenges.add(ChallengeKOTL.class); -// _challenges.add(ChallengePunchThePig.class); -// _challenges.add(ChallengeDogvsCat.class); -// _challenges.add(ChallengeShootChickens.class); -// _challenges.add(ChallengeReverseTag.class); -// _challenges.add(ChallengeKangarooJump.class); -// _challenges.add(ChallengeMiniOITQ.class); -// _challenges.add(ChallengeMineADiamond.class); -// _challenges.add(ChallengeRushPush.class); -// _challenges.add(ChallengeBlockLobbers.class); -// _challenges.add(ChallengeStandOnColor.class); -// _challenges.add(ChallengeMilkACow.class); -// _challenges.add(ChallengeDragonEgg.class); -// _challenges.add(ChallengeChestLoot.class); -// _challenges.add(ChallengeLavaRun.class); -// _challenges.add(ChallengeNavigateMaze.class); -// _challenges.add(ChallengeVolleyPig.class); -// _challenges.add(ChallengeSmashOff.class); -// _challenges.add(ChallengeTntLauncher.class); -// _challenges.add(ChallengeArrowRampage.class); -// _challenges.add(ChallengeCloudFall.class); -// _challenges.add(ChallengeInfestation.class); -// _challenges.add(ChallengeBouncingBlock.class); -// _challenges.add(ChallengeEvolutionOfCombat.class); -// _challenges.add(ChallengeBlockRunner.class); -// _challenges.add(ChallengeFastFood.class); -// _challenges.add(ChallengeMinecartDance.class); -// _challenges.add(ChallengeRedLightGreenLight.class); - // ============== trashed ============== // _challenges.add(ChallengeSimonSays.class); // _challenges.add(ChallengeHitTargets.class); @@ -301,7 +305,7 @@ public class MineWare extends SoloGame implements IThrown for(String currentMessage : messages) { - if(messages.get(messages.size()-1) != currentMessage) + if(messages.get(messages.size() - 1) != currentMessage) { UtilPlayer.message(player, C.cGreen + "ChallengeRule - " + C.cYellow + C.Bold + currentMessage); } @@ -401,7 +405,7 @@ public class MineWare extends SoloGame implements IThrown return; // Deregister - Bukkit.getServer().getPluginManager().callEvent(new challengeEndEvent(_challenge)); + Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge)); HandlerList.unregisterAll(_challenge); _challenge.EndOrder(); @@ -657,6 +661,7 @@ public class MineWare extends SoloGame implements IThrown _isChallengeStarted = true; _challenge.StartOrder(); + Bukkit.getServer().getPluginManager().callEvent(new ChallengeStartEvent(_challenge)); // Register events UtilServer.getServer().getPluginManager().registerEvents(_challenge, Manager.getPlugin()); @@ -732,6 +737,31 @@ public class MineWare extends SoloGame implements IThrown return _lives.get(player); } + public void onModeratorTeleport(PlayerCommandPreprocessEvent event) + { + if(!IsLive()) + { + return; + } + if(event.getMessage().equalsIgnoreCase("/tp") || event.getMessage().equalsIgnoreCase("/teleport")) + { + CoreClient staff = getArcadeManager().GetClients().Get(event.getPlayer()); + + if(staff.GetRank().has(Rank.MODERATOR)) + { + Player player = event.getPlayer(); + UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!"); + player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f); + + Scoreboard.ResetScore(player.getName()); + SetPlayerState(player, PlayerState.OUT); + + Manager.addSpectator(player, true); + } + + } + } + public void LoseLife(Player player, boolean isDeath) { if(!isDeath) @@ -786,7 +816,7 @@ public class MineWare extends SoloGame implements IThrown } // Deregister - Bukkit.getServer().getPluginManager().callEvent(new challengeEndEvent(_challenge)); + Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge)); HandlerList.unregisterAll(_challenge); _challenge.EndOrder(); @@ -809,7 +839,7 @@ public class MineWare extends SoloGame implements IThrown EndCheck(); } - + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) @@ -819,11 +849,11 @@ public class MineWare extends SoloGame implements IThrown return; } Scoreboard.Reset(); - + if(GetPlayers(false).size() > 14) { int alive = 0; - for(Player cAlive: _lives.keySet()) + for(Player cAlive : _lives.keySet()) { if(GetLives(cAlive) != 0) { @@ -840,13 +870,13 @@ public class MineWare extends SoloGame implements IThrown else { Scoreboard.WriteBlank(); - for(Player player: GetPlayers(false)) + for(Player player : GetPlayers(false)) { - + int currentLives = GetLives(player); String status; String currentlyOut = ""; - + if(_challenge != null) { if(_challenge.isLost(player)) @@ -858,7 +888,7 @@ public class MineWare extends SoloGame implements IThrown currentlyOut = C.cGreen + "✔ "; } } - + switch(currentLives) { case 5: diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java index 943698c15..767a649ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeArrowRampage.java @@ -16,7 +16,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.Challenge; import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; import org.bukkit.Location; import org.bukkit.Material; @@ -131,7 +131,7 @@ public class ChallengeArrowRampage extends Challenge } @EventHandler - public void onChallengeEnd(challengeEndEvent event) + public void onChallengeEnd(ChallengeEndEvent event) { for(Entity fBlocks: Host.WorldData.World.getEntities()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java index aa59f7fea..0e76744a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockLobbers.java @@ -38,7 +38,7 @@ public class ChallengeBlockLobbers extends Challenge public ChallengeBlockLobbers(MineWare host) { - super(host, ChallengeType.LastStanding, "Block Lobbers", "Hit players off the platform", "by punching with the block"); + super(host, ChallengeType.LastStanding, "Block Lobbers", "Hit players off the platform", "by throwing with the blocks"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java index 032cab41f..f3a23a7e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBouncingBlock.java @@ -44,7 +44,7 @@ public class ChallengeBouncingBlock extends Challenge public ChallengeBouncingBlock(MineWare host) { - super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool!", "Avoid standing on red wool!", "First to 10 wins!"); + super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool!", "Avoid landing on red wool!", "First to 10 wins!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java index 985b47d1d..60ea79cd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeCloudFall.java @@ -157,8 +157,6 @@ public class ChallengeCloudFall extends Challenge { return; } - Bukkit.broadcastMessage("Player " + event.GetDamageePlayer().getName() + " feel and had a Y on " + event.GetDamageePlayer().getLocation().getY()); - Bukkit.broadcastMessage("and when that's rounded it ends at: " + Math.round(event.GetDamageePlayer().getLocation().getY())); if(Math.round(event.GetDamageePlayer().getLocation().getY()) == 3) { event.SetCancelled("fell on wool"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java index 2e9aa61d7..cf9e0e00d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKOTL.java @@ -32,7 +32,7 @@ public class ChallengeKOTL extends Challenge public ChallengeKOTL(MineWare host) { - super(host, ChallengeType.FirstComplete, "King of the ladder", "Reach the top of the ladder"); + super(host, ChallengeType.FirstComplete, "King Of The Ladder", "Reach the top of the ladder"); } @Override @@ -177,8 +177,7 @@ public class ChallengeKOTL extends Challenge } if(UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB)) { - SetCompleted(player); - + SetCompleted(player, true); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java index 497b300fe..b5b303d0b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKangarooJump.java @@ -4,8 +4,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.List; -import java.util.logging.Logger; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilMath; @@ -22,17 +20,16 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; -import com.sun.org.apache.bcel.internal.generic.RETURN; - public class ChallengeKangarooJump extends Challenge { private long _gameTime = System.currentTimeMillis() + ((UtilMath.r(5) + 20) * 1000); private HashMap _players = new HashMap(); + private HashMap _playerJumpHeight = new HashMap(); public ChallengeKangarooJump(MineWare host) { - super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Block from block to block", "Highest player win!"); + super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Jump from block to block", "Highest players win!"); } @Override @@ -65,6 +62,7 @@ public class ChallengeKangarooJump extends Challenge for(Player player : Host.GetPlayers(true)) { _players.put(player.getName(), true); + _playerJumpHeight.put(player, 0); } Host.StrictAntiHack = false; } @@ -126,7 +124,7 @@ public class ChallengeKangarooJump extends Challenge } Player player = event.getPlayer(); - if(_players.get(player.getName()) == false) + if(_players.get(player.getName()) == false) // TODO fix { if(player.isOnGround()) { @@ -137,6 +135,41 @@ public class ChallengeKangarooJump extends Challenge UtilAction.velocity(player, 2, 0.4, 4, true); _players.put(player.getName(), false); } + + @EventHandler + public void playerJumpTracker(PlayerMoveEvent event) + { + if(!Host.IsLive()) + { + return; + } + Player player = event.getPlayer(); + if(player.getLocation().getBlockY() < 4) + { + return; + } + if(!player.isOnGround()) + { + return; + } + if(!_playerJumpHeight.containsKey(player)) + { + return; + } + if(isLost(player)) + { + _playerJumpHeight.remove(player); + } + if((player.getLocation().getBlockY() < _playerJumpHeight.get(player))) + { + _playerJumpHeight.remove(player); + return; + } + if(player.getLocation().getBlockY() > _playerJumpHeight.get(player)) + { + _playerJumpHeight.put(player, player.getLocation().getBlockY()); + } + } @EventHandler public void gameEndChecker(UpdateEvent event) @@ -161,12 +194,12 @@ public class ChallengeKangarooJump extends Challenge } ArrayList sortedList = sortHash(playerHeights); - for(int i = 0; i < (Host.GetPlayers(true).size()); i++) + for(int i = 0; i < (sortedList.size()); i++) { System.out.println(sortedList.get(i)); if(!isDone(Bukkit.getPlayer(sortedList.get(i)))) { - if(i <= (Host.GetPlayers(true).size() / 2)) + if(i < (sortedList.size() / 2)) { SetCompleted(Bukkit.getPlayer(sortedList.get(i))); } @@ -194,4 +227,9 @@ public class ChallengeKangarooJump extends Challenge }); return players; } + + public HashMap getPlayerHeight() + { + return _playerJumpHeight; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java index 61e246628..f72fcdf2b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMilkACow.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.disguise.disguises.DisguiseVillager; @@ -31,11 +32,11 @@ public class ChallengeMilkACow extends Challenge { private Villager _villager; private HashMap> _milked = new HashMap>(); - private HashMap _score = new HashMap(); + private HashMap _score = new HashMap(); public ChallengeMilkACow(MineWare host) { - super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows and deliver to the villager!"); + super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows", "Deliver the milk to the vilager"); } @Override @@ -79,7 +80,7 @@ public class ChallengeMilkACow extends Challenge disguise.setBaby(); Host.getArcadeManager().GetDisguise().disguise(disguise); player.getInventory().setItem(0, new ItemStack(Material.BUCKET)); - _score.put(player.getName(), 0); + _score.put(player, 0); } } @@ -204,8 +205,8 @@ public class ChallengeMilkACow extends Challenge { p.setItemInHand(new ItemStack(Material.BUCKET)); p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2, 0); - int score = _score.get(p.getName()) + 1; - _score.put(p.getName(), score); + int score = _score.get(p) + 1; + _score.put(p, score); displayCount(p, ((Villager) ent).getEyeLocation().add(0, 0.3, 0), (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen : score >= 2 ? C.cRed : C.cDRed) + score); @@ -225,6 +226,7 @@ public class ChallengeMilkACow extends Challenge { event.setCancelled(true); event.getPlayer().updateInventory(); + event.getPlayer().sendMessage(F.main("Mike the Cows", "Deliver the milk to the farmer!")); } @Override @@ -245,4 +247,9 @@ public class ChallengeMilkACow extends Challenge return spawns; } + + public HashMap getScore() + { + return _score; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java index ebb9a86f9..cc0de8839 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java @@ -19,125 +19,139 @@ import org.bukkit.inventory.ItemStack; public class ChallengeMineADiamond extends Challenge { - private ArrayList ores = new ArrayList(Arrays.asList(Material.IRON_ORE, Material.GOLD_ORE, Material.REDSTONE_ORE, - Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE)); + private ArrayList ores = new ArrayList(Arrays.asList(Material.IRON_ORE, Material.GOLD_ORE, Material.REDSTONE_ORE, + Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE)); - public ChallengeMineADiamond(MineWare host) - { - super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find the diamonds", "And mine them!"); - } - - @Override - public ArrayList getSpawns() - { - ArrayList spawns = new ArrayList(); - - for(int x = -getArenaSize()+1; x <= getArenaSize()-1; x++) + public ChallengeMineADiamond(MineWare host) { - for(int z = -getArenaSize()+1; z <= getArenaSize()-1; z++) - { - if(x % 2 == 0 && z % 2 == 0) - { - spawns.add(getCenter().clone().add(x + 0.5, 2.1, z + 0.5)); - } - } + super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find the diamonds", "And mine them!"); } - return spawns; - } - @Override - public void cleanupRoom() - { - Host.BlockBreak = false; - } - - @Override - public void setupPlayers() - { - for(Player player : Host.GetPlayers(true)) + @Override + public ArrayList getSpawns() { - player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE)); - } - Host.BlockBreak = true; - } + ArrayList spawns = new ArrayList(); - @Override - public void generateRoom() - { - int amountOfDiamonds = 0; - for(int x = -getArenaSize(); x <= getArenaSize(); x++) - { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) - { - for(int y = 0; y <= 1; y++) + for(int x = -getArenaSize() + 1; x <= getArenaSize() - 1; x++) { - Block b = getCenter().getBlock().getRelative(x, y, z); - - if(y == 0) - { - b.setType(Material.DIRT); - b.setData((byte) 2); - } - else - { - if(amountOfDiamonds == 0) + for(int z = -getArenaSize() + 1; z <= getArenaSize() - 1; z++) { - for(int i = 0; i < Math.ceil((Host.GetPlayers(true).size()+1) / 2); i++) - { - Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize()*2) - (getArenaSize()), 1, UtilMath.r(getArenaSize()*2) - (getArenaSize())); - if(copy.getType() == Material.DIAMOND_ORE) + if(x % 2 == 0 && z % 2 == 0) { - i--; - continue; + spawns.add(getCenter().clone().add(x + 0.5, 2.1, z + 0.5)); } - copy.setType(Material.DIAMOND_ORE); - addBlock(copy); - - amountOfDiamonds++; - } } - if(b.getType() != Material.DIAMOND_ORE) - { - b.setType(ores.get(UtilMath.r(ores.size()))); - } - - if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) - { - b.setType(Material.FENCE); - } - } - if(b.getType() != Material.AIR) - { - addBlock(b); - } } - } + return spawns; } - } - - @EventHandler - public void onDiamondMine(PlayerInteractEvent event) - { - if(!Host.IsLive()) + + @Override + public void cleanupRoom() { - return; + Host.BlockBreak = false; } - if(!Host.IsAlive(event.getPlayer())) + + @Override + public void setupPlayers() { - return; + for(Player player : Host.GetPlayers(true)) + { + player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE)); + } + Host.BlockBreak = true; } - if(IsCompleted(event.getPlayer())) + + @Override + public void generateRoom() { - event.setCancelled(true); - return; + int amountOfDiamonds = 0; + for(int x = -getArenaSize(); x <= getArenaSize(); x++) + { + for(int z = -getArenaSize(); z <= getArenaSize(); z++) + { + for(int y = 0; y <= 1; y++) + { + Block b = getCenter().getBlock().getRelative(x, y, z); + + if(y == 0) + { + b.setType(Material.DIRT); + b.setData((byte) 2); + } + else + { + if(amountOfDiamonds == 0) + { + for(int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++) + { + Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, + UtilMath.r(getArenaSize() * 2) - (getArenaSize())); + if(copy.getType() == Material.DIAMOND_ORE) + { + i--; + continue; + } + copy.setType(Material.DIAMOND_ORE); + addBlock(copy); + + amountOfDiamonds++; + } + } + if(b.getType() != Material.DIAMOND_ORE) + { + b.setType(ores.get(UtilMath.r(ores.size()))); + } + + if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) + { + b.setType(Material.FENCE); + } + } + if(b.getType() != Material.AIR) + { + addBlock(b); + } + } + } + } } - if(event.getAction() == Action.LEFT_CLICK_BLOCK) + + @EventHandler + public void onDiamondMine(PlayerInteractEvent event) { - if(event.getClickedBlock().getType() == Material.DIAMOND_ORE) - { - SetCompleted(event.getPlayer(), true); - event.getClickedBlock().setType(Material.AIR); - } + if(!Host.IsLive()) + { + return; + } + if(!Host.IsAlive(event.getPlayer())) + { + return; + } + if(IsCompleted(event.getPlayer())) + { + event.setCancelled(true); + return; + } + if(event.getAction() == Action.LEFT_CLICK_BLOCK) + { + if(event.getClickedBlock().getType() == Material.DIAMOND_ORE) + { + SetCompleted(event.getPlayer(), true); + event.getClickedBlock().setType(Material.AIR); + } + } + } + + @EventHandler + public void onPlayerMineblock(BlockBreakEvent event) + { + if(!Host.IsLive()) + { + return; + } + if(event.getBlock().getType() != Material.DIAMOND_ORE) + { + event.setCancelled(true); + } } - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java index e0c880527..d11d848c6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeNavigateMaze.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; +import java.util.HashMap; import mineplex.core.common.util.UtilPlayer; import nautilus.game.arcade.game.games.mineware.Challenge; @@ -10,12 +11,14 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; public class ChallengeNavigateMaze extends Challenge { + private HashMap _playerCompletionTime = new HashMap(); public ChallengeNavigateMaze(MineWare host) { super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze"); @@ -39,11 +42,18 @@ public class ChallengeNavigateMaze extends Challenge public void onMove(PlayerMoveEvent event) { if (UtilPlayer.isSpectator(event.getPlayer())) + { return; - + } + if(isDone(event.getPlayer())) + { + return; + } + if (event.getTo().getY() >= 1 && event.getTo().getX() > 16) { SetCompleted(event.getPlayer()); + _playerCompletionTime.put(event.getPlayer(), System.currentTimeMillis()); } } @@ -243,4 +253,9 @@ public class ChallengeNavigateMaze extends Challenge return blocks; } + + public HashMap getPlayerTimes() + { + return _playerCompletionTime; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java index 1e7c7cf32..e159c413b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePickASide.java @@ -32,7 +32,7 @@ public class ChallengePickASide extends Challenge public ChallengePickASide(MineWare host) { - super(host, ChallengeType.FirstComplete, "Pick a Side", "Stand on the side with the least players!"); + super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the least players win!"); } public int getMinPlayers() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java index 62f41590b..7a673f8d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRedLightGreenLight.java @@ -156,6 +156,10 @@ public class ChallengeRedLightGreenLight extends Challenge } if(!_canMove && !_cooldownedPlayers.contains(event.getPlayer().getName()) && _timeBeforeAction < System.currentTimeMillis()) { + if(event.getFrom().getBlockX() == event.getTo().getBlockX()) + { + return; + } UtilAction.velocity(event.getPlayer(), UtilAlg.getTrajectory2d(event.getPlayer().getLocation(), new Location(getCenter().getWorld(), -32, 5, 0)), 1.5, true, 0.4, 0, 10, true); _cooldownedPlayers.add(event.getPlayer().getName()); @@ -167,7 +171,7 @@ public class ChallengeRedLightGreenLight extends Challenge { _cooldownedPlayers.remove(event.getPlayer().getName()); } - }.runTaskLater(Host.Manager.getPlugin(), 40); + }.runTaskLater(Host.Manager.getPlugin(), 35); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java index c5300c4fc..7dabf6dc0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeReverseTag.java @@ -30,12 +30,16 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; public class ChallengeReverseTag extends Challenge { + private int _cooldown = 2; // in seconds private double _endTime; private double _startTime; private HashSet _tagged = new HashSet(); + private HashSet _cooldowned = new HashSet(); + private HashSet _nonTaggedPlayers = new HashSet(); public ChallengeReverseTag(MineWare Host) { @@ -78,6 +82,7 @@ public class ChallengeReverseTag extends Challenge for(Player player : players) { + _nonTaggedPlayers.add(player); if(looped % 2 == 0) { addTagged(player); @@ -166,6 +171,11 @@ public class ChallengeReverseTag extends Challenge event.SetCancelled("Damaged a nontagged person"); return; } + if(_cooldowned.contains(event.GetDamageePlayer().getName())) + { + event.SetCancelled("Damaged is on cooldown"); + return; + } removeTagged(event.GetDamageePlayer()); addTagged(event.GetDamagerPlayer(false)); } @@ -197,13 +207,29 @@ public class ChallengeReverseTag extends Challenge } } - private void removeTagged(Player player) + private void removeTagged(final Player player) { if(_tagged.contains(player.getName())) { UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!"); player.getInventory().setHelmet(new ItemStack(Material.AIR)); _tagged.remove(player.getName()); + _cooldowned.add(player.getName()); + + new BukkitRunnable() + { + + @Override + public void run() + { + _cooldowned.remove(player.getName()); + } + }.runTaskLater(Host.Manager.getPlugin(), 20*_cooldown); + + if(_nonTaggedPlayers.contains(player)) + { + _nonTaggedPlayers.remove(player); + } for(int i = 0; i <= 8; i++) { @@ -244,5 +270,9 @@ public class ChallengeReverseTag extends Challenge } } } - + + public HashSet getNonTaggedPlayers() + { + return _nonTaggedPlayers; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java index 1ad0e83bf..b37348c8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeShootChickens.java @@ -18,6 +18,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Arrow; import org.bukkit.entity.Chicken; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -33,6 +34,8 @@ public class ChallengeShootChickens extends Challenge private ArrayList _chickens = new ArrayList(); private HashMap _killedChickens = new HashMap(); private ArrayList _arrows = new ArrayList(); + + private HashMap _arrowsShot = new HashMap(); public ChallengeShootChickens(MineWare host) { @@ -58,7 +61,18 @@ public class ChallengeShootChickens extends Challenge @EventHandler public void onShoot(ProjectileLaunchEvent event) { - _arrows.add(event.getEntity()); + + if(event.getEntity() instanceof Arrow) + { + _arrows.add(event.getEntity()); + + Arrow arrow = (Arrow) event.getEntity(); + Player player = (Player) arrow.getShooter(); + if(!isDone(player)) + { + _arrowsShot.put(player, _arrowsShot.get(player)+1); + } + } } @EventHandler @@ -157,11 +171,11 @@ public class ChallengeShootChickens extends Challenge for (Player player : Host.GetPlayers(true)) { - player.getInventory().setItem(0, - new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build()); + player.getInventory().setItem(0,new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build()); player.getInventory().setItem(9, new ItemStack(Material.ARROW)); _killedChickens.put(player.getName(), 0); + _arrowsShot.put(player, 0); } Host.DamagePvE = true; @@ -229,4 +243,9 @@ public class ChallengeShootChickens extends Challenge return spawns; } + + public HashMap getArrowsShot() + { + return _arrowsShot; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSimonSays.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSimonSays.java index 0c7c3e642..931e922cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSimonSays.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSimonSays.java @@ -14,7 +14,7 @@ import mineplex.core.common.util.UtilTextBottom; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.Challenge; import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; import org.bukkit.Bukkit; import org.bukkit.Color; @@ -306,7 +306,7 @@ public class ChallengeSimonSays extends Challenge } @EventHandler - public void onChallengeEnd(challengeEndEvent event) + public void onChallengeEnd(ChallengeEndEvent event) { if(!(event.getEndedChallenge() instanceof ChallengeSimonSays)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaveCrush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaveCrush.java index e3ba1d7a8..1a2d9d1de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaveCrush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaveCrush.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.ListIterator; import mineplex.core.common.util.UtilMath; @@ -11,7 +12,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.Challenge; import nautilus.game.arcade.game.games.mineware.MineWare; -import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -32,6 +33,8 @@ public class ChallengeWaveCrush extends Challenge private int _waveAmount = 0; private int _waveSpeed = 30; // in ticks private ArrayList _colorList = new ArrayList(Arrays.asList(14, 11, 9, 3, 1, 4, 13, 5)); + + private HashMap _survivedWaves = new HashMap(); public ChallengeWaveCrush(MineWare host) { @@ -85,6 +88,11 @@ public class ChallengeWaveCrush extends Challenge @Override public void setupPlayers() { + for(Player player: Host.GetPlayers(true)) + { + _survivedWaves.put(player, 0); + } + _inProgress = true; new BukkitRunnable() @@ -112,6 +120,14 @@ public class ChallengeWaveCrush extends Challenge { _waveSpeed--; } + + for(Player player: _survivedWaves.keySet()) + { + if(!isDone(player)) + { + _survivedWaves.put(player, _survivedWaves.get(player)+1); + } + } } }.runTaskTimer(Host.Manager.getPlugin(), 20 * 3, _waveSpeed); } @@ -194,7 +210,7 @@ public class ChallengeWaveCrush extends Challenge } @EventHandler - public void OnChallengeEnd(challengeEndEvent event) + public void OnChallengeEnd(ChallengeEndEvent event) { for(Player player : Host.GetPlayers(true)) { @@ -248,4 +264,9 @@ public class ChallengeWaveCrush extends Challenge } }.runTaskTimer(Host.Manager.getPlugin(), 0, 2); } + + public HashMap getsurvivedwaves() + { + return _survivedWaves; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/ChallengeStartEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/ChallengeStartEvent.java new file mode 100644 index 000000000..a9c0f6b23 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/ChallengeStartEvent.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.games.mineware.events; + +import nautilus.game.arcade.game.games.mineware.Challenge; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ChallengeStartEvent extends Event +{ + private Challenge _startedChallenge; + private static final HandlerList _handlers = new HandlerList(); + + public ChallengeStartEvent(Challenge startedChallenge) + { + this._startedChallenge = startedChallenge; + } + + public Challenge getStartedChallenge() + { + return _startedChallenge; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/challengeEndEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/challengeEndEvent.java index 0d85528b1..bb90bf181 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/challengeEndEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/events/challengeEndEvent.java @@ -6,30 +6,30 @@ import nautilus.game.arcade.game.games.mineware.Challenge; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -public class challengeEndEvent extends Event +public class ChallengeEndEvent extends Event { private Challenge _endedChallenge; private static final HandlerList _handlers = new HandlerList(); - public challengeEndEvent(Challenge challenge) + public ChallengeEndEvent(Challenge challenge) { - this._endedChallenge = challenge; + this._endedChallenge = challenge; } public Challenge getEndedChallenge() { - return _endedChallenge; + return _endedChallenge; } - public static HandlerList getHandlerList() - { - return _handlers; - } + public static HandlerList getHandlerList() + { + return _handlers; + } - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareKangarooAtHeart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareKangarooAtHeart.java new file mode 100644 index 000000000..faead1ad5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareKangarooAtHeart.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKangarooJump; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewareKangarooAtHeart extends StatTracker +{ + + public MinewareKangarooAtHeart(Game game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onChallengeEnd(ChallengeEndEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + Challenge challenge = event.getEndedChallenge(); + + if(!(challenge instanceof ChallengeKangarooJump)) + { + return; + } + ChallengeKangarooJump kJump = (ChallengeKangarooJump) challenge; + + for(Player player: kJump.getPlayerHeight().keySet()) + { + if(!kJump.isLost(player)) + { + addStat(player, "Kangaroo", 1, false, false); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareLauraCraftTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareLauraCraftTracker.java new file mode 100644 index 000000000..e0d35d98b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareLauraCraftTracker.java @@ -0,0 +1,65 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeNavigateMaze; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewareLauraCraftTracker extends StatTracker +{ + + private long _challengeStartTime; + private int _timeForCompletion = 8; // in seconds + + public MinewareLauraCraftTracker(Game game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onMazeChallengeStart(ChallengeStartEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + Challenge challenge = event.getStartedChallenge(); + + if(!(challenge instanceof ChallengeNavigateMaze)) + { + return; + } + _challengeStartTime = System.currentTimeMillis(); + + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onMazeChallengeEnd(ChallengeEndEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + Challenge challenge = event.getEndedChallenge(); + + if(!(challenge instanceof ChallengeNavigateMaze)) + { + return; + } + ChallengeNavigateMaze challengeMaze = (ChallengeNavigateMaze) challenge; + for(Player player: challengeMaze.getPlayerTimes().keySet()) + { + if(challengeMaze.getPlayerTimes().get(player) <= (_challengeStartTime+(_timeForCompletion*1000))) + { + addStat(player, "LauraCraft", 1, false, false); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareMilkManTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareMilkManTracker.java new file mode 100644 index 000000000..90a6944bb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareMilkManTracker.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMilkACow; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewareMilkManTracker extends StatTracker +{ + + public MinewareMilkManTracker(Game game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onChallengeEnd(ChallengeEndEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + Challenge challenge = event.getEndedChallenge(); + if(!(challenge instanceof ChallengeMilkACow)) + { + return; + } + ChallengeMilkACow milk = (ChallengeMilkACow) challenge; + + for(Player player : milk.getScore().keySet()) + { + int score = milk.getScore().get(player); + if(!player.isOnline()) + { + continue; + } + addStat(player, "MilkMan", score, false, false); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewarePinataMasterTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewarePinataMasterTracker.java new file mode 100644 index 000000000..a26b633b9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewarePinataMasterTracker.java @@ -0,0 +1,48 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeShootChickens; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewarePinataMasterTracker extends StatTracker +{ + + public MinewarePinataMasterTracker(Game game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onChallengeEnd(ChallengeEndEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + + Challenge challenge = event.getEndedChallenge(); + + if(!(challenge instanceof ChallengeShootChickens)) + { + return; + } + ChallengeShootChickens chickChallenge = (ChallengeShootChickens) challenge; + + for(Player player: chickChallenge.getArrowsShot().keySet()) + { + if(chickChallenge.getArrowsShot().get(player) == 6 && challenge.IsCompleted(player)) + { + addStat(player, "PinataMaster", 1, true, false); + } + } + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareSurfUpTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareSurfUpTracker.java new file mode 100644 index 000000000..f07508c0d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareSurfUpTracker.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeWaveCrush; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewareSurfUpTracker extends StatTracker +{ + + public MinewareSurfUpTracker(Game game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onChallengeEnd(ChallengeEndEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + Challenge challenge = event.getEndedChallenge(); + + if(!(challenge instanceof ChallengeWaveCrush)) + { + return; + } + + ChallengeWaveCrush wave = (ChallengeWaveCrush) challenge; + + for(Player player: wave.getsurvivedwaves().keySet()) + { + int survivedWavesAmount = wave.getsurvivedwaves().get(player); + + if(survivedWavesAmount < 1) + { + continue; + } + addStat(player, "SurfUp", survivedWavesAmount, false, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareTagMasterTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareTagMasterTracker.java new file mode 100644 index 000000000..f43a60b73 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareTagMasterTracker.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeReverseTag; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewareTagMasterTracker extends StatTracker +{ + + public MinewareTagMasterTracker(Game game) + { + super(game); + System.out.println("3"); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onGameEnd(ChallengeEndEvent event) + { + if(getGame().GetState() != GameState.Live) + { + return; + } + + Challenge challenge = event.getEndedChallenge(); + + if(!(challenge instanceof ChallengeReverseTag)) + { + return; + } + ChallengeReverseTag tag = (ChallengeReverseTag) challenge; + + for(Player player: tag.getNonTaggedPlayers()) + { + if(tag.isLost(player)) + { + return; + } + addStat(player, "TagMaster", 1, true, false); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareVeteranTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareVeteranTracker.java new file mode 100644 index 000000000..f4fb7b5ea --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/stats/MinewareVeteranTracker.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.games.mineware.stats; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class MinewareVeteranTracker extends StatTracker +{ + public MinewareVeteranTracker(Game game) + { + super(game); + System.out.println("1"); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void tracePlayerWin(GameStateChangeEvent event) + { + if(event.GetState() == GameState.End) + { + for(Player player: getGame().getWinners()) + { + addStat(player, "Veteran", 1, true, false); + } + } + } + +}