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 a8b71641b..6f807c768 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 @@ -197,7 +197,11 @@ public class ChallengeAnvilDance extends Challenge } if(!_paused) + + if(GetTimeLeftPercent() <= .5f) + { createAnvil(); + } } }.runTaskTimer(Host.getArcadeManager().getPlugin(), 20L, 1L); } 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 d5d9b49a2..b4bcadec6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeMineADiamond.java @@ -19,12 +19,14 @@ import org.bukkit.inventory.ItemStack; public class ChallengeMineADiamond extends Challenge { - private ArrayList ores = new ArrayList(Arrays.asList(Material.IRON_ORE, Material.GOLD_ORE, Material.REDSTONE_ORE, - Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE)); + private ArrayList _ores = new ArrayList(Arrays.asList(Material.IRON_ORE, Material.GOLD_ORE, + Material.REDSTONE_ORE, Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE)); + private ArrayList _diamonds = new ArrayList(); public ChallengeMineADiamond(MineWare 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.", + "Be the first to mine one!"); } @Override @@ -32,11 +34,11 @@ public class ChallengeMineADiamond 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, 2.1, z + 0.5)); } @@ -54,10 +56,14 @@ public class ChallengeMineADiamond extends Challenge @Override public void setupPlayers() { - for(Player player : Host.GetPlayers(true)) + for (Player player : Host.GetPlayers(true)) { player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE)); } + for(Block diamond: _diamonds) + { + diamond.setType(Material.DIAMOND); + } Host.BlockBreak = true; } @@ -65,49 +71,53 @@ public class ChallengeMineADiamond extends Challenge public void generateRoom() { int amountOfDiamonds = 0; - 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 <= 2; 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(amountOfDiamonds == 0) + if (amountOfDiamonds == 0) { - for(int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++) + if (y <= 1) { - Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, - UtilMath.r(getArenaSize() * 2) - (getArenaSize())); - if(copy.getType() == Material.DIAMOND_ORE) + for (int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++) { - i--; - continue; - } - copy.setType(Material.DIAMOND_ORE); - addBlock(copy); + Block copy = getCenter().getBlock().getRelative( + UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1, + UtilMath.r(getArenaSize() * 2) - (getArenaSize())); + if (copy.getType() == Material.DIAMOND_ORE) + { + i--; + continue; + } + _diamonds.add(copy); + addBlock(copy); - amountOfDiamonds++; + amountOfDiamonds++; + } + } + if (b.getType() != Material.DIAMOND_ORE) + { + b.setType(_ores.get(UtilMath.r(_ores.size()))); } } - if(b.getType() != Material.DIAMOND_ORE) - { - b.setType(ores.get(UtilMath.r(ores.size()))); - } - if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) + if ((Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize()) && y >= 2) { b.setType(Material.FENCE); } } - if(b.getType() != Material.AIR) + if (b.getType() != Material.AIR) { addBlock(b); } @@ -119,37 +129,37 @@ public class ChallengeMineADiamond extends Challenge @EventHandler public void onDiamondMine(PlayerInteractEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(!Host.IsAlive(event.getPlayer())) + if (!Host.IsAlive(event.getPlayer())) { return; } - if(IsCompleted(event.getPlayer())) + if (IsCompleted(event.getPlayer())) { event.setCancelled(true); return; } - if(event.getAction() == Action.LEFT_CLICK_BLOCK) + if (event.getAction() == Action.LEFT_CLICK_BLOCK) { - if(event.getClickedBlock().getType() == Material.DIAMOND_ORE) + if (event.getClickedBlock().getType() == Material.DIAMOND_ORE) { SetCompleted(event.getPlayer(), true); event.getClickedBlock().setType(Material.AIR); } } } - + @EventHandler public void onPlayerMineblock(BlockBreakEvent event) { - if(!Host.IsLive()) + if (!Host.IsLive()) { return; } - if(event.getBlock().getType() != Material.DIAMOND_ORE) + if (event.getBlock().getType() != Material.DIAMOND_ORE) { event.setCancelled(true); }