From dfd5a63b782a0b306570bcc85952bdc4811075f7 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 12 Jan 2016 23:29:08 -0500 Subject: [PATCH] More changes and fixes. --- .../game/games/speedbuilder/SpeedBuilder.java | 49 +++++++++++++++++-- .../speedbuilder/data/DemolitionData.java | 14 ++++-- .../speedbuilder/data/RecreationData.java | 14 ++++-- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java index 86c9c9097..cb6f0adec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java @@ -355,6 +355,8 @@ public class SpeedBuilder extends SoloGame } } + + Manager.getCosmeticManager().setHideParticles(true); } @@ -373,6 +375,8 @@ public class SpeedBuilder extends SoloGame _currentBuild = UtilAlg.Random(_buildData); + HashSet usedBuildLocs = new HashSet(); + for (Player player : GetPlayers(true)) { Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")); @@ -381,9 +385,24 @@ public class SpeedBuilder extends SoloGame _buildRecreations.put(player, new RecreationData(this, player, buildLoc, spawnLoc)); _buildRecreations.get(player).pasteBuildData(_currentBuild); + + usedBuildLocs.add(buildLoc); } - Announce(F.main("Build", "You will recreate this build.")); + for (Location loc : WorldData.GetDataLocs("YELLOW")) + { + if (!usedBuildLocs.contains(loc)) + { + HashSet blocks = UtilBlock.findConnectedBlocks(loc.getBlock(), loc.getBlock(), null, 2000, 8); + + Manager.GetExplosion().BlockExplosion(blocks, loc, false, true); + } + } + + for (Player player : GetTeamList().get(0).GetPlayers(true)) + { + UtilPlayer.message(player, F.main("Build", "Recreate the build shown.")); + } setSpeedBuilderState(SpeedBuilderState.VIEWING); } @@ -727,6 +746,8 @@ public class SpeedBuilder extends SoloGame for (RecreationData recreation : _buildRecreations.values()) { + recreation.Player.teleport(recreation.PlayerSpawn); + recreation.pasteBuildData(_currentBuild); } @@ -787,7 +808,7 @@ public class SpeedBuilder extends SoloGame //Eliminate in order This also means that the empty builds are eliminated first final RecreationData eliminating = _toEliminate.get(0); - judgeTargetLocation(eliminating.getMidpoint()); + judgeTargetLocation(eliminating.OriginalBuildLocation.clone().subtract(0, 1.7, 0)); UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!", 0, 30, 10); @@ -933,6 +954,9 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.get(event.getPlayer()).inBuildArea(event.getClickedBlock())) return; + if (event.getClickedBlock().getType() == Material.AIR) + return; + _buildRecreations.get(event.getPlayer()).addToDemolition(event.getClickedBlock()); } @@ -1000,7 +1024,26 @@ public class SpeedBuilder extends SoloGame UtilPlayer.sendPacket(player, packetLook, packetRot); } } - + + @EventHandler + public void specNightVision(UpdateEvent event) + { + if (!InProgress()) + return; + + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (UtilPlayer.isSpectator(player) || (GetTeamList().size() > 1 && GetTeamList().get(1).HasPlayer(player))) + { + Manager.GetCondition().Factory().NightVision("Spectator Night Vision", player, null, Integer.MAX_VALUE, 0, false, false, true); + Manager.GetCondition().Factory().Breath("Spectator Water Vision", player, null, Integer.MAX_VALUE, 0, false, false, true); + } + } + } + // @EventHandler // public void stopJudgeUnspec(UpdateEvent event) // { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java index 94508fc4a..7f2eea1c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java @@ -118,6 +118,13 @@ public class DemolitionData if (block.getType() == Material.AIR) continue; + //Ignore top double plant blocks + if (block.getType() == Material.DOUBLE_PLANT) + { + if (block.getData() > 7) + continue; + } + for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) { Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack); @@ -146,10 +153,11 @@ public class DemolitionData } else if (block.getType() == Material.DOUBLE_PLANT) { - if (block.getData() > 7) - MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); - else + //The top block does not carry the correct data + if (block.getData() <= 7) MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); } MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java index 45a563c73..ce22ee99a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java @@ -168,6 +168,13 @@ public class RecreationData if (block.getType() == Material.AIR) continue; + //Ignore top double plant blocks + if (block.getType() == Material.DOUBLE_PLANT) + { + if (block.getData() > 7) + continue; + } + for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) { Item item = block.getWorld().dropItem(getMidpoint(), itemStack); @@ -196,10 +203,11 @@ public class RecreationData } else if (block.getType() == Material.DOUBLE_PLANT) { - if (block.getData() > 7) - MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); - else + //The top block does not carry the correct data + if (block.getData() <= 7) MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); } }