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 f7e5f244f..3817df163 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 @@ -46,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase pageLayout = new ItemLayout( - "OXOXOXOXO", + "XXXXOXXXO", "OXOXOXOXO", "OXOXOXOXO", "OXOXOXOXO").getItemSlots(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java index a8eab375f..b58ccbc26 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java @@ -18,6 +18,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -25,29 +26,35 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.InventoryHolder; +import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.account.CoreClient; -import mineplex.core.blood.BloodEvent; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextTop; import mineplex.core.common.util.UtilTime; @@ -93,6 +100,7 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengePickASide; import nautilus.game.arcade.game.games.mineware.challenges.ChallengePunchThePig; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeRedLightGreenLight; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeReverseTag; +import nautilus.game.arcade.game.games.mineware.challenges.ChallengeRunner; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeRushPush; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeShootChickens; import nautilus.game.arcade.game.games.mineware.challenges.ChallengeSmashOff; @@ -222,6 +230,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown _challenges.add(ChallengePunchThePig.class); _challenges.add(ChallengeRedLightGreenLight.class); _challenges.add(ChallengeReverseTag.class); + _challenges.add(ChallengeRunner.class); // TODO: To be tested. _challenges.add(ChallengeRushPush.class); _challenges.add(ChallengeShootChickens.class); _challenges.add(ChallengeSmashOff.class); @@ -657,7 +666,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown Scoreboard.Reset(); - if (GetPlayers(true).size() > 14) + if (super.GetPlayers(true).size() > 14) { int alive = 0; @@ -761,19 +770,20 @@ public class BawkBawkBattles extends TeamGame implements IThrown List messages = Arrays.asList(challenge.getGameMessages()); - for (Player player : UtilServer.getPlayers()) + for (Player player : GetPlayers(true)) { - UtilPlayer.message(player, F.count(ArcadeFormat.Line)); + UtilPlayer.message(player, ""); + // UtilPlayer.message(player, F.count(ArcadeFormat.Line)); - UtilPlayer.message(player, " " + C.cYellow + challenge.getName()); + UtilPlayer.message(player, " " + C.cYellow + challenge.getName() + C.Reset + " " + C.cGray + challenge.getType().toString()); UtilPlayer.message(player, ""); for (String currentMessage : messages) if (messages.get(messages.size() - 1) != currentMessage) UtilPlayer.message(player, C.cGray + " - " + C.cWhite + currentMessage); - UtilPlayer.message(player, ""); - UtilPlayer.message(player, F.count(ArcadeFormat.Line)); + // UtilPlayer.message(player, ""); + // UtilPlayer.message(player, F.count(ArcadeFormat.Line)); } while (true) @@ -781,7 +791,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (!IsLive()) break; - for (Player player : UtilServer.getPlayers()) + for (Player player : GetPlayers(true)) { String message = C.cYellow + messages.get(looped); UtilTextMiddle.display(challenge.getName(), message, 0, 60, 20); @@ -870,7 +880,12 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (!IsLive()) return; - if (!IsAlive(event.getPlayer())) + Player player = event.getPlayer(); + + if (!IsAlive(player)) + return; + + if (!getChallengers().contains(player)) return; if (!PrepareFreeze) @@ -897,6 +912,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown return; Player player = event.getEntity(); + + if (_chickenTeam.HasPlayer(player)) + return; + Location death = player.getLocation().clone(); _challenge.getLost().add(player); @@ -959,7 +978,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown return lives; } - + public void handleFailure(Player player, boolean looseLife) { handleFailure(player, looseLife, false); @@ -973,7 +992,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown taskFailedMessage(player, lives(player)); // SetPlayerState(player, PlayerState.OUT); Manager.addSpectator(player, true); - + if (cloak) Manager.GetCondition().Factory().Cloak("Challenge Death", player, player, 7777, true, true); } @@ -994,7 +1013,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown if (player.equals(other)) continue; - if (UtilMath.offset(other, player) > 5) + if (UtilMath.offset(other, player) > 7) continue; if (Recharge.Instance.use(player, "Approach Alive Player", 500, false, false)) @@ -1010,6 +1029,82 @@ public class BawkBawkBattles extends TeamGame implements IThrown } } + @EventHandler + public void onChickenAttack(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + if (_chickenTeam == null) + return; + + if (_chickenTeam.GetSize() == 0) + return; + + for (Player player : _chickenTeam.GetPlayers(true)) + { + Chicken chicken = UtilMath.randomElement(_chickenAttack.getChickens()); + + // Chickens attacking too many players. + if (!chicken.isOnGround()) + return; + + UtilEnt.CreatureLook(chicken, player); + + //UtilAction.velocity(chicken, UtilAlg.calculateVelocity(player.getVelocity(), chicken.getVelocity(), 1.0D)); + UtilAction.velocity(chicken, UtilAlg.getTrajectory(chicken, player).setY(0.3D)); + + Manager.GetProjectile().AddThrow( + chicken, + null, + this, + -1, + true, + false, + false, + true, + 0.8F); + } + } + + @EventHandler + public void onChickenAttackParticle(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + for (Chicken chicken : _chickenAttack.getChickens()) + { + if (!chicken.isOnGround()) + { + UtilParticle.PlayParticle(ParticleType.FLAME, chicken.getLocation(), 0.1F, 0.1F, 0.1F, 0.02F, 1, ViewDist.NORMAL); + } + } + } + + @EventHandler + public void onChickenAttackPlayerDeath(PlayerDeathEvent event) + { + if (!IsLive()) + return; + + if (_challenge == null) + return; + + Player player = event.getEntity(); + + if (!_chickenTeam.HasPlayer(player)) + return; + + _chickenAttack.kill(player); + } + private void gameLostMessage(Player player) { UtilPlayer.message(player, ""); @@ -1236,8 +1331,8 @@ public class BawkBawkBattles extends TeamGame implements IThrown _chickenAttack = new ChickenAttack( this, new Location(WorldData.World, 50, 0, 0), - new Location(WorldData.World, 47, 0, -3), - new Location(WorldData.World, 53, 0, 3)); + new Location(WorldData.World, 45, 0, -5), + new Location(WorldData.World, 55, 0, 5)); } @EventHandler @@ -1260,11 +1355,26 @@ public class BawkBawkBattles extends TeamGame implements IThrown UtilTextMiddle.display(null, null, player); } } - + @EventHandler - public void onBlood(BloodEvent event) + public void onItemSpawn(ItemSpawnEvent event) { - event.setCancelled(true); + if (!IsLive()) + return; + + Item blood = event.getEntity(); + ItemStack bloodItem = blood.getItemStack(); + + if (bloodItem.getType() == Material.INK_SACK && bloodItem.getData().getData() == 1) + { + if (bloodItem.hasItemMeta()) + { + if (bloodItem.getItemMeta().hasDisplayName()) + { + event.setCancelled(true); + } + } + } } @EventHandler @@ -1458,6 +1568,23 @@ public class BawkBawkBattles extends TeamGame implements IThrown public void Collide(LivingEntity target, Block block, ProjectileUser data) { getCurrentChallenge().onCollide(target, block, data); + + if (data.GetThrown() instanceof Chicken) + { + if (target instanceof Player) + { + Player player = (Player) target; + + if (_chickenTeam.HasPlayer(player) && IsAlive(player)) + { + player.playSound(player.getLocation(), Sound.CHICKEN_HURT, 2.0F, 1.0F); + player.damage(4.0D); + + if (UtilMath.random.nextBoolean()) + UtilTextBottom.display(C.cRed + C.Bold + "bawk bawk!", player); + } + } + } } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java index 87cf029c6..00a0bb579 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/Challenge.java @@ -32,11 +32,6 @@ import nautilus.game.arcade.world.WorldData; public abstract class Challenge implements Listener { - public enum ChallengeType - { - LastStanding, FirstComplete - } - public BawkBawkBattles Host; private String _name; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java index 11e07fb0f..647f9a8da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/ChallengeSeperateRooms.java @@ -4,11 +4,11 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; -import mineplex.core.common.util.UtilPlayer; - import org.bukkit.Location; import org.bukkit.entity.Player; +import mineplex.core.common.util.UtilPlayer; + public abstract class ChallengeSeperateRooms extends Challenge { private HashMap _borders = new HashMap(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java index 360c3e54c..801a5fa3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeAnvilDance.java @@ -28,6 +28,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilShapes; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeAnvilDance extends Challenge { @@ -56,7 +57,12 @@ public class ChallengeAnvilDance extends Challenge public ChallengeAnvilDance(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Anvil Dance", "It's raining anvils!", "Dodge them to stay alive."); + super( + host, + ChallengeType.LastStanding, + "Anvil Dance", + "It's raining anvils!", + "Dodge them to stay alive."); } @Override @@ -321,7 +327,7 @@ public class ChallengeAnvilDance extends Challenge if (times <= 10) { UtilFirework.playFirework(new Location(Host.WorldData.World, 0, height, 0), Type.BALL_LARGE, - Color.fromBGR(UtilMath.r(255), UtilMath.r(255), UtilMath.r(255)), false, true); + Color.fromBGR(UtilMath.r(255), UtilMath.r(255), UtilMath.r(255)), false, true); } height += _fireworkHeightIncrement; 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 abf8411b3..ea310e3ff 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 @@ -29,6 +29,7 @@ import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.game.games.mineware.AntiHackFix; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; public class ChallengeArrowRampage extends Challenge @@ -45,8 +46,7 @@ public class ChallengeArrowRampage extends Challenge false, true, "You are equipped with explosive arrows.", - "Force your enemy into the void!" - ); + "Force your enemy into the void!"); _antiHackFix = new AntiHackFix(this); } @@ -88,7 +88,7 @@ public class ChallengeArrowRampage extends Challenge for (Player player : Host.GetPlayers(true)) { player.getInventory() - .addItem(new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); + .addItem(new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); player.getInventory().addItem(new ItemStack(Material.ARROW)); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 2)); @@ -209,7 +209,7 @@ public class ChallengeArrowRampage extends Challenge { Block hit = null; BlockIterator iterator = new BlockIterator(arrow.getLocation().getWorld(), arrow.getLocation().toVector(), - arrow.getVelocity().normalize(), 0.0D, 4); + arrow.getVelocity().normalize(), 0.0D, 4); while (iterator.hasNext()) { hit = iterator.next(); 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 73816bd8e..2b8e0b6b9 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 @@ -27,11 +27,12 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeBlockLobbers extends Challenge { private ArrayList _tBlocks = new ArrayList( - Arrays.asList(Material.GRASS, Material.DIRT, Material.SPONGE, Material.WOOD)); + Arrays.asList(Material.GRASS, Material.DIRT, Material.SPONGE, Material.WOOD)); public ChallengeBlockLobbers(BawkBawkBattles host) { @@ -39,8 +40,7 @@ public class ChallengeBlockLobbers extends Challenge host, ChallengeType.LastStanding, "Block Lobbers", "Throw blocks to other players.", - "Try to knock them off the platform!" - ); + "Try to knock them off the platform!"); } @Override @@ -150,8 +150,8 @@ public class ChallengeBlockLobbers extends Challenge return; } FallingBlock fBlock = event.getPlayer().getWorld() - .spawnFallingBlock(event.getPlayer().getLocation().clone().add(0, .4, 0), - event.getPlayer().getItemInHand().getType(), (byte) 0); + .spawnFallingBlock(event.getPlayer().getLocation().clone().add(0, .4, 0), + event.getPlayer().getItemInHand().getType(), (byte) 0); UtilInv.remove(event.getPlayer(), event.getPlayer().getItemInHand().getType(), (byte) 0, 1); UtilAction.velocity(fBlock, event.getPlayer().getLocation().getDirection(), 1.5, false, 0.0, 0.3, 10.0, true); @@ -204,7 +204,7 @@ public class ChallengeBlockLobbers extends Challenge return; } UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), 0.8, - false, 0, 0.3, 0.5, true); + false, 0, 0.3, 0.5, true); data.GetThrown().remove(); } 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 6d6caa415..9b71ed236 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 @@ -30,6 +30,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.AntiHackFix; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeBouncingBlock extends Challenge { @@ -39,8 +40,13 @@ public class ChallengeBouncingBlock extends Challenge public ChallengeBouncingBlock(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch floating wool blocks.", - "Avoid landing on red wool.", "First to 10 wins!"); + super( + host, + ChallengeType.FirstComplete, + "Bouncing Block", + "Jump and punch floating wool blocks.", + "Avoid landing on red wool.", + "First to 10 wins!"); _antiHackFix = new AntiHackFix(this); } @@ -51,7 +57,7 @@ public class ChallengeBouncingBlock extends Challenge ArrayList spawns = new ArrayList(); for (Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), true, - getArenaSize(9) - 2)) + getArenaSize(9) - 2)) { spawns.add(getCenter().clone().add(locs.getX() + 0.5, 1.1, locs.getZ() + 0.5)); } @@ -92,7 +98,7 @@ public class ChallengeBouncingBlock extends Challenge public void generateRoom() { for (Location location : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), false, - getArenaSize(9))) + getArenaSize(9))) { Block block = location.getBlock(); block.setType(Material.WOOL); @@ -160,7 +166,7 @@ public class ChallengeBouncingBlock extends Challenge continue; UtilTextBottom.display(C.Bold + "Score: " + C.Reset + C.cYellow + C.Bold + _playerScore.get(player), - player); + player); } } @@ -197,7 +203,7 @@ public class ChallengeBouncingBlock extends Challenge subtract(player, subtract); UtilTextMiddle.display("", "Score decreased by " + C.cRed + subtract + C.Reset + "!", 5, 40, 5, - player); + player); player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0F, 1.0F); } } @@ -266,7 +272,7 @@ public class ChallengeBouncingBlock extends Challenge b.setData(color); UtilFirework.playFirework(b.getLocation().add(0.5, 0.5, 0.5), Type.BALL, - DyeColor.getByWoolData(b.getData()).getColor(), false, false); + DyeColor.getByWoolData(b.getData()).getColor(), false, false); _scoreBlocks.add(b); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java deleted file mode 100644 index 4455003c2..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildBuilding.java +++ /dev/null @@ -1,88 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.challenges; - -import java.util.ArrayList; -import java.util.HashMap; - -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; - -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.ChallengeSeperateRooms; - -public class ChallengeBuildBuilding extends ChallengeSeperateRooms -{ - private ArrayList _materials = new ArrayList(); - private HashMap _build = new HashMap(); - - public ChallengeBuildBuilding(BawkBawkBattles host, String challengeName) - { - super(host, ChallengeType.FirstComplete, "Replicate the building!"); - - for (int x = 0; x < 3; x++) - { - for (int y = 0; y < 5; y++) - { - for (int z = 0; z < 3; z++) - { - - } - } - } - } - - @Override - public void generateRoom(Location loc) - { - // TODO Auto-generated method stub - - } - - @Override - public int getBorderX() - { - return 10; - } - - @Override - public int getBorderY() - { - return 20; - } - - @Override - public int getBorderZ() - { - return 10; - } - - @Override - public int getDividersX() - { - return 5; - } - - @Override - public int getDividersZ() - { - return 5; - } - - @Override - public void cleanupRoom() - { - // TODO Auto-generated method stub - - } - - @Override - public void setupPlayers() - { - for (Player player : getChallengers()) - { - player.setGameMode(GameMode.CREATIVE); - } - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildRace.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildRace.java index 8947febd5..13b865354 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildRace.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBuildRace.java @@ -4,17 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.common.util.UtilTextMiddle; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -25,6 +14,18 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilTextMiddle; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeBuildRace extends Challenge { // The amount of blocks for every hotbar slot. @@ -44,8 +45,12 @@ public class ChallengeBuildRace extends Challenge public ChallengeBuildRace(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Build Race", "Your inventory is filled with blocks.", - "Be the first to place them all in the ground!"); + super( + host, + ChallengeType.FirstComplete, + "Build Race", + "Your inventory is filled with blocks.", + "Place them all in the ground!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java index fb01bd51f..3cdfab6cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChestLoot.java @@ -2,10 +2,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; -import mineplex.core.common.util.UtilMath; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -18,11 +14,20 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.UtilMath; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeChestLoot extends Challenge { public ChallengeChestLoot(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete,"Diamond Seeker", "Find a diamond in the chests."); + super( + host, + ChallengeType.FirstComplete, + "Diamond Seeker", + "Find a diamond in the chests."); } @Override @@ -30,9 +35,9 @@ public class ChallengeChestLoot extends Challenge { ArrayList spawns = new ArrayList(); - for (int x = -(getArenaSize() - 1); x <= getArenaSize()-1; x++) + for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++) { - for (int z = -(getArenaSize() - 1); z <= getArenaSize()-1; z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) { if (x % 2 == 0 && z % 2 == 0) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChickenFishing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChickenFishing.java deleted file mode 100644 index 1317930bf..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeChickenFishing.java +++ /dev/null @@ -1,125 +0,0 @@ -package nautilus.game.arcade.game.games.mineware.challenges; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - -public class ChallengeChickenFishing extends Challenge -{ - private ArrayList _chickens = new ArrayList(); - private ArrayList _spawns = new ArrayList(); - private ArrayList _chickenSpawns = new ArrayList(); - - public ChallengeChickenFishing(BawkBawkBattles host) - { - super(host, ChallengeType.FirstComplete,"Chicken Fishing", "Fish all dem Chickens"); - } - - @Override - public ArrayList getSpawns() - { - return _spawns; - } - - @EventHandler - public void onSecond(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - { - return; - } - - Iterator itel = _chickens.iterator(); - - while (itel.hasNext()) - { - Entity ent = itel.next(); - - // TODO Validate chicken is caught - - if (!ent.isValid()) - { - itel.remove(); - } - } - - for (Player player : getChallengers()) - { - Block block = player.getLocation().getBlock(); - - if (block.isLiquid()) - { - setLost(player); - } - } - } - - @Override - public void cleanupRoom() - { - for (Entity chicken : _chickens) - { - chicken.remove(); - } - } - - @Override - public void setupPlayers() - { - for (Player player : getChallengers()) - { - player.getInventory().addItem(new ItemStack(Material.FISHING_ROD)); - } - } - - @Override - public void generateRoom() - { - int size = (getChallengers().size() / 2) + 4; - - for (Location location : UtilShapes.getCircle(getCenter(), true, size)) - { - Block block = location.getBlock(); - - for (int y = 0; y <= 7; y++) - { - Block b = block.getRelative(0, y, 0); - - if (y < 3 || (y < 5 && UtilMath.random.nextBoolean())) - { - b.setType(Material.STONE); - } - else if (y != 7) - { - b.setType(Material.DIRT); - } - else - { - b.setType(Material.GRASS); - } - } - - _spawns.add(location.clone().add(0.5, 7.1, 0.5)); - } - - for (Location location : UtilShapes.getCircle(getCenter(), false, - size - 1)) - { - _chickenSpawns.add(location.add(0.5, 0.5, 0.5)); - } - } -} 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 58e7cede2..cd74200a7 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 @@ -15,12 +15,18 @@ import mineplex.core.common.util.UtilShapes; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeCloudFall extends Challenge { public ChallengeCloudFall(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Cloud Fall", "Jump and land on the green wool.", "Make sure to avoid the clouds.", "First to the bottom wins!"); + super( + host, + ChallengeType.FirstComplete, + "Cloud Fall", + "Jump and land on green wool.", + "Avoid the deadly clouds!"); } @Override @@ -28,24 +34,24 @@ public class ChallengeCloudFall extends Challenge { { ArrayList spawns = new ArrayList(); - for(int x = -(getArenaSize() - 1); x <= getArenaSize(); x++) + for (int x = -(getArenaSize() - 1); x <= getArenaSize(); x++) { - for(int z = -(getArenaSize() - 1); z <= getArenaSize(); z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize(); z++) { boolean goodSpawn = true; int y = 73; - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { - while(Host.WorldData.World.getBlockAt(x, y, z).getType() == Material.AIR) + while (Host.WorldData.World.getBlockAt(x, y, z).getType() == Material.AIR) { - if(y > 76) + if (y > 76) { goodSpawn = false; break; } y++; } - if(goodSpawn) + if (goodSpawn) { spawns.add(getCenter().clone().add(x + 0.5, y + 1.1, z + 0.5)); } @@ -73,33 +79,33 @@ public class ChallengeCloudFall extends Challenge @Override public void generateRoom() { - for(int x = -getArenaSize(); x <= getArenaSize(); x++) + for (int x = -getArenaSize(); x <= getArenaSize(); x++) { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 0; y <= 75; y++) + for (int y = 0; y <= 75; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(y == 0) + if (y == 0) { b.setType(Material.WOOL); } - if(y == 1 && Math.abs(x) < getArenaSize()-2 && Math.abs(z) < getArenaSize()-2) + if (y == 1 && Math.abs(x) < getArenaSize() - 2 && Math.abs(z) < getArenaSize() - 2) { - if(UtilMath.r(8) == 0) + if (UtilMath.r(8) == 0) { b.setType(Material.WOOL); b.setData((byte) 5); - + b.getRelative(BlockFace.UP).setType(Material.WOOL); - b.getRelative(BlockFace.UP).setData((byte)5); + b.getRelative(BlockFace.UP).setData((byte) 5); addBlock(b.getRelative(BlockFace.UP)); } } - if(y > 10 && y < 70) + if (y > 10 && y < 70) { - if(UtilMath.r(200) == 1) + if (UtilMath.r(200) == 1) { // RIP DRY rule ;-;. plz don't hurt me :( b.getRelative(BlockFace.NORTH).setType(Material.STAINED_CLAY); @@ -113,7 +119,7 @@ public class ChallengeCloudFall extends Challenge addBlock(b.getRelative(BlockFace.SOUTH)); } } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } @@ -122,13 +128,13 @@ public class ChallengeCloudFall extends Challenge } // The spawning platform int size = 8; - for(Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 75, 0), false, size)) + for (Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 75, 0), false, size)) { locs.getBlock().setType(Material.WOOL); locs.getBlock().setData((byte) UtilMath.r(16)); addBlock(locs.getBlock()); } - for(Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 75, 0), false, size/2)) + for (Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 75, 0), false, size / 2)) { locs.getBlock().setType(Material.AIR); } @@ -138,30 +144,30 @@ public class ChallengeCloudFall extends Challenge @EventHandler public void onfallDamage(CustomDamageEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!(event.GetDamageeEntity() instanceof Player)) + if (!(event.GetDamageeEntity() instanceof Player)) { return; } - if(event.GetCause() != DamageCause.FALL) + if (event.GetCause() != DamageCause.FALL) { return; } - if(isDone(event.GetDamageePlayer())) + if (isDone(event.GetDamageePlayer())) { return; } - if(Math.round(event.GetDamageePlayer().getLocation().getY()) == 3) + if (Math.round(event.GetDamageePlayer().getLocation().getY()) == 3) { event.SetCancelled("fell on wool"); SetCompleted(event.GetDamageePlayer()); } -// else -// { -// event.AddMod("Increased Damage", "Missed jump", 2, false); -// } + // else + // { + // event.AddMod("Increased Damage", "Missed jump", 2, false); + // } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogsVersusCats.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogsVersusCats.java index 1d65d73f0..5a36ab7ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogsVersusCats.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDogsVersusCats.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; @@ -30,6 +29,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeDogsVersusCats extends Challenge { @@ -42,8 +42,14 @@ public class ChallengeDogsVersusCats extends Challenge public ChallengeDogsVersusCats(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "If you are a dog, bark.", "If you are a cat, meow.", - "Look up and punch to bark or meow.", "First team to the end number wins!"); + super( + host, + ChallengeType.FirstComplete, + "Dogs Vs Cats", + "If you are a dog, bark.", + "If you are a cat, meow.", + "Look up and punch to bark or meow.", + "First team to the end number wins!"); } @Override @@ -101,7 +107,7 @@ public class ChallengeDogsVersusCats extends Challenge Host.getArcadeManager().GetDisguise().disguise(Ddog); player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, C.Reset + C.Bold + "Left-Click to bark!")); + ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, C.Reset + C.Bold + "Left-Click to bark!")); UtilPlayer.message(player, C.cYellow + C.Bold + "You are a Dog, bark!"); } else @@ -112,7 +118,7 @@ public class ChallengeDogsVersusCats extends Challenge Host.getArcadeManager().GetDisguise().disguise(Dcat); player.getInventory().addItem( - ItemStackFactory.Instance.CreateStack(Material.STRING, (byte) 0, 1, C.Reset + C.Bold + "Left-Click to meow!")); + ItemStackFactory.Instance.CreateStack(Material.STRING, (byte) 0, 1, C.Reset + C.Bold + "Left-Click to meow!")); UtilPlayer.message(player, C.cYellow + C.Bold + "You are a Cat, meow!"); } looped++; @@ -187,7 +193,7 @@ public class ChallengeDogsVersusCats extends Challenge int dogScore = calculateScore("dog"); UtilTextMiddle.display("", C.cBlue + C.Bold + " Dogs: " + C.cGreen + _dogScore + "/" + dogScore + C.cGray + " - " + C.cRed + C.Bold - + "Cats: " + C.cGreen + _catScore + "/" + catScore); + + "Cats: " + C.cGreen + _catScore + "/" + catScore); if (_catScore >= catScore) { @@ -251,7 +257,7 @@ public class ChallengeDogsVersusCats extends Challenge event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.WOLF_BARK, 1f, 1f); } UtilParticle.PlayParticle(ParticleType.NOTE, event.getPlayer().getLocation().add(0.5, 1, 0.5), 0.5f, 0.5f, 0.5f, 0f, 2, ViewDist.MAX, - UtilServer.getPlayers()); + UtilServer.getPlayers()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java index 76b192699..2509394fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeDragonEgg.java @@ -22,6 +22,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeDragonEgg extends Challenge { @@ -30,7 +31,11 @@ public class ChallengeDragonEgg extends Challenge public ChallengeDragonEgg(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Dragon egg", "Whack a dragon egg 10 times."); + super( + host, + ChallengeType.FirstComplete, + "Dragon egg", + "Whack a dragon egg 10 times."); } @Override @@ -76,22 +81,22 @@ public class ChallengeDragonEgg extends Challenge block.setType(Material.AIR); UtilParticle.PlayParticle(ParticleType.PORTAL, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 11, - ViewDist.MAX, - UtilServer.getPlayers()); + ViewDist.MAX, + UtilServer.getPlayers()); Host.CreatureAllowOverride = true; for (int i = 0; i < 10; i++) { Block b = getCenter().clone() - .add(UtilMath.r((getArenaSize() * 2)) - (getArenaSize()), 1, - UtilMath.r((getArenaSize() * 2)) - (getArenaSize())) - .getBlock(); + .add(UtilMath.r((getArenaSize() * 2)) - (getArenaSize()), 1, + UtilMath.r((getArenaSize() * 2)) - (getArenaSize())) + .getBlock(); if (b.getType() == Material.AIR) { Entity entity = getCenter().getWorld().spawnFallingBlock(b.getLocation().add(0.5, 2, 0.5), - Material.DRAGON_EGG, (byte) 0); + Material.DRAGON_EGG, (byte) 0); _dragonEggs.add(entity); @@ -111,8 +116,8 @@ public class ChallengeDragonEgg extends Challenge int score = _smashedEggs.get(player.getName()) + 1; displayCount(player, block.getLocation().add(0.5, 1, 0.5), - (score >= 10 ? C.cDGreen : score >= 7 ? C.cGreen : score >= 4 ? C.cRed : C.cDRed) - + score); + (score >= 10 ? C.cDGreen : score >= 7 ? C.cGreen : score >= 4 ? C.cRed : C.cDRed) + + score); _smashedEggs.put(player.getName(), score); @@ -140,7 +145,7 @@ public class ChallengeDragonEgg extends Challenge { _smashedEggs.put(player.getName(), 0); player.getInventory().setItem(0, - new ItemBuilder(Material.IRON_AXE).setTitle(C.cWhite + "Egg Smasher").build()); + new ItemBuilder(Material.IRON_AXE).setTitle(C.cWhite + "Egg Smasher").build()); } } @@ -162,7 +167,7 @@ public class ChallengeDragonEgg extends Challenge for (int i = 0; i < 9; i++) { Block b = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, - UtilMath.r(getArenaSize() * 2) - (getArenaSize())); + UtilMath.r(getArenaSize() * 2) - (getArenaSize())); b.setType(Material.DRAGON_EGG); addBlock(b); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFallingBlocks.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFallingBlocks.java index 597712aed..f2a76e341 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFallingBlocks.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFallingBlocks.java @@ -3,17 +3,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.HashSet; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.common.util.UtilTextBottom; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -28,6 +17,18 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.scheduler.BukkitRunnable; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilTextBottom; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeFallingBlocks extends Challenge { // The chance of an anvil to spawn in a single block. @@ -55,21 +56,36 @@ public class ChallengeFallingBlocks extends Challenge private HashSet _remaining = new HashSet(); // The array of materials used to generate random falling blocks. - private Material[] _materials = - { Material.GRASS, Material.DIRT, Material.STONE, Material.LOG, Material.WOOD, Material.COBBLESTONE, Material.GRAVEL, Material.COAL_ORE, - Material.IRON_ORE, Material.HAY_BLOCK, Material.JUKEBOX, Material.SMOOTH_BRICK, Material.EMERALD_ORE, Material.FURNACE }; + private Material[] _materials = { + Material.GRASS, + Material.DIRT, + Material.STONE, + Material.LOG, + Material.WOOD, + Material.COBBLESTONE, + Material.GRAVEL, + Material.COAL_ORE, + Material.IRON_ORE, + Material.HAY_BLOCK, + Material.JUKEBOX, + Material.SMOOTH_BRICK, + Material.EMERALD_ORE, + Material.FURNACE }; // The array of materials used to generate random floor. - private Material[] _floor = - { Material.GRASS, Material.DIRT, Material.STONE, Material.COBBLESTONE }; + private Material[] _floor = { Material.GRASS, Material.DIRT, Material.STONE, Material.COBBLESTONE }; // The array of sounds used to play when a new wave is being deployed. - private Sound[] _sounds = - { Sound.DIG_GRASS, Sound.DIG_GRAVEL, Sound.DIG_SAND, Sound.DIG_SNOW, Sound.DIG_STONE, Sound.DIG_WOOD, Sound.DIG_WOOL }; + private Sound[] _sounds = { Sound.DIG_GRASS, Sound.DIG_GRAVEL, Sound.DIG_SAND, Sound.DIG_SNOW, Sound.DIG_STONE, Sound.DIG_WOOD, Sound.DIG_WOOL }; public ChallengeFallingBlocks(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Falling Blocks", "Blocks are falling from the sky!", "Try to avoid getting hit."); + super( + host, + ChallengeType.LastStanding, + "Falling Blocks", + "Blocks are falling from the sky!", + "Try to avoid getting hit."); _time = (int) _nextWave; _modifiedSpawnChance = _spawnChance; @@ -81,7 +97,7 @@ public class ChallengeFallingBlocks extends Challenge ArrayList spawns = new ArrayList(); Location center = new Location(Host.WorldData.World, 0, 0, 0); - for(Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3)) + for (Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3)) { double x = location.getX() + 0.5; double y = 1.1; @@ -99,15 +115,15 @@ public class ChallengeFallingBlocks extends Challenge { Location center = new Location(Host.WorldData.World, 0, 0, 0); - for(Location location : UtilShapes.getCircle(center, false, getArenaSize())) + for (Location location : UtilShapes.getCircle(center, false, getArenaSize())) { Material material = _floor[UtilMath.r(_floor.length)]; Block block = location.getBlock(); block.setType(material); - if(material == Material.STONE) + if (material == Material.STONE) { - if(UtilMath.random.nextBoolean()) + if (UtilMath.random.nextBoolean()) { block.setData((byte) 5); } @@ -131,16 +147,16 @@ public class ChallengeFallingBlocks extends Challenge _wavesCompleted = 0; _modifiedSpawnChance = 0; - for(Block block : _remaining) + for (Block block : _remaining) { block.setType(Material.AIR); } _remaining.clear(); - for(Entity entity : Host.WorldData.World.getEntities()) + for (Entity entity : Host.WorldData.World.getEntities()) { - if(entity instanceof FallingBlock) + if (entity instanceof FallingBlock) { entity.remove(); } @@ -156,10 +172,10 @@ public class ChallengeFallingBlocks extends Challenge @EventHandler public void onEntityChangeBlockEvent(final EntityChangeBlockEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; - if(event.getEntity() instanceof FallingBlock) + if (event.getEntity() instanceof FallingBlock) { final Block block = event.getBlock(); _remaining.add(block); @@ -169,14 +185,14 @@ public class ChallengeFallingBlocks extends Challenge @Override public void run() { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) { cancel(); return; } UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(block.getType(), 0), block.getLocation(), 0.3F, 0.3F, 0.3F, 0.0F, - 3, ViewDist.LONG, UtilServer.getPlayers()); + 3, ViewDist.LONG, UtilServer.getPlayers()); block.setType(Material.AIR); _remaining.remove(block); @@ -188,10 +204,10 @@ public class ChallengeFallingBlocks extends Challenge @EventHandler public void onBlockFade(BlockFadeEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; - if(event.getNewState().getType() == Material.DIRT || event.getNewState().getType() == Material.GRASS) + if (event.getNewState().getType() == Material.DIRT || event.getNewState().getType() == Material.GRASS) event.setCancelled(true); } @@ -202,7 +218,7 @@ public class ChallengeFallingBlocks extends Challenge @Override public void run() { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) { cancel(); return; @@ -220,13 +236,13 @@ public class ChallengeFallingBlocks extends Challenge @Override public void run() { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) { cancel(); return; } - if(_time <= 0) + if (_time <= 0) { _time = (int) _nextWave; } @@ -234,7 +250,7 @@ public class ChallengeFallingBlocks extends Challenge int wave = _wavesCompleted + 1; String time = C.cWhite + C.Bold + _time; - if(wave > 1) + if (wave > 1) { UtilTextBottom.display(C.cYellow + C.Bold + "Next Wave: " + time, UtilServer.getPlayers()); } @@ -250,34 +266,34 @@ public class ChallengeFallingBlocks extends Challenge private void createWave() { - if(_modifiedSpawnChance < 100.0) + if (_modifiedSpawnChance < 100.0) _modifiedSpawnChance += _incrementRate; _wavesCompleted++; Sound nextSound = _sounds[UtilMath.r(_sounds.length)]; - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { player.playSound(player.getLocation(), nextSound, 1.0F, 1.5F); } Location center = new Location(Host.WorldData.World, 0, _waveHeight, 0); - for(Location location : UtilShapes.getCircle(center, false, getArenaSize())) + for (Location location : UtilShapes.getCircle(center, false, getArenaSize())) { - if(Math.random() * 100 <= _modifiedSpawnChance) + if (Math.random() * 100 <= _modifiedSpawnChance) { createFallingBlock(location); } } // Prevent camping - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { Location camp = player.getLocation(); - if(camp.getY() >= 1 && camp.getY() <= 3) + if (camp.getY() >= 1 && camp.getY() <= 3) { createFallingBlock(new Location(Host.WorldData.World, camp.getX(), _waveHeight, camp.getZ())); } @@ -293,8 +309,8 @@ public class ChallengeFallingBlocks extends Challenge FallingBlock block = world.spawnFallingBlock(location, material, (byte) 0); block.setDropItem(false); - if(material == Material.SMOOTH_BRICK || material == Material.DIRT) - if(UtilMath.random.nextBoolean()) + if (material == Material.SMOOTH_BRICK || material == Material.DIRT) + if (UtilMath.random.nextBoolean()) block = world.spawnFallingBlock(location, material, (byte) 2); damageNearby(block); @@ -307,21 +323,21 @@ public class ChallengeFallingBlocks extends Challenge @Override public void run() { - if(!Host.IsLive() || !block.isValid() || block.isOnGround() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !block.isValid() || block.isOnGround() || !Host.isChallengeStarted()) { cancel(); return; } - for(Entity entity : block.getNearbyEntities(0.05, 0.05, 0.05)) + for (Entity entity : block.getNearbyEntities(0.05, 0.05, 0.05)) { - if(entity instanceof Player) + if (entity instanceof Player) { Player player = (Player) entity; - if(isDone(player)) + if (isDone(player)) return; - if(!Host.IsAlive(player)) + if (!Host.IsAlive(player)) return; player.damage(player.getHealth()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java index db9a9cdf6..b670c288e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFastFood.java @@ -2,20 +2,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -30,21 +16,51 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeFastFood extends Challenge { - private Material[] _food = - { Material.APPLE, Material.BREAD, Material.GRILLED_PORK, Material.COOKED_BEEF, Material.RAW_FISH, Material.COOKED_FISH, Material.CAKE, - Material.COOKIE, Material.MELON, Material.COOKED_CHICKEN, Material.CARROT_ITEM, Material.BAKED_POTATO, Material.PUMPKIN_PIE }; + private Material[] _food = { + Material.APPLE, + Material.BREAD, + Material.GRILLED_PORK, + Material.COOKED_BEEF, + Material.RAW_FISH, + Material.COOKED_FISH, + Material.CAKE, + Material.COOKIE, + Material.MELON, + Material.COOKED_CHICKEN, + Material.CARROT_ITEM, + Material.BAKED_POTATO, + Material.PUMPKIN_PIE }; - private Material[] _flowers = - { Material.LONG_GRASS, Material.YELLOW_FLOWER, Material.RED_ROSE }; + private Material[] _flowers = { Material.LONG_GRASS, Material.YELLOW_FLOWER, Material.RED_ROSE }; private int _itemSeperator = 0; public ChallengeFastFood(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Fast Food", "Your inventory is full of food!", "Punch to throw it in the ground.", - "First player to drop them all wins."); + super( + host, + ChallengeType.FirstComplete, + "Fast Food", + "Your inventory is full of food.", + "Punch to throw it in the ground.", + "First player to drop them all wins!"); } @Override @@ -53,7 +69,7 @@ public class ChallengeFastFood extends Challenge ArrayList spawns = new ArrayList(); Location center = new Location(Host.WorldData.World, 0, 0, 0); - for(Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3)) + for (Location location : UtilShapes.getCircle(center, true, getArenaSize() - 3)) { double x = location.getX() + 0.5; double y = 1.1; @@ -70,7 +86,7 @@ public class ChallengeFastFood extends Challenge { Location center = new Location(Host.WorldData.World, 0, 0, 0); - for(Location location : UtilShapes.getCircle(center, false, getArenaSize())) + for (Location location : UtilShapes.getCircle(center, false, getArenaSize())) { Block block = location.getBlock(); block.setType(Material.GRASS); @@ -84,9 +100,9 @@ public class ChallengeFastFood extends Challenge { itemParticleTask(); - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - for(int i = 0; i < 9; i++) + for (int i = 0; i < 9; i++) { player.getInventory().setItem(i, getRandomFood()); } @@ -98,9 +114,9 @@ public class ChallengeFastFood extends Challenge { _itemSeperator = 0; - for(Entity entity : Host.WorldData.World.getEntities()) + for (Entity entity : Host.WorldData.World.getEntities()) { - if(entity instanceof Item) + if (entity instanceof Item) { entity.remove(); } @@ -110,14 +126,14 @@ public class ChallengeFastFood extends Challenge @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) return; Player player = event.getPlayer(); - if(UtilEvent.isAction(event, ActionType.L) && !isDone(player)) + if (UtilEvent.isAction(event, ActionType.L) && !isDone(player)) { - if(event.getItem() != null) + if (event.getItem() != null) { ItemStack item = event.getItem(); throwItemInGround(player, item); @@ -136,23 +152,23 @@ public class ChallengeFastFood extends Challenge @Override public void run() { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if (!Host.IsLive() || !Host.isChallengeStarted()) { cancel(); return; } - for(Entity entity : Host.WorldData.World.getEntities()) + for (Entity entity : Host.WorldData.World.getEntities()) { - if(entity instanceof Item) + if (entity instanceof Item) { Item item = (Item) entity; - if(!item.isValid() || item.isDead() || item.isOnGround() || item.getItemStack().getType() == Material.INK_SACK) + if (!item.isValid() || item.isDead() || item.isOnGround() || item.getItemStack().getType() == Material.INK_SACK) continue; UtilParticle.PlayParticle(ParticleType.INSTANT_SPELL, item.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, - UtilServer.getPlayers()); + UtilServer.getPlayers()); } } } @@ -164,11 +180,11 @@ public class ChallengeFastFood extends Challenge Material foodMaterial = UtilMath.randomElement(_food); byte data = 0; - if(foodMaterial == Material.RAW_FISH) + if (foodMaterial == Material.RAW_FISH) { data = (byte) (UtilMath.r(3) + 1); } - else if(foodMaterial == Material.COOKED_FISH) + else if (foodMaterial == Material.COOKED_FISH) { data = (byte) UtilMath.r(1); } @@ -179,13 +195,13 @@ public class ChallengeFastFood extends Challenge private void changeItemSlot(Player player) { - for(int i = 0; i < 9; i++) + for (int i = 0; i < 9; i++) { - if(player.getInventory().getItem(i) != null) + if (player.getInventory().getItem(i) != null) { ItemStack newItemSelection = player.getInventory().getItem(i); - if(newItemSelection.getType() != Material.AIR) + if (newItemSelection.getType() != Material.AIR) { player.getInventory().setHeldItemSlot(i); return; @@ -197,7 +213,7 @@ public class ChallengeFastFood extends Challenge @SuppressWarnings("deprecation") private void throwItemInGround(Player player, ItemStack item) { - if(!Recharge.Instance.use(player, "Food Throw", 100, false, false)) + if (!Recharge.Instance.use(player, "Food Throw", 100, false, false)) return; player.getWorld().playSound(player.getLocation(), Sound.EAT, 0.5F, 1.1F); @@ -223,43 +239,43 @@ public class ChallengeFastFood extends Challenge @Override public void run() { - if(!Host.IsLive() || !Host.isChallengeStarted() || !item.isValid() || item.isDead()) + if (!Host.IsLive() || !Host.isChallengeStarted() || !item.isValid() || item.isDead()) { cancel(); return; } - if(item.isOnGround()) + if (item.isOnGround()) { double random = Math.random() * 100; - if(random < 30.0) + if (random < 30.0) { Location drop = item.getLocation(); Block block = drop.getBlock(); Block below = block.getRelative(BlockFace.DOWN); - if(UtilMath.random.nextBoolean()) + if (UtilMath.random.nextBoolean()) { - if(below.getType() != Material.AIR) + if (below.getType() != Material.AIR) { below.setType(Material.DIRT); - if(UtilMath.random.nextBoolean()) + if (UtilMath.random.nextBoolean()) below.setData((byte) 1); } } - if(block.getType() == Material.AIR && below.getType() != Material.AIR) + if (block.getType() == Material.AIR && below.getType() != Material.AIR) { Material flower = UtilMath.randomElement(_flowers); block.setType(flower); - if(flower == Material.LONG_GRASS) + if (flower == Material.LONG_GRASS) { block.setData((byte) (UtilMath.r(2) + 1)); } - else if(flower == Material.RED_ROSE) + else if (flower == Material.RED_ROSE) { block.setData((byte) UtilMath.r(8)); } @@ -280,7 +296,7 @@ public class ChallengeFastFood extends Challenge { ArrayList items = UtilInv.getItems(player); - if(items.size() == 0) + if (items.size() == 0) SetCompleted(player); } @@ -288,7 +304,7 @@ public class ChallengeFastFood extends Challenge private void blockBreakEffect(Block block) { UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(block.getType(), block.getData()), block.getLocation(), 0.0F, 0.0F, 0.0F, 0, - 10, ViewDist.NORMAL, UtilServer.getPlayers()); + 10, ViewDist.NORMAL, UtilServer.getPlayers()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java index 68c9d17fc..e437a5de4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeFishingDay.java @@ -39,6 +39,7 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; @SuppressWarnings("deprecation") public class ChallengeFishingDay extends Challenge @@ -50,8 +51,12 @@ public class ChallengeFishingDay extends Challenge public ChallengeFishingDay(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", - "Watch out for TNT if you miss the fish!"); + super( + host, + ChallengeType.FirstComplete, + "Fishing Day", + "Be the first to catch 5 fish.", + "Watch out for TNT if you miss the fish!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java index 3d328a126..cf45c059b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeInfestation.java @@ -26,6 +26,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeInfestation extends Challenge { @@ -38,14 +39,19 @@ public class ChallengeInfestation extends Challenge public ChallengeInfestation(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Infestation", "Avoid the deadly zombie!", "Watch out, the infected can kill humans."); + super( + host, + ChallengeType.LastStanding, + "Infestation", + "Avoid the deadly zombie.", + "The infected can kill humans!"); } @Override public ArrayList getSpawns() { ArrayList spawns = new ArrayList(); - for(Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), true, getArenaSize(10))) + for (Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), true, getArenaSize(10))) { spawns.add(getCenter().clone().add(locs.getX() + 0.5, locs.getY() + 1.1, locs.getZ() + 0.5)); } @@ -55,9 +61,9 @@ public class ChallengeInfestation extends Challenge @Override public void cleanupRoom() { - for(Player player : Host.GetPlayers(false)) + for (Player player : Host.GetPlayers(false)) { - if(player.hasPotionEffect(PotionEffectType.SPEED)) + if (player.hasPotionEffect(PotionEffectType.SPEED)) { player.removePotionEffect(PotionEffectType.SPEED); } @@ -74,7 +80,7 @@ public class ChallengeInfestation extends Challenge public void setupPlayers() { _gameStart = System.currentTimeMillis(); - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1)); } @@ -86,7 +92,7 @@ public class ChallengeInfestation extends Challenge @Override public void generateRoom() { - for(Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), false, getArenaSize(15))) + for (Location locs : UtilShapes.getCircle(new Location(Host.WorldData.World, 0, 0, 0), false, getArenaSize(15))) { locs.getBlock().setType(Material.WOOL); locs.getBlock().setData((byte) UtilMath.r(16)); @@ -106,29 +112,29 @@ public class ChallengeInfestation extends Challenge @EventHandler public void onZombieInfection(CustomDamageEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!(event.GetDamageeEntity() instanceof Player)) + if (!(event.GetDamageeEntity() instanceof Player)) { return; } - if((!(event.GetDamagerEntity(false) instanceof Player))) + if ((!(event.GetDamagerEntity(false) instanceof Player))) { return; } - if(isCompleted(event.GetDamageePlayer())) + if (isCompleted(event.GetDamageePlayer())) { event.SetCancelled("Player already finished"); return; } - if(!_infectedPlayers.contains(event.GetDamagerPlayer(false).getName())) + if (!_infectedPlayers.contains(event.GetDamagerPlayer(false).getName())) { event.SetCancelled("Not an infector"); return; } - if(_infectedPlayers.contains(event.GetDamageePlayer().getName())) + if (_infectedPlayers.contains(event.GetDamageePlayer().getName())) { event.SetCancelled("Already infected"); return; @@ -144,45 +150,45 @@ public class ChallengeInfestation extends Challenge @EventHandler public void zombieControl(UpdateEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.FAST) { return; } - if(_zombieFrozen) + if (_zombieFrozen) { - if(System.currentTimeMillis() > _zombieFreezeEnd) + if (System.currentTimeMillis() > _zombieFreezeEnd) { _zombieFrozen = false; } return; } - if(UtilMath.r(15) == 0) + if (UtilMath.r(15) == 0) { - freezeZombie((UtilMath.r(3)+3)*1000); + freezeZombie((UtilMath.r(3) + 3) * 1000); } - if(_infectedZombie.getLocation().getY() < -1) + if (_infectedZombie.getLocation().getY() < -1) { _infectedZombie.teleport(new Location(Host.WorldData.World, 0, 1, 0)); } Player closestPlayer = UtilPlayer.getClosest(_infectedZombie.getLocation(), (Entity) null); _infectedZombie.setTarget(closestPlayer); - if(_zombieSpeed <= 3.0f) + if (_zombieSpeed <= 3.0f) { _zombieSpeed *= 1.03f; } - + UtilEnt.CreatureLook(_infectedZombie, closestPlayer); UtilEnt.CreatureMove(_infectedZombie, closestPlayer.getLocation(), _zombieSpeed); - - if(_infectedZombie.getLocation().distance(closestPlayer.getLocation()) <= 2) + + if (_infectedZombie.getLocation().distance(closestPlayer.getLocation()) <= 2) { - if(!_infectedPlayers.contains(closestPlayer.getName())) + if (!_infectedPlayers.contains(closestPlayer.getName())) { - if(_gameStart+5000 > System.currentTimeMillis()) + if (_gameStart + 5000 > System.currentTimeMillis()) { return; } @@ -190,23 +196,23 @@ public class ChallengeInfestation extends Challenge } } } - + @EventHandler public void winCheck(UpdateEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.FASTER) { return; } - if(_infectedPlayers.size() >= Math.floor(Host.GetPlayers(true).size()/2)) + if (_infectedPlayers.size() >= Math.floor(Host.GetPlayers(true).size() / 2)) { - for(Player player: Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - if(_infectedPlayers.contains(player.getName())) + if (_infectedPlayers.contains(player.getName())) { setLost(player); } @@ -221,17 +227,17 @@ public class ChallengeInfestation extends Challenge @EventHandler public void blockMobFire(EntityCombustEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getEntity() instanceof Zombie) + if (event.getEntity() instanceof Zombie) { event.getEntity().setFireTicks(0); event.setCancelled(true); } } - + private void freezeZombie(int millisec) { _zombieFreezeEnd = System.currentTimeMillis() + millisec; @@ -240,16 +246,16 @@ public class ChallengeInfestation extends Challenge public void playerInfect(Player player) { - if(_infectedPlayers.contains(player.getName())) + if (_infectedPlayers.contains(player.getName())) { return; } _infectedPlayers.add(player.getName()); _zombieSpeed = 1.0f; - + Host.WorldData.World.strikeLightningEffect(player.getLocation()); Host.getArcadeManager().GetDisguise().disguise(new DisguiseZombie(player)); - + player.sendMessage(F.main("Infection", "You have been infected! It's over so infect the rest!")); } 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 0684d08f1..9a8b4b424 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 @@ -5,13 +5,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilMath; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -20,6 +13,14 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeKangarooJump extends Challenge { private long _gameTime = System.currentTimeMillis() + ((UtilMath.r(5) + 20) * 1000); @@ -29,7 +30,12 @@ public class ChallengeKangarooJump extends Challenge public ChallengeKangarooJump(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Jump from block to block.", "Player with the highest height wins!"); + super( + host, + ChallengeType.FirstComplete, + "Kangaroo Jump", + "Jump from block to block.", + "Player with the highest height wins!"); } @Override @@ -37,11 +43,11 @@ public class ChallengeKangarooJump extends Challenge { ArrayList spawns = new ArrayList(); - for(int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++) + for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++) { - for(int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) { - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); } @@ -59,7 +65,7 @@ public class ChallengeKangarooJump extends Challenge @Override public void setupPlayers() { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { _players.put(player.getName(), true); _playerJumpHeight.put(player, 0); @@ -70,22 +76,22 @@ public class ChallengeKangarooJump extends Challenge @Override public void generateRoom() { - for(int x = -getArenaSize(); x <= getArenaSize(); x++) + for (int x = -getArenaSize(); x <= getArenaSize(); x++) { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 0; y <= 150; y++) + for (int y = 0; y <= 150; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(y == 0) + if (y == 0) { b.setType(Material.DIRT); b.setData((byte) 2); } - else if(y > 2) + else if (y > 2) { - if(UtilMath.r(33) == 15) + if (UtilMath.r(33) == 15) { b.setType(Material.WOOL); b.setData((byte) UtilMath.r(16)); @@ -93,12 +99,12 @@ public class ChallengeKangarooJump extends Challenge } else { - if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) + if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) { b.setType(Material.FENCE); } } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } @@ -110,23 +116,23 @@ public class ChallengeKangarooJump extends Challenge @EventHandler public void onPlayerJump(PlayerMoveEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!Host.isChallengeStarted()) + if (!Host.isChallengeStarted()) { return; } - if(event.getFrom().getY() >= event.getTo().getY()) + if (event.getFrom().getY() >= event.getTo().getY()) { return; } Player player = event.getPlayer(); - if(_players.get(player.getName()) == false) // TODO fix + if (_players.get(player.getName()) == false) // TODO fix { - if(player.isOnGround()) + if (player.isOnGround()) { _players.put(player.getName(), true); } @@ -135,37 +141,37 @@ public class ChallengeKangarooJump extends Challenge UtilAction.velocity(player, 2, 0.4, 4, true); _players.put(player.getName(), false); } - - @EventHandler + + @EventHandler public void playerJumpTracker(PlayerMoveEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } Player player = event.getPlayer(); - if(player.getLocation().getBlockY() < 4) + if (player.getLocation().getBlockY() < 4) { return; // Return = Stop code } - if(!player.isOnGround()) + if (!player.isOnGround()) { return; } - if(!_playerJumpHeight.containsKey(player)) + if (!_playerJumpHeight.containsKey(player)) { return; } - if(isLost(player)) + if (isLost(player)) { _playerJumpHeight.remove(player); } - if((player.getLocation().getBlockY() < _playerJumpHeight.get(player))) + if ((player.getLocation().getBlockY() < _playerJumpHeight.get(player))) { _playerJumpHeight.remove(player); return; } - if(player.getLocation().getBlockY() > _playerJumpHeight.get(player)) + if (player.getLocation().getBlockY() > _playerJumpHeight.get(player)) { _playerJumpHeight.put(player, player.getLocation().getBlockY()); } @@ -174,32 +180,32 @@ public class ChallengeKangarooJump extends Challenge @EventHandler public void gameEndChecker(UpdateEvent event) { - if(event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.FASTER) { return; } - if(System.currentTimeMillis() > _gameTime) + if (System.currentTimeMillis() > _gameTime) { HashMap playerHeights = new HashMap(); - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - if(!Host.IsAlive(player)) + if (!Host.IsAlive(player)) { return; } - if(!playerHeights.containsKey(player.getName())) + if (!playerHeights.containsKey(player.getName())) { playerHeights.put(player.getName(), player.getLocation().getBlockY()); } } ArrayList sortedList = sortHash(playerHeights); - for(int i = 0; i < (sortedList.size()); i++) + for (int i = 0; i < (sortedList.size()); i++) { System.out.println(sortedList.get(i)); - if(!isDone(Bukkit.getPlayer(sortedList.get(i)))) + if (!isDone(Bukkit.getPlayer(sortedList.get(i)))) { - if(i < (sortedList.size() / 2)) + if (i < (sortedList.size() / 2)) { SetCompleted(Bukkit.getPlayer(sortedList.get(i))); } @@ -227,7 +233,7 @@ 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/ChallengeKingOfTheHill.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKingOfTheHill.java index c4d7ac772..46cd4d845 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKingOfTheHill.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeKingOfTheHill.java @@ -23,6 +23,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeKingOfTheHill extends Challenge { @@ -31,7 +32,11 @@ public class ChallengeKingOfTheHill extends Challenge public ChallengeKingOfTheHill(BawkBawkBattles 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 diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java index 998dbaee7..ef4b8cbd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeLavaRun.java @@ -21,6 +21,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeLavaRun extends Challenge { @@ -31,7 +32,13 @@ public class ChallengeLavaRun extends Challenge public ChallengeLavaRun(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Lava run", "The lava is coming!", "Stand on the obsidian.", "Run! Run! Run!"); + super( + host, + ChallengeType.LastStanding, + "Lava Ρun", + "The lava is coming!", + "Stand on the obsidian.", + "Run! Run! Run!"); } @Override @@ -49,11 +56,11 @@ public class ChallengeLavaRun extends Challenge return spawns; } - + @Override public int getMaxPlayers() { - return 30; + return 30; } @EventHandler 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 ffed9a1e8..f5dfd7e7e 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 @@ -3,19 +3,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; 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; -import mineplex.core.hologram.Hologram; -import mineplex.core.hologram.Hologram.HologramTarget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -32,6 +19,20 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.inventory.ItemStack; +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; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.Hologram.HologramTarget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeMilkACow extends Challenge { private Villager _villager; @@ -41,7 +42,12 @@ public class ChallengeMilkACow extends Challenge public ChallengeMilkACow(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows.", "Deliver the milk to the villager!"); + super( + host, + ChallengeType.FirstComplete, + "Milk a Cow", + "Milk 5 different cows.", + "Deliver the milk to the villager!"); } @Override @@ -51,7 +57,7 @@ public class ChallengeMilkACow extends Challenge { Hologram holo = _cowIndicator.get(cow); holo.stop(); - + cow.remove(); } _villager.remove(); @@ -137,31 +143,45 @@ public class ChallengeMilkACow extends Challenge _villager.setProfession(Profession.FARMER); _villager.setCustomName(C.Bold + "Farmer Joe"); _villager.setCustomNameVisible(true); - - String[] names = new String[] - { - "Tom", "Steve", "John", "Harry", "Andrew", "Daniel", "Bobbae", "Jim" - }; + + String[] names = new String[] { + "Tom", + "Steve", + "John", + "Harry", + "Andrew", + "Daniel", + "Bobbae", + "Jim" + }; if (UtilMath.r(5) == 0) { - names = new String[] - { - "Moorten", "Mooington", "Mooley", "Moose", "Mooskee", "Chicken", "Mooffy", "Moozzle", - }; + names = new String[] { + "Moorten", + "Mooington", + "Mooley", + "Moose", + "Mooskee", + "Chicken", + "Mooffy", + "Moozzle", + }; } for (int i = 0; i < 8; i++) { - Location loc = getCenter().clone().add(UtilMath.r(((getArenaSize()*2)-1) - (getArenaSize()-1)), 1, UtilMath.r((getArenaSize()*2)-1) - (getArenaSize()-1)); + Location loc = getCenter().clone().add(UtilMath.r(((getArenaSize() * 2) - 1) - (getArenaSize() - 1)), 1, + UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1)); Cow cow = (Cow) loc.getWorld().spawnEntity(loc, EntityType.COW); cow.setCustomName(C.cWhite + names[i]); cow.setCustomNameVisible(true); _milked.put(cow, new ArrayList()); - _cowIndicator.put(cow, new Hologram(Host.Manager.getHologramManager(), cow.getLocation().clone().add(0, 2.5, 0), C.cRed + "Already Milked!")); - + _cowIndicator.put(cow, + new Hologram(Host.Manager.getHologramManager(), cow.getLocation().clone().add(0, 2.5, 0), C.cRed + "Already Milked!")); + Hologram holo = _cowIndicator.get(cow); holo.setHologramTarget(HologramTarget.WHITELIST); holo.setFollowEntity(cow); @@ -174,28 +194,28 @@ public class ChallengeMilkACow extends Challenge @EventHandler public void cowIndicator(UpdateEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getType() != UpdateType.SEC) + if (event.getType() != UpdateType.SEC) { return; } - - for(Entity entCow: _milked.keySet()) + + for (Entity entCow : _milked.keySet()) { - for(String playerName: _milked.get(entCow)) + for (String playerName : _milked.get(entCow)) { Hologram holo = _cowIndicator.get(entCow); - if(!holo.containsPlayer(playerName)) + if (!holo.containsPlayer(playerName)) { holo.addPlayer(playerName); } } } } - + @EventHandler public void onEntityInteract(PlayerInteractEntityEvent event) { @@ -246,7 +266,7 @@ public class ChallengeMilkACow extends Challenge _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); + : score >= 2 ? C.cRed : C.cDRed) + score); if (score == 5) { @@ -271,9 +291,9 @@ public class ChallengeMilkACow extends Challenge { ArrayList spawns = new ArrayList(); - for (int x = -(getArenaSize() - 1); x <= getArenaSize()-1; x++) + for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++) { - for (int z = -(getArenaSize() - 1); z <= getArenaSize()-1; z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) { if (x % 2 == 0 && z % 2 == 0) { @@ -284,7 +304,7 @@ 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 00b59f466..8c7f40d15 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 @@ -3,10 +3,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.Arrays; -import mineplex.core.common.util.UtilMath; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -17,16 +13,24 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.UtilMath; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + 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)); + Material.REDSTONE_ORE, Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE)); private ArrayList _diamonds = new ArrayList(); public ChallengeMineADiamond(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find a diamond around the map.", - "Be the first to mine one!"); + super( + host, + ChallengeType.FirstComplete, + "Mine a Diamond", + "Find a diamond around the map."); } @Override @@ -104,10 +108,11 @@ public class ChallengeMineADiamond extends Challenge 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())); + UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, + UtilMath.r(getArenaSize() * 2) - (getArenaSize())); - if (copy.getType() == Material.DIAMOND_ORE && Math.abs(copy.getX()) < getArenaSize() && Math.abs(copy.getY()) < getArenaSize()) + if (copy.getType() == Material.DIAMOND_ORE && Math.abs(copy.getX()) < getArenaSize() + && Math.abs(copy.getY()) < getArenaSize()) { i--; continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java index 0893a4c51..a1cbaa00b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMinecartDance.java @@ -27,14 +27,14 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutWorldEvent; public class ChallengeMinecartDance extends Challenge { /* - * _state if 1 = waiting if 2 = stateSwitch if 3 = cartsSpawned and player - * battle + * _state if 1 = waiting if 2 = stateSwitch if 3 = cartsSpawned and player battle */ private boolean _isPlayingMusic = false; private int _availableMinecarts; @@ -44,8 +44,12 @@ public class ChallengeMinecartDance extends Challenge public ChallengeMinecartDance(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Musical Minecart", "Get ready when the fireworks change color.", - "Once they're green, get inside a minecart!"); + super( + host, + ChallengeType.LastStanding, + "Musical Minecart", + "Get ready when the fireworks change color.", + "Once they're green, get inside a minecart!"); } @Override @@ -75,8 +79,8 @@ public class ChallengeMinecartDance extends Challenge for (Player player : UtilServer.getPlayers()) { ((CraftPlayer) player).getHandle().playerConnection - .sendPacket(new PacketPlayOutWorldEvent(1005, new BlockPosition(getCenter().getBlockX(), - getCenter().getBlockY() + 5, getCenter().getBlockZ()), 0, false)); + .sendPacket(new PacketPlayOutWorldEvent(1005, new BlockPosition(getCenter().getBlockX(), + getCenter().getBlockY() + 5, getCenter().getBlockZ()), 0, false)); } } for (Minecart minecarts : _minecarts) @@ -201,8 +205,9 @@ public class ChallengeMinecartDance extends Challenge for (Player player : UtilServer.getPlayers()) { ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005, - new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY() + 5, getCenter() - .getBlockZ()), 2259, false)); + new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY() + 5, getCenter() + .getBlockZ()), + 2259, false)); } } if (_timeSinceLastState + 5500 < System.currentTimeMillis()) @@ -243,23 +248,25 @@ public class ChallengeMinecartDance extends Challenge for (Player player : UtilServer.getPlayers()) { ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutWorldEvent(1005, - new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY() + 5, getCenter() - .getBlockZ()), 0, false)); + new BlockPosition(getCenter().getBlockX(), getCenter().getBlockY() + 5, getCenter() + .getBlockZ()), + 0, false)); } } for (int i = 0; i < getCurrentyAlive(true).size() / 2; i++) { Minecart minecart = Host.WorldData.World.spawn( - new Location(Host.WorldData.World, UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7)), 2, - UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7))), Minecart.class); + new Location(Host.WorldData.World, UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7)), 2, + UtilMath.r(getArenaSize(7) * 2) - (getArenaSize(7))), + Minecart.class); UtilEnt.ghost(minecart, true, false); _minecarts.add(minecart); } _state = 3; - if(getCurrentyAlive(false).size() >= 10) + if (getCurrentyAlive(false).size() >= 10) { - startTimer(Math.round(getCurrentyAlive(false).size()/2)); + startTimer(Math.round(getCurrentyAlive(false).size() / 2)); } else { @@ -365,18 +372,18 @@ public class ChallengeMinecartDance extends Challenge } } - }.runTaskLater(Host.Manager.getPlugin(), ticks * 20); + }.runTaskLater(Host.Manager.getPlugin(), ticks * 20); } public void spawnFireworkAtCorners(Color color) { UtilFirework.playFirework(new Location(Host.WorldData.World, getArenaSize() + 5, 10, getArenaSize() + 5), - Type.BALL_LARGE, color, false, false); + Type.BALL_LARGE, color, false, false); UtilFirework.playFirework(new Location(Host.WorldData.World, -getArenaSize() - 5, 10, getArenaSize() + 5), - Type.BALL_LARGE, color, false, false); + Type.BALL_LARGE, color, false, false); UtilFirework.playFirework(new Location(Host.WorldData.World, getArenaSize() + 5, 10, -getArenaSize() - 5), - Type.BALL_LARGE, color, false, false); + Type.BALL_LARGE, color, false, false); UtilFirework.playFirework(new Location(Host.WorldData.World, -getArenaSize() - 5, 10, -getArenaSize() - 5), - Type.BALL_LARGE, color, false, false); + Type.BALL_LARGE, color, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOneInTheQuiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOneInTheQuiver.java index 0b0635516..b34ea9435 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOneInTheQuiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMiniOneInTheQuiver.java @@ -22,13 +22,21 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeMiniOneInTheQuiver extends Challenge { public ChallengeMiniOneInTheQuiver(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Mini OITQ", false, true, "Avoid getting hit by arrows.", "You receive an arrow every 4 seconds.", - "Last man standing wins!"); + super( + host, + ChallengeType.LastStanding, + "Mini OITQ", + false, + true, + "Shoot arrows to instant kill others.", + "Avoid getting hit by them.", + "Arrow supply every 4 seconds."); } @Override 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 2d49d8355..9ed2f0207 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 @@ -3,10 +3,6 @@ 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.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -15,13 +11,22 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeNavigateMaze extends Challenge { private HashMap _playerCompletionTime = new HashMap(); public ChallengeNavigateMaze(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Nagivation Maze", "Go to the other side of the maze."); + super( + host, + ChallengeType.FirstComplete, + "Nagivation Maze", + "Go to the other side of the maze."); } @Override @@ -45,11 +50,11 @@ public class ChallengeNavigateMaze extends Challenge { return; } - if(isDone(event.getPlayer())) + if (isDone(event.getPlayer())) { return; } - + if (event.getTo().getY() >= 1 && event.getTo().getX() > 16) { SetCompleted(event.getPlayer()); @@ -154,10 +159,12 @@ public class ChallengeNavigateMaze extends Challenge { Block block = nextLoop.remove(0); - for (BlockFace face : new BlockFace[] - { - BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH - }) + for (BlockFace face : new BlockFace[] { + BlockFace.EAST, + BlockFace.WEST, + BlockFace.SOUTH, + BlockFace.NORTH + }) { Block b = block.getRelative(face); @@ -253,7 +260,7 @@ 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 a3191e5e8..e04eccf89 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 @@ -3,6 +3,13 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.HashSet; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -11,13 +18,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengePickASide extends Challenge { @@ -28,8 +29,12 @@ public class ChallengePickASide extends Challenge public ChallengePickASide(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the fewest players wins!", - "No... Standing in the middle won't work"); + super( + host, + ChallengeType.FirstComplete, + "Pick a Side", + "The side with the smallest amount of players wins.", + "Standing in the middle does not work."); } public int getMinPlayers() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java index cfcf67e28..ee3216fc6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengePunchThePig.java @@ -4,14 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilMath; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -21,6 +13,15 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDeathEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengePunchThePig extends Challenge { private int _amountOfKills = 5; @@ -30,7 +31,11 @@ public class ChallengePunchThePig extends Challenge public ChallengePunchThePig(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Punch the Pig", "Kill 5 pigs!"); + super( + host, + ChallengeType.FirstComplete, + "Punch the Pig", + "Kill 5 pigs."); } @Override @@ -38,11 +43,11 @@ public class ChallengePunchThePig extends Challenge { ArrayList spawns = new ArrayList(); - for(int x = -(getArenaSize() - 1); x < getArenaSize() - 1; x++) + for (int x = -(getArenaSize() - 1); x < getArenaSize() - 1; x++) { - for(int z = -(getArenaSize() - 1); z < getArenaSize() - 1; z++) + for (int z = -(getArenaSize() - 1); z < getArenaSize() - 1; z++) { - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { spawns.add(getCenter().clone().add(x, 1.1, z)); } @@ -54,9 +59,9 @@ public class ChallengePunchThePig extends Challenge @Override public void cleanupRoom() { - for(Pig pigs : _pigs) + for (Pig pigs : _pigs) { - if(!pigs.isDead()) + if (!pigs.isDead()) { pigs.remove(); } @@ -69,10 +74,10 @@ public class ChallengePunchThePig extends Challenge @Override public void setupPlayers() { - for(int i = 0; i <= Math.round((Host.GetPlayers(true).size()) * 5); i++) + for (int i = 0; i <= Math.round((Host.GetPlayers(true).size()) * 5); i++) { Location loc = getCenter().clone().add(UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1), 1, - UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1)); + UtilMath.r((getArenaSize() * 2) - 1) - (getArenaSize() - 1)); Host.CreatureAllowOverride = true; Pig pig = (Pig) loc.getWorld().spawnEntity(loc, EntityType.PIG); @@ -83,7 +88,7 @@ public class ChallengePunchThePig extends Challenge _pigs.add(pig); } - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { _playerScore.put(player.getName(), 0); } @@ -94,26 +99,26 @@ public class ChallengePunchThePig extends Challenge @Override public void generateRoom() { - for(int x = -getArenaSize(); x <= getArenaSize(); x++) + for (int x = -getArenaSize(); x <= getArenaSize(); x++) { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 0; y <= 1; y++) + for (int y = 0; y <= 1; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(y == 0) + if (y == 0) { b.setType(Material.GRASS); } else { - if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) + if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) { b.setType(Material.FENCE); } } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } @@ -125,33 +130,33 @@ public class ChallengePunchThePig extends Challenge @EventHandler public void onPigPunch(CustomDamageEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.GetDamageeEntity() == null) + if (event.GetDamageeEntity() == null) { return; } - if(event.GetDamagerPlayer(false) == null) + if (event.GetDamagerPlayer(false) == null) { return; } - if(event.GetDamageeEntity() instanceof Pig) + if (event.GetDamageeEntity() instanceof Pig) { - if(isCompleted(event.GetDamagerPlayer(false))) + if (isCompleted(event.GetDamagerPlayer(false))) { event.SetCancelled("Player already completed"); return; } - if(_pigs.contains(event.GetDamageeEntity())) + if (_pigs.contains(event.GetDamageeEntity())) { - if(_playerScore.get(event.GetDamagerPlayer(false).getName()) != _amountOfKills - 1) + if (_playerScore.get(event.GetDamagerPlayer(false).getName()) != _amountOfKills - 1) { _playerScore.put(event.GetDamagerPlayer(false).getName(), _playerScore.get(event.GetDamagerPlayer(false).getName()) + 1); displayCount(event.GetDamagerPlayer(false), event.GetDamageeEntity().getLocation().add(0.5, 1, 0.5), - C.cGreen + "" + _playerScore.get(event.GetDamagerPlayer(false).getName())); + C.cGreen + "" + _playerScore.get(event.GetDamagerPlayer(false).getName())); } else { @@ -168,11 +173,11 @@ public class ChallengePunchThePig extends Challenge @EventHandler public void onPigDeath(EntityDeathEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getEntity() instanceof Pig) + if (event.getEntity() instanceof Pig) { event.getDrops().clear(); } @@ -181,26 +186,26 @@ public class ChallengePunchThePig extends Challenge @EventHandler public void checkPigs(UpdateEvent event) { - if(event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.FASTER) { return; } - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!Host.isChallengeStarted()) + if (!Host.isChallengeStarted()) { return; } - if(!_pigs.isEmpty()) + if (!_pigs.isEmpty()) { return; } - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - if(isCompleted(player)) + if (isCompleted(player)) { return; } 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 0135a24be..e092e302c 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 @@ -31,9 +31,10 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; import net.md_5.bungee.api.ChatColor; -public class ChallengeRedLightGreenLight extends Challenge +public class ChallengeRedLightGreenLight extends Challenge { private boolean _canMove; private int _minTimeBeforeGreen = 2500; @@ -45,10 +46,16 @@ public class ChallengeRedLightGreenLight extends Challenge private ArrayList _cooldownedPlayers = new ArrayList(); private ArrayList _colorList = new ArrayList(Arrays.asList(14, 11, 9, 3, 1, 4, 13, 5)); private Villager _host; - + public ChallengeRedLightGreenLight(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Red Light, Green Light", false, false, "Be the first to reach the end.", "Don't move while the fireworks are red!"); + super( + host, + ChallengeType.FirstComplete, + "Red Light, Green Light", + "Be the first to reach the end.", + "You can move when the fireworks are green.", + "Stay still when the fireworks turn red."); } @Override @@ -56,11 +63,11 @@ public class ChallengeRedLightGreenLight extends Challenge { ArrayList spawns = new ArrayList(); - for(int x = -31; x <= -30; x++) + for (int x = -31; x <= -30; x++) { - for(int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) { - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { spawns.add(getCenter().clone().add(x + 0.5, 2.1, z + 0.5)); } @@ -73,10 +80,10 @@ public class ChallengeRedLightGreenLight extends Challenge public void cleanupRoom() { _host.remove(); - - for(Player player: Host.GetPlayers(true)) + + for (Player player : Host.GetPlayers(true)) { - if(player.hasPotionEffect(PotionEffectType.SLOW)) + if (player.hasPotionEffect(PotionEffectType.SLOW)) { player.removePotionEffect(PotionEffectType.SLOW); } @@ -88,8 +95,8 @@ public class ChallengeRedLightGreenLight extends Challenge public void setupPlayers() { changeMoveState(true); - - for(Player player: Host.GetPlayers(true)) + + for (Player player : Host.GetPlayers(true)) { player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 2)); } @@ -102,74 +109,76 @@ public class ChallengeRedLightGreenLight extends Challenge int colorPicker = 0; Collections.reverse(_colorList); - for(int x = -32; x <= 32; x++) //length people need to run + for (int x = -32; x <= 32; x++) //length people need to run { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 0; y <= 1; y++) + for (int y = 0; y <= 1; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(y == 0) + if (y == 0) { b.setType(Material.BEDROCK); } - else if(y > 0) + else if (y > 0) { b.setType(Material.WOOL); b.setData(_colorList.get(colorPicker).byteValue()); } - if(x == _villagerLocationX) + if (x == _villagerLocationX) { b.setType(Material.COAL_BLOCK); } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } } } - if(var % 8 == 0 && (colorPicker != _colorList.size() - 1)) + if (var % 8 == 0 && (colorPicker != _colorList.size() - 1)) { colorPicker++; } var++; } - + Host.CreatureAllowOverride = true; - _host = (Villager)getCenter().getWorld().spawnEntity(new Location(getCenter().getWorld(), _villagerLocationX, 2, 0), EntityType.VILLAGER); + _host = (Villager) getCenter().getWorld().spawnEntity(new Location(getCenter().getWorld(), _villagerLocationX, 2, 0), EntityType.VILLAGER); UtilEnt.Vegetate(_host); UtilEnt.ghost(_host, true, false); Host.CreatureAllowOverride = false; } - + @EventHandler public void playerMoveHandler(final PlayerMoveEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(isDone(event.getPlayer()) || !Host.IsPlaying(event.getPlayer())) + if (isDone(event.getPlayer()) || !Host.IsPlaying(event.getPlayer())) { return; } - if(event.getPlayer().getLocation().getX() > _villagerLocationX) // Wins the challenge + if (event.getPlayer().getLocation().getX() > _villagerLocationX) // Wins the challenge { SetCompleted(event.getPlayer()); } - if(!_canMove && !_cooldownedPlayers.contains(event.getPlayer().getName()) && _timeBeforeAction < System.currentTimeMillis()) + if (!_canMove && !_cooldownedPlayers.contains(event.getPlayer().getName()) && _timeBeforeAction < System.currentTimeMillis()) { - if(event.getFrom().getBlockX() == event.getTo().getBlockX()) + 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); + 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()); - + new BukkitRunnable() { - + @Override public void run() { @@ -178,23 +187,23 @@ public class ChallengeRedLightGreenLight extends Challenge }.runTaskLater(Host.Manager.getPlugin(), 35); } } - + @EventHandler public void stateChangeHandler(UpdateEvent event) { - if(event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.FAST) { return; } - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(_canMove) + if (_canMove) { - if(_timeSinceLastRed+_minTimeBeforeRed < System.currentTimeMillis()) + if (_timeSinceLastRed + _minTimeBeforeRed < System.currentTimeMillis()) { - if(UtilMath.r(2) == 0) + if (UtilMath.r(2) == 0) { changeMoveState(false); } @@ -202,32 +211,32 @@ public class ChallengeRedLightGreenLight extends Challenge } else { - if(_timeSinceLastGreen+_minTimeBeforeGreen < System.currentTimeMillis()) + if (_timeSinceLastGreen + _minTimeBeforeGreen < System.currentTimeMillis()) { - if(UtilMath.r(3) == 0) + if (UtilMath.r(3) == 0) { changeMoveState(true); } } } } - + private void changeMoveState(boolean condition) { - if(condition != _canMove) + if (condition != _canMove) { - if(condition) + if (condition) { _timeSinceLastRed = System.currentTimeMillis(); _canMove = true; spawnFireWork(Color.GREEN); - - for(Player player: UtilServer.getPlayers()) + + for (Player player : UtilServer.getPlayers()) { player.sendMessage(F.main("Green Light", "You can now move!")); - + + player.getWorld().playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2f, 1f); player.getWorld().playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2f, 1f); - player.getWorld().playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 2f, 1f); } } else @@ -236,21 +245,21 @@ public class ChallengeRedLightGreenLight extends Challenge _timeBeforeAction = System.currentTimeMillis() + 1500; //1.5 seconds before the player HAS to stand still _canMove = false; spawnFireWork(Color.RED); - for(Player player: UtilServer.getPlayers()) + for (Player player : UtilServer.getPlayers()) { player.sendMessage(F.main("Red Light", "Freeze!")); - UtilTextMiddle.display(ChatColor.RED + "Freeze!", "", 0, 20*3, 20); - + UtilTextMiddle.display(ChatColor.RED + "Freeze!", "", 0, 20 * 3, 20); + + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); - player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); } } } } - + private void spawnFireWork(Color color) { - for(int i = -getArenaSize(); i < getArenaSize()*2; i += 4) + for (int i = -getArenaSize(); i < getArenaSize() * 2; i += 4) { UtilFirework.playFirework(new Location(Host.WorldData.World, 30, 10, i), Type.BALL_LARGE, color, false, false); } 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 54c9ed408..e3c74109e 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 @@ -28,6 +28,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeReverseTag extends Challenge { @@ -38,9 +39,14 @@ public class ChallengeReverseTag extends Challenge private HashSet _cooldowned = new HashSet(); private HashSet _nonTaggedPlayers = new HashSet(); - public ChallengeReverseTag(BawkBawkBattles Host) + public ChallengeReverseTag(BawkBawkBattles host) { - super(Host, ChallengeType.FirstComplete, "Reverse Tag", "Be a sparkling person until the end.", "Punch the sparking people to become one!"); + super( + host, + ChallengeType.FirstComplete, + "Reverse Tag", + "Punch a sparkling person to become one.", + "Stay sparkling until the end."); } @Override @@ -48,11 +54,11 @@ public class ChallengeReverseTag extends Challenge { ArrayList spawns = new ArrayList(); - for(int x = -14; x <= 14; x++) + for (int x = -14; x <= 14; x++) { - for(int z = -14; z <= 14; z++) + for (int z = -14; z <= 14; z++) { - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5)); } @@ -77,10 +83,10 @@ public class ChallengeReverseTag extends Challenge ArrayList players = new ArrayList(Host.GetPlayers(true)); Collections.shuffle(players); - for(Player player : players) + for (Player player : players) { _nonTaggedPlayers.add(player); - if(looped % 2 == 0) + if (looped % 2 == 0) { addTagged(player); } @@ -94,18 +100,18 @@ public class ChallengeReverseTag extends Challenge { int random = UtilMath.r(16); - for(int x = -16; x <= 16; x += 4) + for (int x = -16; x <= 16; x += 4) { - for(int z = -16; z <= 16; z += 4) + for (int z = -16; z <= 16; z += 4) { - for(int y = 0; y <= 0; y++) + for (int y = 0; y <= 0; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(y == 0) + if (y == 0) { - for(int _x = x; _x <= x + 3; _x++) + for (int _x = x; _x <= x + 3; _x++) { - for(int _z = z; _z <= z + 3; _z++) + for (int _z = z; _z <= z + 3; _z++) { b = getCenter().getBlock().getRelative(_x, y, _z); b.setType(Material.WOOL); @@ -115,7 +121,7 @@ public class ChallengeReverseTag extends Challenge } random = UtilMath.r(16); } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } @@ -127,21 +133,21 @@ public class ChallengeReverseTag extends Challenge @EventHandler public void tntFirework(UpdateEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getType() != UpdateType.SEC) + if (event.getType() != UpdateType.SEC) { return; } checkGameEnd(); - if(UtilServer.getPlayers().length > 40) // Made to prevent lag issues + if (UtilServer.getPlayers().length > 40) // Made to prevent lag issues { return; } - for(String nameofPlayer : _tagged) + for (String nameofPlayer : _tagged) { UtilFirework.playFirework(Bukkit.getPlayer(nameofPlayer).getEyeLocation(), Type.BURST, Color.GREEN, false, false); } @@ -150,25 +156,25 @@ public class ChallengeReverseTag extends Challenge @EventHandler public void onPlayerPunch(CustomDamageEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.GetDamagerPlayer(false) == null || event.GetDamageePlayer() == null) + if (event.GetDamagerPlayer(false) == null || event.GetDamageePlayer() == null) { return; } - if(_tagged.contains(event.GetDamagerPlayer(false).getName())) + if (_tagged.contains(event.GetDamagerPlayer(false).getName())) { event.SetCancelled("Tagger can't tag another"); return; } - if(!(_tagged.contains(event.GetDamageePlayer().getName()))) + if (!(_tagged.contains(event.GetDamageePlayer().getName()))) { event.SetCancelled("Damaged a nontagged person"); return; } - if(_cooldowned.contains(event.GetDamageePlayer().getName())) + if (_cooldowned.contains(event.GetDamageePlayer().getName())) { event.SetCancelled("Damaged is on cooldown"); return; @@ -176,15 +182,15 @@ public class ChallengeReverseTag extends Challenge removeTagged(event.GetDamageePlayer()); addTagged(event.GetDamagerPlayer(false)); } - + @EventHandler public void displayGameProgress(UpdateEvent event) { - if(event.getType() != UpdateType.FASTEST) + if (event.getType() != UpdateType.FASTEST) { return; } - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } @@ -194,11 +200,11 @@ public class ChallengeReverseTag extends Challenge @EventHandler public void onTaggedDeath(PlayerDeathEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(_tagged.contains(event.getEntity().getName())) + if (_tagged.contains(event.getEntity().getName())) { _tagged.remove(event.getEntity().getName()); } @@ -206,20 +212,20 @@ public class ChallengeReverseTag extends Challenge private void removeTagged(Player player) { - if(_tagged.contains(player.getName())) + if (_tagged.contains(player.getName())) { //UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!"); - + UtilTextMiddle.display(null, C.cRed + "You are no longer tagged.", 5, 40, 5, player); player.getInventory().setHelmet(new ItemStack(Material.AIR)); _tagged.remove(player.getName()); - - if(_nonTaggedPlayers.contains(player)) + + if (_nonTaggedPlayers.contains(player)) { _nonTaggedPlayers.remove(player); } - - for(int i = 0; i <= 8; i++) + + for (int i = 0; i <= 8; i++) { player.getInventory().clear(i); } @@ -228,15 +234,15 @@ public class ChallengeReverseTag extends Challenge private void addTagged(final Player player) { - if(!_tagged.contains(player.getName())) + if (!_tagged.contains(player.getName())) { // UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cGreen + "NOW" + C.cYellow + " tagged! Keep it up!"); - + UtilTextMiddle.display(null, C.cGreen + "You are now tagged, keep it up.", 5, 40, 5, player); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(35, (byte) 5)); _tagged.add(player.getName()); _cooldowned.add(player.getName()); - + new BukkitRunnable() { @Override @@ -244,10 +250,9 @@ public class ChallengeReverseTag extends Challenge { _cooldowned.remove(player.getName()); } - }.runTaskLater(Host.Manager.getPlugin(), 20*_cooldown); + }.runTaskLater(Host.Manager.getPlugin(), 20 * _cooldown); - - for(int i = 0; i <= 8; i++) + for (int i = 0; i <= 8; i++) { player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(35, (byte) 5)); } @@ -256,11 +261,11 @@ public class ChallengeReverseTag extends Challenge public void checkGameEnd() { - if(System.currentTimeMillis() > _endTime) + if (System.currentTimeMillis() > _endTime) { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - if(_tagged.contains(player.getName())) + if (_tagged.contains(player.getName())) { SetCompleted(player); } @@ -271,7 +276,7 @@ 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/ChallengeRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRunner.java index edbf57d94..18a8d69eb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRunner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRunner.java @@ -20,6 +20,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeRunner extends Challenge { @@ -27,8 +28,12 @@ public class ChallengeRunner extends Challenge public ChallengeRunner(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Runner", - "Blocks are disappearing beneath you! Run away!"); + super( + host, + ChallengeType.LastStanding, + "Runner", + "Blocks below your feet are falling.", + "Run as fast as you can!"); } @Override @@ -73,7 +78,7 @@ public class ChallengeRunner extends Challenge } _spawns.add(getCenter() - .add((pX * 4) + 1.5, 1.1, (pZ * 4) + 1.5)); + .add((pX * 4) + 1.5, 1.1, (pZ * 4) + 1.5)); for (int x = pX * 4; x < (pX * 4) + 2; x++) { @@ -146,7 +151,7 @@ public class ChallengeRunner extends Challenge byte data = block.getData(); MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); FallingBlock ent = block.getWorld().spawnFallingBlock( - block.getLocation(), id, data); + block.getLocation(), id, data); _fallingBlocks.add(ent); blockIterator.remove(); @@ -156,7 +161,7 @@ public class ChallengeRunner extends Challenge public void AddBlock(Block block) { if (block == null || block.getTypeId() == 0 || block.getTypeId() == 7 - || block.isLiquid()) + || block.isLiquid()) return; if (block.getRelative(BlockFace.UP).getTypeId() != 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java index 4b5b5004d..16e4f2bd9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeRushPush.java @@ -19,16 +19,22 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeRushPush extends Challenge { - private boolean _challengeEnded = false; private HashMap _teams = new HashMap(); public ChallengeRushPush(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Rush push", true, true, "Rush to your enemy.", - "Push them off the platform."); + super( + host, + ChallengeType.LastStanding, + "Rush push", + true, + true, + "Rush to your enemy.", + "Push them off the platform."); } @Override @@ -108,19 +114,19 @@ public class ChallengeRushPush extends Challenge } } } - + @EventHandler public void onDeath(PlayerDeathEvent event) { int onBlue = 0; int onRed = 0; - if(_teams.containsKey(event.getEntity().getName())) + if (_teams.containsKey(event.getEntity().getName())) { _teams.remove(event.getEntity().getName()); } - for(String playerName: _teams.keySet()) + for (String playerName : _teams.keySet()) { - if(_teams.get(playerName) == "blue") + if (_teams.get(playerName) == "blue") { onBlue++; } @@ -129,7 +135,7 @@ public class ChallengeRushPush extends Challenge onRed++; } } - if((onBlue == 0 || onRed == 0) && Host.isCrumbling() == false) + if ((onBlue == 0 || onRed == 0) && Host.isCrumbling() == false) { UtilTextMiddle.display(onBlue == 0 ? C.cBlue + "Blue Team won!" : C.cRed + "Red Team won!", "Friendly fire enabled!", 20, 60, 20); } @@ -158,7 +164,7 @@ public class ChallengeRushPush extends Challenge if (_teams.containsKey(event.GetDamageePlayer().getName())) { if (_teams.get(event.GetDamagerPlayer(false).getName()) == _teams.get(event.GetDamageePlayer() - .getName())) + .getName())) { event.SetCancelled("Friendly Fire"); return; 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 b690b96b4..267d85844 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 @@ -4,16 +4,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilMath; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -29,17 +19,33 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + 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(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Chicken Shooting", "Shoot 6 chickens!"); + super( + host, + ChallengeType.FirstComplete, + "Chicken Shooting", + "Shoot 6 chickens.", + "When a chicken lands, it dissapears."); } @Override @@ -60,16 +66,16 @@ public class ChallengeShootChickens extends Challenge @EventHandler public void onShoot(ProjectileLaunchEvent event) - { - if(event.getEntity() instanceof Arrow) + { + if (event.getEntity() instanceof Arrow) { _arrows.add(event.getEntity()); - + Arrow arrow = (Arrow) event.getEntity(); Player player = (Player) arrow.getShooter(); - if(!isDone(player)) + if (!isDone(player)) { - _arrowsShot.put(player, _arrowsShot.get(player)+1); + _arrowsShot.put(player, _arrowsShot.get(player) + 1); } } } @@ -131,11 +137,11 @@ public class ChallengeShootChickens extends Challenge return; } UpdateType speed; - if(getCurrentyAlive(false).size() >= 40) + if (getCurrentyAlive(false).size() >= 40) { speed = UpdateType.FASTEST; } - else if(getCurrentyAlive(false).size() >= 20) + else if (getCurrentyAlive(false).size() >= 20) { speed = UpdateType.FASTER; } @@ -164,7 +170,8 @@ public class ChallengeShootChickens extends Challenge if (_chickens.size() < 11 + (getChallengers().size() * 2)) { - Location loc = getCenter().clone().add(UtilMath.r(getArenaSize()*2) - (getArenaSize()), 15, UtilMath.r(getArenaSize()*2) - (getArenaSize())); + Location loc = getCenter().clone().add(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 15, + UtilMath.r(getArenaSize() * 2) - (getArenaSize())); Host.CreatureAllowOverride = true; Chicken chicken = (Chicken) loc.getWorld().spawnEntity(loc, EntityType.CHICKEN); @@ -183,7 +190,8 @@ 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); @@ -242,9 +250,9 @@ public class ChallengeShootChickens extends Challenge { ArrayList spawns = new ArrayList(); - for (int x = -(getArenaSize()-1); x <= getArenaSize()-1; x++) + for (int x = -(getArenaSize() - 1); x <= getArenaSize() - 1; x++) { - for (int z = -(getArenaSize()-1); z <= getArenaSize()-1; z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) { if (x % 2 == 0 && z % 2 == 0) { @@ -255,7 +263,7 @@ 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/ChallengeSmashOff.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java index 8482ed715..e3de24404 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSmashOff.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Player; import mineplex.core.common.util.UtilMath; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeSmashOff extends Challenge { @@ -17,7 +18,13 @@ public class ChallengeSmashOff extends Challenge public ChallengeSmashOff(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Smash off", false, true, "Knock other players off the platform!"); + super( + host, + ChallengeType.LastStanding, + "Smash Off", + false, + true, + "Knock all others off the platform."); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSpleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSpleef.java index aaf2e8c3a..3ef6434fd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSpleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeSpleef.java @@ -14,13 +14,17 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeSpleef extends Challenge { public ChallengeSpleef(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Spleef", - "Destroy the blocks beneath other players!"); + super( + host, + ChallengeType.LastStanding, + "Spleef", + "Destroy the blocks beneath other players!"); } @Override @@ -64,7 +68,7 @@ public class ChallengeSpleef extends Challenge Block block = event.getClickedBlock(); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, - block.getTypeId()); + block.getTypeId()); block.setType(Material.AIR); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java index e9bc033e2..13a466a73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeStandOnColor.java @@ -5,6 +5,14 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map.Entry; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; @@ -13,14 +21,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeStandOnColor extends Challenge { @@ -33,7 +34,11 @@ public class ChallengeStandOnColor extends Challenge public ChallengeStandOnColor(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Color Change", "Stand on the correct color."); + super( + host, + ChallengeType.LastStanding, + "Color Change", + "Stand on the correct color."); for (int i = 0; i <= 15; i++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java index 324676f07..0ef2c276e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTntLauncher.java @@ -26,6 +26,7 @@ import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeTntLauncher extends Challenge { @@ -34,7 +35,14 @@ public class ChallengeTntLauncher extends Challenge public ChallengeTntLauncher(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Deadly TNT", false, true, "Throw TNT to other players.", "Don't get knocked off!"); + super( + host, + ChallengeType.LastStanding, + "Deadly TNT", + false, + true, + "Throw TNT to other players.", + "Do not get knocked off."); } @Override @@ -64,7 +72,7 @@ public class ChallengeTntLauncher extends Challenge return; HashMap players = UtilPlayer.getInRadius(event.getLocation(), - 4 + ((System.currentTimeMillis() - getStartTime()) / 10000D)); + 4 + ((System.currentTimeMillis() - getStartTime()) / 10000D)); for (Player player : players.keySet()) { @@ -73,7 +81,7 @@ public class ChallengeTntLauncher extends Challenge // Knockback UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, - 0.5 + 2 * mult, 10, true); + 0.5 + 2 * mult, 10, true); } event.blockList().clear(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTreasureDigger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTreasureDigger.java index 691db3469..3395f3527 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTreasureDigger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeTreasureDigger.java @@ -3,13 +3,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; import java.util.LinkedHashMap; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.common.util.UtilTextMiddle; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -27,6 +20,14 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilTextMiddle; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeTreasureDigger extends Challenge { private LinkedHashMap _lootChance = new LinkedHashMap(); @@ -34,8 +35,12 @@ public class ChallengeTreasureDigger extends Challenge public ChallengeTreasureDigger(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Treasure Digger", "Search for treasure below the sand.", "Find weapons to kill the others!", - "Be the last person to stay alive."); + super( + host, + ChallengeType.LastStanding, + "Treasure Digger", + "Search for treasure below the sand.", + "Find weapons to kill the others!"); _lootChance.put(Material.BONE, 20.0); _lootChance.put(Material.STRING, 20.0); @@ -83,7 +88,7 @@ public class ChallengeTreasureDigger extends Challenge ArrayList spawns = new ArrayList(); Location center = new Location(Host.WorldData.World, 0, 0, 0); - for(Location location : UtilShapes.getCircle(center, true, getArenaSize() - 2)) + for (Location location : UtilShapes.getCircle(center, true, getArenaSize() - 2)) { double x = location.getX() + 0.5; double y = 4.1; @@ -102,73 +107,73 @@ public class ChallengeTreasureDigger extends Challenge { Location center = new Location(Host.WorldData.World, 0, 0, 0); - for(int i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { - if(i > 0) + if (i > 0) { center = center.clone(); center.setY(0); center.add(0, i, 0); } - for(Location location : UtilShapes.getCircle(center, false, getArenaSize())) + for (Location location : UtilShapes.getCircle(center, false, getArenaSize())) { Block block = location.getBlock(); double chance = Math.random() * 100; - if(i == 0) + if (i == 0) { block.setType(Material.BEDROCK); } - else if(i == 1) + else if (i == 1) { block.setType(Material.SAND); - if(chance < 45.0) // 20% + if (chance < 45.0) // 20% { block.setData((byte) 1); } - if(chance < 25.0) // 10% + if (chance < 25.0) // 10% { block.setType(Material.SANDSTONE); block.setData((byte) 0); } - if(chance < 15.0) // 15% + if (chance < 15.0) // 15% { makeChestWithTreasure(block); } } - else if(i == 2) + else if (i == 2) { block.setType(Material.SAND); - if(chance < 30.0) // 20% + if (chance < 30.0) // 20% { block.setData((byte) 1); } - if(chance < 10.0) // 10% + if (chance < 10.0) // 10% { block.setType(Material.SANDSTONE); block.setData((byte) 0); } } - else if(i == 3) + else if (i == 3) { block.setType(Material.SAND); - if(chance < 10.0) // 10% + if (chance < 10.0) // 10% { block.setType(Material.SANDSTONE); } } - else if(i == 4) + else if (i == 4) { Block below = block.getRelative(BlockFace.DOWN); - if(chance < 1.5 && !getSpawns().contains(block.getLocation()) && below.getType() == Material.SAND) + if (chance < 1.5 && !getSpawns().contains(block.getLocation()) && below.getType() == Material.SAND) { block.setType(Material.DEAD_BUSH); } @@ -190,7 +195,7 @@ public class ChallengeTreasureDigger extends Challenge Host.WorldBlockBurn = true; Host.WorldFireSpread = true; - for(Player players : Host.GetPlayers(true)) + for (Player players : Host.GetPlayers(true)) { ItemStack shovel = new ItemStack(Material.STONE_SPADE); players.getInventory().setItem(4, shovel); @@ -210,9 +215,9 @@ public class ChallengeTreasureDigger extends Challenge Host.WorldBlockBurn = false; Host.WorldFireSpread = false; - for(Entity entity : Host.WorldData.World.getEntities()) + for (Entity entity : Host.WorldData.World.getEntities()) { - if(entity instanceof Item) + if (entity instanceof Item) { entity.remove(); } @@ -228,7 +233,7 @@ public class ChallengeTreasureDigger extends Challenge @EventHandler public void onEntityChangeBlock(EntityChangeBlockEvent event) { - if(event.getEntity() instanceof FallingBlock) + if (event.getEntity() instanceof FallingBlock) { FallingBlock block = (FallingBlock) event.getEntity(); block.setDropItem(false); @@ -238,17 +243,17 @@ public class ChallengeTreasureDigger extends Challenge @EventHandler public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { - if(event.getEntity() instanceof Player && event.getDamager() instanceof Player) + if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) { Player damager = (Player) event.getDamager(); ItemStack item = damager.getItemInHand(); - if(isDone(damager)) + if (isDone(damager)) return; - if(item != null) + if (item != null) { - if(!item.getType().name().toLowerCase().contains("sword")) + if (!item.getType().name().toLowerCase().contains("sword")) { UtilTextMiddle.display("", C.cRed + "You cannot attack without a weapon.", 5, 40, 5, damager); damager.playSound(damager.getLocation(), Sound.NOTE_BASS_GUITAR, 1.0F, 0.5F); @@ -261,7 +266,7 @@ public class ChallengeTreasureDigger extends Challenge @SuppressWarnings("deprecation") private void makeChestWithTreasure(Block block) { - if(!areChestsNearby(block)) + if (!areChestsNearby(block)) { block.setType(Material.CHEST); block.setData((byte) UtilMath.r(4)); @@ -279,38 +284,38 @@ public class ChallengeTreasureDigger extends Challenge Block west = block.getRelative(BlockFace.WEST); return north.getType() == Material.CHEST || south.getType() == Material.CHEST || east.getType() == Material.CHEST - || west.getType() == Material.CHEST; + || west.getType() == Material.CHEST; } private void fillChestWithLoot(Chest chest) { Inventory inv = chest.getInventory(); - for(int i = 0; i <= UtilMath.r(2) + 1; i++) + for (int i = 0; i <= UtilMath.r(2) + 1; i++) { double chance = Math.random() * 100; Material loot = getRandomLootMaterial(); double lootChance = getLootChance(loot); - while(chance >= lootChance) + while (chance >= lootChance) { chance = Math.random() * 100; loot = getRandomLootMaterial(); lootChance = getLootChance(loot); } - if(chance < lootChance) + if (chance < lootChance) { ItemStack item = new ItemStack(loot); - if(item.getType() == Material.ARROW || item.getType() == Material.BONE || item.getType() == Material.STRING) + if (item.getType() == Material.ARROW || item.getType() == Material.BONE || item.getType() == Material.STRING) { item.setAmount(UtilMath.r(3) + 1); } int slot = UtilMath.r(inv.getSize()); - while(inv.getItem(slot) != null && inv.getContents().length != inv.getSize()) + while (inv.getItem(slot) != null && inv.getContents().length != inv.getSize()) { slot = UtilMath.r(inv.getSize()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java index 8c5034111..1d262b436 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeVolleyPig.java @@ -38,6 +38,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeVolleyPig extends Challenge { @@ -51,7 +52,11 @@ public class ChallengeVolleyPig extends Challenge public ChallengeVolleyPig(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Volley Pig", "Punch the pig on the enemy side.", "Do not cross the middle!"); + super( + host, + ChallengeType.FirstComplete, + "Volley Pig", + "Punch the pig on the enemy side."); } @Override @@ -138,7 +143,7 @@ public class ChallengeVolleyPig extends Challenge { String pName = event.getPlayer().getName(); Vector bump = UtilAlg.getAverageBump(event.getPlayer().getLocation(), - new ArrayList(Arrays.asList(_playerTeams.get(pName) == "blue" ? _blueCenter : _redCenter))); + new ArrayList(Arrays.asList(_playerTeams.get(pName) == "blue" ? _blueCenter : _redCenter))); UtilAction.velocity(event.getPlayer(), bump, 0.8, false, 0, 0.4, 10, true); event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 3, 1)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaterHorror.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaterHorror.java index cded80b9b..ae611d9b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaterHorror.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeWaterHorror.java @@ -30,6 +30,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeWaterHorror extends Challenge { @@ -43,8 +44,12 @@ public class ChallengeWaterHorror extends Challenge public ChallengeWaterHorror(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Water Horror", "Deadly TNT is spawning from the water!", - "Use your boat to dodge explosions."); + super( + host, + ChallengeType.LastStanding, + "Water Horror", + "TNT is spawning from the water!", + "Use your boat to dodge explosions."); } @Override @@ -198,8 +203,8 @@ public class ChallengeWaterHorror extends Challenge if (entity.isValid() && !entity.isOnGround()) { UtilParticle.PlayParticleToAll(ParticleType.FLAME, entity.getLocation(), 0.2F, 0.2F, 0.2F, - 0.0F, 2, - ViewDist.LONG); + 0.0F, 2, + ViewDist.LONG); new BukkitRunnable() { @@ -226,7 +231,7 @@ public class ChallengeWaterHorror extends Challenge UtilParticle.PlayParticleToAll(ParticleType.FLAME, dropsite, 0.3F, 0.3F, 0.3F, 0.03F, 2, ViewDist.LONG); UtilParticle.PlayParticleToAll(ParticleType.CLOUD, base, 0.1F, 0.1F, 0.1F, 0.0F, 2, - ViewDist.LONG); + ViewDist.LONG); } @EventHandler 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 f712a0f91..deef027ba 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 @@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.projectile.ProjectileUser; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; public class ChallengeWaveCrush extends Challenge @@ -28,12 +29,16 @@ 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(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Wave Crush", "Avoid the crushing waves!"); + super( + host, + ChallengeType.LastStanding, + "Wave Crush", + "Avoid the crushing waves."); } @Override @@ -41,11 +46,11 @@ public class ChallengeWaveCrush extends Challenge { ArrayList spawns = new ArrayList(); - for(int x = -15; x <= -13; x++) + for (int x = -15; x <= -13; x++) { - for(int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) + for (int z = -(getArenaSize() - 1); z <= getArenaSize() - 1; z++) { - if(x % 2 == 0 && z % 2 == 0) + if (x % 2 == 0 && z % 2 == 0) { spawns.add(getCenter().clone().add(x + 0.5, 2.1, z + 0.5)); } @@ -59,17 +64,17 @@ public class ChallengeWaveCrush extends Challenge { _inProgress = false; - for(int x = -16; x <= 15; x++) + for (int x = -16; x <= 15; x++) { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 0; y <= 10; y++) + for (int y = 0; y <= 10; y++) { Block b = Host.WorldData.World.getBlockAt(x, y, z); { - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { - if(!getModifiedBlocks().contains(b)) + if (!getModifiedBlocks().contains(b)) { b.setType(Material.AIR); } @@ -83,11 +88,11 @@ public class ChallengeWaveCrush extends Challenge @Override public void setupPlayers() { - for(Player player: Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { _survivedWaves.put(player, 0); } - + _inProgress = true; new BukkitRunnable() @@ -99,28 +104,28 @@ public class ChallengeWaveCrush extends Challenge _waveAmount++; Block choosenBlock; - if(!_inProgress || !Host.IsLive()) + if (!_inProgress || !Host.IsLive()) { this.cancel(); } choosenBlock = Host.WorldData.World.getBlockAt(15, 1, UtilMath.r(getArenaSize() * 2) - getArenaSize()); - while(choosenBlock.getType() == Material.AIR) + while (choosenBlock.getType() == Material.AIR) { choosenBlock = Host.WorldData.World.getBlockAt(15, 1, UtilMath.r(getArenaSize() * 2) - getArenaSize()); } waveStartingPoint(choosenBlock, 2); - if(_waveAmount % 3 == 0) + if (_waveAmount % 3 == 0) { _waveSpeed--; } - - for(Player player: _survivedWaves.keySet()) + + for (Player player : _survivedWaves.keySet()) { - if(!isDone(player)) + if (!isDone(player)) { - _survivedWaves.put(player, _survivedWaves.get(player)+1); + _survivedWaves.put(player, _survivedWaves.get(player) + 1); } } } @@ -133,30 +138,30 @@ public class ChallengeWaveCrush extends Challenge int var = 0; int colorPicker = 0; - for(int x = -16; x <= 15; x++) + for (int x = -16; x <= 15; x++) { - for(int z = -getArenaSize(); z <= getArenaSize(); z++) + for (int z = -getArenaSize(); z <= getArenaSize(); z++) { - for(int y = 0; y <= 1; y++) + for (int y = 0; y <= 1; y++) { Block b = getCenter().getBlock().getRelative(x, y, z); - if(y == 0) + if (y == 0) { b.setType(Material.BEDROCK); } - else if(y > 0) + else if (y > 0) { b.setType(Material.WOOL); b.setData(_colorList.get(colorPicker).byteValue()); } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } } } - if(var % 4 == 0 && (colorPicker != _colorList.size() - 1)) + if (var % 4 == 0 && (colorPicker != _colorList.size() - 1)) { colorPicker++; } @@ -167,37 +172,37 @@ public class ChallengeWaveCrush extends Challenge @Override public void onCollide(LivingEntity target, Block block, ProjectileUser data) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!(data.GetThrown() instanceof FallingBlock)) + if (!(data.GetThrown() instanceof FallingBlock)) { return; } - if(!(target instanceof Player)) + if (!(target instanceof Player)) { return; } Player thePlayer = (Player) target; - if(isDone(thePlayer)) + if (isDone(thePlayer)) { return; } - if(!Host.IsAlive(thePlayer)) + if (!Host.IsAlive(thePlayer)) { return; } Host.Manager.GetDamage().NewDamageEvent(target, null, null, DamageCause.PROJECTILE, 9999.0, false, false, false, "Falling Block", - "Wave crush"); + "Wave crush"); } public void waveStartingPoint(Block block, int radius) { Block pickedBlock = Host.WorldData.World.getBlockAt(block.getX(), block.getY(), block.getZ() - radius); - if(radius != 1) + if (radius != 1) { - for(int i = 0; i <= (radius * 2) + 1; i++) + for (int i = 0; i <= (radius * 2) + 1; i++) { waveCreation(Host.WorldData.World.getBlockAt(pickedBlock.getX(), pickedBlock.getY(), pickedBlock.getZ() + i)); } @@ -211,9 +216,9 @@ public class ChallengeWaveCrush extends Challenge @EventHandler public void OnChallengeEnd(ChallengeEndEvent event) { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { - if(!isDone(player)) + if (!isDone(player)) { SetCompleted(player); } @@ -224,9 +229,9 @@ public class ChallengeWaveCrush extends Challenge @Override public void run() { - for(Entity fBlocks : Host.WorldData.World.getEntities()) + for (Entity fBlocks : Host.WorldData.World.getEntities()) { - if(fBlocks instanceof FallingBlock) + if (fBlocks instanceof FallingBlock) { fBlocks.remove(); } @@ -245,16 +250,16 @@ public class ChallengeWaveCrush extends Challenge @Override public void run() { - if(!_inProgress) + if (!_inProgress) { this.cancel(); } - if(theBlock.getType() == Material.AIR) + if (theBlock.getType() == Material.AIR) { this.cancel(); } FallingBlock fBlock = Host.WorldData.World.spawnFallingBlock(theBlock.getLocation().clone().add(0, 1, 0), theBlock.getType(), - theBlock.getData()); + theBlock.getData()); Host.Manager.GetProjectile().AddThrow(fBlock, null, Host, -1, true, false, true, true, 0.7f); fBlock.setVelocity(new Vector(0, 10, 0).normalize()); @@ -263,7 +268,7 @@ 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/challenges/removed/ChallengeBlockShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeBlockShot.java index f2d3de401..d379004ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeBlockShot.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeBlockShot.java @@ -3,19 +3,6 @@ package nautilus.game.arcade.game.games.mineware.challenges.removed; import java.util.ArrayList; import java.util.HashMap; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; - import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; @@ -32,6 +19,20 @@ import org.bukkit.material.Wool; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.scheduler.BukkitRunnable; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; + public class ChallengeBlockShot extends Challenge { private HashMap _shotBlocks = new HashMap(); @@ -40,7 +41,11 @@ public class ChallengeBlockShot extends Challenge public ChallengeBlockShot(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Block Shot", "Shoot down 5 blocks"); + super( + host, + ChallengeType.FirstComplete, + "Block Shot", + "Shoot down 5 blocks"); } @Override @@ -95,10 +100,10 @@ public class ChallengeBlockShot extends Challenge Location sloc = player.getEyeLocation(); sloc.add(UtilAlg.getTrajectory(sloc, block.getLocation().add(0.5, 0.5, 0.5)).multiply( - Math.min(7, block.getLocation().distance(sloc)))); + Math.min(7, block.getLocation().distance(sloc)))); displayCount(player, sloc, - (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen : score >= 1 ? C.cRed : C.cDRed) + score); + (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen : score >= 1 ? C.cRed : C.cDRed) + score); if (score == 5) { @@ -107,7 +112,7 @@ public class ChallengeBlockShot extends Challenge Location loc = block.getLocation().add(0.5, 0.5, 0.5); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0, 0, 0, 0, 1, ViewDist.MAX, - UtilServer.getPlayers()); + UtilServer.getPlayers()); spawnBlock(); @@ -154,7 +159,7 @@ public class ChallengeBlockShot extends Challenge for (Player player : Host.GetPlayers(true)) { player.getInventory().setItem(0, - new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build()); + new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build()); player.getInventory().setItem(9, new ItemStack(Material.ARROW)); _shotBlocks.put(player.getName(), 0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeDiamondFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeDiamondFall.java index b6d1fbbca..9c4bf2192 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeDiamondFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeDiamondFall.java @@ -18,12 +18,17 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeDiamondFall extends Challenge { public ChallengeDiamondFall(BawkBawkBattles host) { - super(host, ChallengeType.LastStanding, "Diamond Fall", "Loot the most diamonds from chests!"); + super( + host, + ChallengeType.LastStanding, + "Diamond Fall", + "Loot the most diamonds from chests!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeHitTargets.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeHitTargets.java index 60db5674c..fd7892dfb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeHitTargets.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeHitTargets.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeHitTargets extends Challenge { @@ -24,7 +25,11 @@ public class ChallengeHitTargets extends Challenge public ChallengeHitTargets(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Hit target", "Hit the chosen players"); + super( + host, + ChallengeType.FirstComplete, + "Hit target", + "Hit the chosen players."); } @EventHandler @@ -56,7 +61,7 @@ public class ChallengeHitTargets extends Challenge } displayCount(p, event.GetDamageeEntity().getEyeLocation().add(0, 0.3, 0), (targets.isEmpty() ? C.cDGreen - : targets.size() == 1 ? C.cRed : C.cDRed) + (_targetsEach - targets.size())); + : targets.size() == 1 ? C.cRed : C.cDRed) + (_targetsEach - targets.size())); if (targets.isEmpty()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeNameThatSound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeNameThatSound.java index 64a255521..52f1e0ab9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeNameThatSound.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeNameThatSound.java @@ -27,6 +27,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.ChallengeSeperateRooms; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeNameThatSound extends ChallengeSeperateRooms { @@ -38,7 +39,10 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms public ChallengeNameThatSound(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Hit the creature that makes the noises"); + super( + host, + ChallengeType.FirstComplete, + "Hit the creature that makes the noises."); _sounds.put(EntityType.ZOMBIE, new Sound[] { Sound.ZOMBIE_DEATH, @@ -245,11 +249,11 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms if (_lastGuess.containsKey(player.getName()) && !UtilTime.elapsed(_lastGuess.get(player.getName()), 3000)) { player.sendMessage(F.main( - "Guess", - "Wait " - + UtilTime.convertString((_lastGuess.get(player.getName()) + 3000) - System.currentTimeMillis(), 1, - TimeUnit.SECONDS) - + " before next guess")); + "Guess", + "Wait " + + UtilTime.convertString((_lastGuess.get(player.getName()) + 3000) - System.currentTimeMillis(), 1, + TimeUnit.SECONDS) + + " before next guess")); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSimonSays.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSimonSays.java index ea283788a..ae3e09bd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSimonSays.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSimonSays.java @@ -5,17 +5,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Random; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTextBottom; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; -import nautilus.game.arcade.game.games.mineware.Challenge; -import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; - import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect; @@ -37,6 +26,18 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; +import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; +import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent; + public class ChallengeSimonSays extends Challenge { private boolean _truthful = true; @@ -56,8 +57,13 @@ public class ChallengeSimonSays extends Challenge public ChallengeSimonSays(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Simon Says", "Do everything Simon says", "Don't listen to anyone else!", - "first with 3 correct wins!"); + super( + host, + ChallengeType.FirstComplete, + "Simon Says", + "Do everything that Simon says.", + "Don't listen to anyone else!", + "First with 3 correct answers wins."); } private enum simonTypes @@ -335,7 +341,7 @@ public class ChallengeSimonSays extends Challenge _eventKey = true; Bukkit.broadcastMessage( - C.cGreen + C.Bold + "Villager> " + C.cYellow + (_truthful == true ? "Simon says: " : "") + _currentType.getOrderName()); + C.cGreen + C.Bold + "Villager> " + C.cYellow + (_truthful == true ? "Simon says: " : "") + _currentType.getOrderName()); startOrderTimer(); } @@ -436,7 +442,7 @@ public class ChallengeSimonSays extends Challenge SetCompleted(player); } UtilFirework.launchFirework(player.getLocation(), FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.STAR).trail(false) - .build(), null, 1); + .build(), null, 1); } private void playerScoreOnFail(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSkyFall.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSkyFall.java index cfbfac842..49020a787 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSkyFall.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeSkyFall.java @@ -8,19 +8,24 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeSkyFall extends Challenge { public ChallengeSkyFall(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Skyfall", "Land on the bottom pad, knock players around with snowballs!"); - + super( + host, + ChallengeType.FirstComplete, + "Skyfall", + "Land on the bottom pad, knock players around with snowballs!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeTameTheWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeTameTheWolf.java index c1e199c56..eccb6c6e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeTameTheWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/removed/ChallengeTameTheWolf.java @@ -20,18 +20,23 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; import nautilus.game.arcade.game.games.mineware.BawkBawkBattles; import nautilus.game.arcade.game.games.mineware.Challenge; +import nautilus.game.arcade.game.games.mineware.ChallengeType; public class ChallengeTameTheWolf extends Challenge { private ArrayList _bannedFood = new ArrayList( - Arrays.asList(Material.MUSHROOM_SOUP, Material.GOLDEN_APPLE)); + Arrays.asList(Material.MUSHROOM_SOUP, Material.GOLDEN_APPLE)); private ArrayList currentFood = getAllFoods(); private HashMap _playerScore = new HashMap(); private HashMap _wolfs = new HashMap(); public ChallengeTameTheWolf(BawkBawkBattles host) { - super(host, ChallengeType.FirstComplete, "Tame The Wolf", "Find the right item", "To tame the wolf!"); + super( + host, + ChallengeType.FirstComplete, + "Tame The Wolf", + "Find the correct item to tame the wolf."); } @Override @@ -158,7 +163,7 @@ public class ChallengeTameTheWolf extends Challenge event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.SUCCESSFUL_HIT, 1f, 1f); increasePlayerScore(event.getPlayer()); displayCount(event.getPlayer(), wolf.getLocation().add(0, 1, 0), - C.cGreen + _playerScore.get(event.getPlayer().getName())); + C.cGreen + _playerScore.get(event.getPlayer().getName())); wolf.setBreed(true); _wolfs.remove(wolf); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java index 6861bc4e1..39ce314b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/ChickenAttack.java @@ -11,11 +11,16 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Chicken; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.disguise.disguises.DisguiseChicken; @@ -70,52 +75,68 @@ public class ChickenAttack public void start(Player player) { - _host.getPlayersTeam().RemovePlayer(player); - _host.getChickenTeam().AddPlayer(player, true); + _host.getPlayersTeam().RemovePlayer(player); + _host.getChickenTeam().AddPlayer(player, true); UtilInv.Clear(player); _host.Manager.Clear(player); player.teleport(_center); - UtilTextMiddle.display(C.cRed + "Chicken Attack", "You ran out of lives!", 5, 40, 5, player); + UtilTextMiddle.display(C.cRed + "Chicken Attack!", "You ran out of lives.", 5, 40, 5, player); player.playSound(player.getLocation(), Sound.WITHER_SPAWN, 1.0F, 1.0F); - debugDeathTask(player); + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 1)); + + ensurePlayerKill(player); System.out.println("Chicken attack triggered for " + player.getName() + "."); } - private void debugDeathTask(Player player) + private void ensurePlayerKill(Player player) { new BukkitRunnable() { @Override public void run() { - if (_host.IsLive()) + if (_host.IsLive() && _host.getChickenTeam().HasPlayer(player) && _host.IsAlive(player)) + { + UtilPlayer.message(player, C.cWhite + C.Bold + "You have been moved to spectators."); kill(player); + } else + { cancel(); + } } - }.runTaskLater(_plugin, 100L); + }.runTaskLater(_plugin, 400L); } - private void kill(Player player) + public void kill(Player player) { System.out.println("Killed: " + player.getName()); - _host.SetPlayerState(player, PlayerState.OUT); + _host.Manager.Clear(player); - DisguiseChicken disguise = new DisguiseChicken(player); - disguise.setBaby(); - _host.Manager.GetDisguise().disguise(disguise, UtilServer.getPlayers()); + new BukkitRunnable() + { + @Override + public void run() + { + _host.SetPlayerState(player, PlayerState.OUT); - player.teleport(_host.GetSpectatorLocation()); + DisguiseChicken disguise = new DisguiseChicken(player); + disguise.setBaby(); + _host.Manager.GetDisguise().disguise(disguise, UtilServer.getPlayers()); - player.setAllowFlight(true); - player.setFlying(true); + player.teleport(_host.GetSpectatorLocation()); - player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.0F, 1.0F); + player.setAllowFlight(true); + player.setFlying(true); + + player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.0F, 1.0F); + } + }.runTaskLater(_plugin, 1L); } private void spawnChickens() @@ -139,7 +160,10 @@ public class ChickenAttack { _chickens.add(chicken); - // TODO: Make chickens attack player. + UtilEnt.addLookAtPlayerAI(chicken, 2.0F); + + if (UtilMath.random.nextDouble() * 100 < 10.0) + chicken.setBaby(); } public boolean isGroupMember(Chicken chicken) @@ -156,7 +180,12 @@ public class ChickenAttack _chickens.clear(); } - + + public ArrayList getChickens() + { + return _chickens; + } + public Location getPlatformCenter() { return _center;