From 2e9ac8df4d6aa07fdae0fe9c042442b37e16234a Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 15 Nov 2015 22:06:11 -0500 Subject: [PATCH 01/99] First commit. --- .../src/mineplex/core/game/GameDisplay.java | 2 + .../src/nautilus/game/arcade/GameType.java | 6 +- .../game/games/speedbuilder/BuildData.java | 28 ++ .../game/games/speedbuilder/DefaultKit.java | 34 ++ .../games/speedbuilder/RecreationData.java | 126 +++++++ .../game/games/speedbuilder/SpeedBuilder.java | 356 ++++++++++++++++++ .../games/speedbuilder/SpeedBuilderState.java | 10 + 7 files changed, 560 insertions(+), 2 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index f7393e9ac..878bc700a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -68,6 +68,8 @@ public enum GameDisplay Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), ChampionsCTF("Champions CTF", "Champions", Material.REDSTONE_BLOCK, (byte)0, GameCategory.CHAMPIONS, 55), + + SpeedBuilder("Speed Builder", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.ARCADE, 56), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 47fe8ccf4..dba32fc2c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -1,7 +1,5 @@ package nautilus.game.arcade; -import org.bukkit.Material; - import mineplex.core.game.GameCategory; import mineplex.core.game.GameDisplay; import nautilus.game.arcade.game.Game; @@ -50,6 +48,7 @@ import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.snake.Snake; import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins; import nautilus.game.arcade.game.games.snowfight.SnowFight; +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; import nautilus.game.arcade.game.games.spleef.Spleef; import nautilus.game.arcade.game.games.spleef.SpleefTeams; import nautilus.game.arcade.game.games.squidshooter.SquidShooter; @@ -63,6 +62,8 @@ import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival; +import org.bukkit.Material; + public enum GameType { //Mini @@ -108,6 +109,7 @@ public enum GameType Snake(Snake.class, GameDisplay.Snake), SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins), SnowFight(SnowFight.class, GameDisplay.SnowFight), + SpeedBuilder(SpeedBuilder.class, GameDisplay.SpeedBuilder), Spleef(Spleef.class, GameDisplay.Spleef), SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams), SquidShooter(SquidShooter.class, GameDisplay.SquidShooter), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java new file mode 100644 index 000000000..1084f8523 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java @@ -0,0 +1,28 @@ +package nautilus.game.arcade.game.games.speedbuilder; + +import org.bukkit.Location; +import org.bukkit.block.BlockState; + +public class BuildData +{ + + public BlockState[][][] Build = new BlockState[5][5][5]; + public BlockState[][] Ground = new BlockState[5][5]; + + public BuildData(Location loc) + { + Location groundMin = loc.clone().add(-2, 2, -2); + + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); + + Location buildMin = loc.clone().add(-2, 3, -2); + + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + for (int z = 0; z < 5; z++) + Build[x][y][z] = buildMin.clone().add(x, y, z).getBlock().getState(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java new file mode 100644 index 000000000..34b04e725 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.game.games.speedbuilder; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class DefaultKit extends Kit +{ + + public DefaultKit(ArcadeManager manager) + { + super(manager, "Default", KitAvailability.Free, + new String[] + { + "......" + }, + new Perk[] + { + + }, + EntityType.ZOMBIE, null); + } + + @Override + public void GiveItems(Player player) + { + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java new file mode 100644 index 000000000..6cb2355c4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java @@ -0,0 +1,126 @@ +package nautilus.game.arcade.game.games.speedbuilder; + +import java.util.ArrayList; + +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class RecreationData +{ + + public Player Player; + + public BlockState[][] DefaultGround = new BlockState[5][5]; + + public Location CornerA; + public Location CornerB; + + public Location PlayerSpawn; + + public ArrayList DroppedItems = new ArrayList(); + + public RecreationData(Player player, Location loc, Location playerSpawn) + { + Player = player; + + CornerA = loc.clone().subtract(2, 0, 2); + CornerB = loc.clone().add(2, 5, 2); + + PlayerSpawn = playerSpawn; + + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState(); + } + + public boolean inBuildArea(Block block) + { + if (block.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX())) + return false; + + if (block.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY())) + return false; + + if (block.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ())) + return false; + + if (block.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX())) + return false; + + if (block.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY())) + return false; + + if (block.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ())) + return false; + + return true; + } + + public void clearBuildArea(boolean resetGround) + { + for (Block block : UtilBlock.getInBoundingBox(CornerA, CornerB)) + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + + if (resetGround) + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), DefaultGround[x][z].getType(), DefaultGround[x][z].getRawData()); + } + + public void pasteBuildData(BuildData buildData) + { + clearBuildArea(true); + + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData()); + + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + for (int z = 0; z < 5; z++) + MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); + } + + public void breakAndDropItems() + { + for (Block block : UtilBlock.getInBoundingBox(CornerA, CornerB)) + { + Item item = block.getWorld().dropItem(UtilAlg.getMidpoint(CornerA, CornerB), block.getState().getData().toItemStack(1)); + + //UtilAction.velocity(item, new Vector(0, 0, 0)); + + DroppedItems.add(item); + } + + CornerA.getWorld().playEffect(UtilAlg.getMidpoint(CornerA, CornerB), Effect.STEP_SOUND, Material.LOG.getId()); + + clearBuildArea(false); + } + + public int calculateScoreFromBuild(BuildData buildData) + { + int score = 0; + + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + for (int z = 0; z < 5; z++) + if (buildData.Build[x][y][z].getType() == CornerA.clone().add(x, y, z).getBlock().getType() && buildData.Build[x][y][z].getRawData() == CornerA.clone().add(x, y, z).getBlock().getData()) + score++; + + return score; + } + +} 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 new file mode 100644 index 000000000..2275f1ce8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java @@ -0,0 +1,356 @@ +package nautilus.game.arcade.game.games.speedbuilder; + +import java.util.ArrayList; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.kit.Kit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockState; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +public class SpeedBuilder extends SoloGame +{ + + private SpeedBuilderState _state = SpeedBuilderState.Viewing; + private long _stateTime = System.currentTimeMillis(); + + private long _reviewState = 0; + + private Location _buildMiddle; + + private ArrayList _buildData = new ArrayList(); + private BuildData _currentBuild; + + private BlockState[][] _defaultMiddleGround = new BlockState[5][5]; + + private NautHashMap _buildRecreations = new NautHashMap(); + + public SpeedBuilder(ArcadeManager manager) + { + super(manager, GameType.SpeedBuilder, + new Kit[] + { + new DefaultKit(manager) + }, + new String[] + { + ".....", + "....", + "...", + "..", + ".", + }); + + Damage = false; + + HungerSet = 20; + HealthSet = 20; + } + + @Override + public void ParseData() + { + _buildMiddle = WorldData.GetDataLocs("RED").get(0); + + Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); + + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + _defaultMiddleGround[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); + + for (Location loc : WorldData.GetDataLocs("LIME")) + _buildData.add(new BuildData(loc)); + } + + public void setSpeedBuilderState(SpeedBuilderState state) + { + _state = state; + _stateTime = System.currentTimeMillis(); + } + + public SpeedBuilderState getSpeedBuilderState() + { + return _state; + } + + public long getSpeedBuilderStateTime() + { + return _stateTime; + } + + public void clearCenterArea(boolean resetGround) + { + Location buildMin = _buildMiddle.clone().subtract(2, 0, 2); + Location buildMax = _buildMiddle.clone().add(2, 5, 2); + + for (Block block : UtilBlock.getInBoundingBox(buildMin, buildMax)) + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + + if (resetGround) + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, -1, z), _defaultMiddleGround[x][z].getType(), _defaultMiddleGround[x][z].getRawData()); + } + + public void pasteBuildInCenter(BuildData buildData) + { + clearCenterArea(true); + + Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); + + for (int x = 0; x < 5; x++) + for (int z = 0; z < 5; z++) + MapUtil.QuickChangeBlockAt(groundMin.clone().add(x, 0, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData()); + + Location buildMin = _buildMiddle.clone().subtract(2, 0, 2); + + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + for (int z = 0; z < 5; z++) + MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); + } + + @EventHandler + public void onLive(GameStateChangeEvent event) + { + if (!IsLive()) + return; + + _currentBuild = UtilAlg.Random(_buildData); + + for (Player player : GetPlayers(true)) + { + Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")); + Location spawnLoc = UtilAlg.findClosest(buildLoc, GetTeamList().get(0).GetSpawns()); + + _buildRecreations.put(player, new RecreationData(player, buildLoc, spawnLoc)); + + _buildRecreations.get(player).pasteBuildData(_currentBuild); + } + + Announce(F.main("Build", "You will recreate this build.")); + + setSpeedBuilderState(SpeedBuilderState.Viewing); + } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) + { + if (_buildRecreations.containsKey(event.getPlayer())) + _buildRecreations.remove(event.getPlayer()).clearBuildArea(true); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onBlockPlace(BlockPlaceEvent event) + { + if (_state != SpeedBuilderState.Building) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (_buildRecreations.get(event.getPlayer()).inBuildArea(event.getBlock())) + return; + + event.setCancelled(true); + UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerPickupItem(PlayerPickupItemEvent event) + { + if (_state != SpeedBuilderState.Building) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (_buildRecreations.get(event.getPlayer()).DroppedItems.contains(event.getItem())) + _buildRecreations.get(event.getPlayer()).DroppedItems.remove(event.getItem()); + else + event.setCancelled(true); + } + + @EventHandler + public void stateUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_state == SpeedBuilderState.Viewing) + { + //10sec for now + if (UtilTime.elapsed(_stateTime, 10000)) + { + for (RecreationData recreation : _buildRecreations.values()) + { + recreation.breakAndDropItems(); + + recreation.Player.teleport(recreation.PlayerSpawn); + } + + ItemPickup = true; + BlockPlace = true; + + Announce(F.main("Build", "Recreate the build shown.")); + + setSpeedBuilderState(SpeedBuilderState.Building); + } + } + else if (_state == SpeedBuilderState.Building) + { + //20sec for now + if (UtilTime.elapsed(_stateTime, 20000)) + { + for (RecreationData recreation : _buildRecreations.values()) + { + for (Item item : recreation.DroppedItems) + item.remove(); + + recreation.DroppedItems.clear(); + + UtilInv.Clear(recreation.Player); + + recreation.Player.teleport(recreation.PlayerSpawn); + } + + Announce(F.main("Build", "Time's up!")); + + ItemPickup = false; + BlockPlace = false; + + pasteBuildInCenter(_currentBuild); + + _reviewState = 0; + + setSpeedBuilderState(SpeedBuilderState.Reviewing); + } + } + else if (_state == SpeedBuilderState.Reviewing) + { + if (_reviewState == 0 && UtilTime.elapsed(_stateTime, 3500)) + { + Player lowestPlayer = null; + int lowestScore = -1; + + for (RecreationData recreation : _buildRecreations.values()) + { + int score = recreation.calculateScoreFromBuild(_currentBuild); + if (lowestPlayer == null || lowestScore > score) + { + lowestPlayer = recreation.Player; + lowestScore = score; + } + } + + if (lowestPlayer != null) + { + Manager.addSpectator(lowestPlayer, true); + GetTeamList().get(0).SetPlayerState(lowestPlayer, PlayerState.OUT); + GetTeamList().get(0).SetPlacement(lowestPlayer, PlayerState.OUT); + + _buildRecreations.remove(lowestPlayer).clearBuildArea(true); + + Announce(F.main("Build", lowestPlayer.getName() + " has been eliminated!")); + + EndCheck(); + } + _reviewState++; + } + + if (_reviewState == 1 && IsLive() && UtilTime.elapsed(_stateTime, 7000)) + { + clearCenterArea(true); + + _currentBuild = UtilAlg.Random(_buildData); + + for (RecreationData recreation : _buildRecreations.values()) + { + recreation.pasteBuildData(_currentBuild); + + recreation.Player.teleport(recreation.PlayerSpawn); + } + + Announce(F.main("Build", "You will recreate this build.")); + + _reviewState = 0; + + setSpeedBuilderState(SpeedBuilderState.Viewing); + } + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cGreenB + "Players Left:"); + Scoreboard.Write("" + GetPlayers(true).size()); + + if (IsLive()) + { + Scoreboard.WriteBlank(); + + if (_state == SpeedBuilderState.Viewing) + { + Scoreboard.Write(C.cRedB + "Breaking In:"); + Scoreboard.Write(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - _stateTime))); + } + else if (_state == SpeedBuilderState.Building) + { + Scoreboard.Write(C.cRedB + "Time Left:"); + Scoreboard.Write(UtilTime.MakeStr(20000 - (System.currentTimeMillis() - _stateTime))); + } + else if (_state == SpeedBuilderState.Reviewing) + { + if (_reviewState == 0) + { + Scoreboard.Write(C.cRedB + "Results In:"); + Scoreboard.Write(UtilTime.MakeStr(3500 - (System.currentTimeMillis() - _stateTime))); + } + else if (_reviewState == 1) + { + Scoreboard.Write(C.cRedB + "Next Build:"); + Scoreboard.Write(UtilTime.MakeStr(7000 - (System.currentTimeMillis() - _stateTime))); + } + } + } + + Scoreboard.Draw(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java new file mode 100644 index 000000000..b379a034a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java @@ -0,0 +1,10 @@ +package nautilus.game.arcade.game.games.speedbuilder; + +public enum SpeedBuilderState +{ + + Viewing, + Building, + Reviewing; + +} From 8145b127ba4929504e73c65a6c1ea603074b1474 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 17 Nov 2015 20:04:23 -0500 Subject: [PATCH 02/99] Changed the score algorithm so if all players have the same score, nobody is eliminated. --- .../arcade/game/games/speedbuilder/SpeedBuilder.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 2275f1ce8..4f75d5fa3 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 @@ -259,6 +259,7 @@ public class SpeedBuilder extends SoloGame { Player lowestPlayer = null; int lowestScore = -1; + boolean allEqual = !_buildRecreations.isEmpty(); for (RecreationData recreation : _buildRecreations.values()) { @@ -268,9 +269,14 @@ public class SpeedBuilder extends SoloGame lowestPlayer = recreation.Player; lowestScore = score; } + + if (score != lowestScore) + { + allEqual = false; + } } - if (lowestPlayer != null) + if (lowestPlayer != null && !allEqual) { Manager.addSpectator(lowestPlayer, true); GetTeamList().get(0).SetPlayerState(lowestPlayer, PlayerState.OUT); @@ -282,6 +288,10 @@ public class SpeedBuilder extends SoloGame EndCheck(); } + + if (allEqual) + Announce(F.main("Build", "Everyone completed the build so nobody was eliminated!")); + _reviewState++; } From 76db2710ae741dc473c58e0597fc10cb51a3faa5 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 18 Nov 2015 16:10:44 -0500 Subject: [PATCH 03/99] It should have been all got the build 100% correct not all got the same score. --- .../arcade/game/games/speedbuilder/SpeedBuilder.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 4f75d5fa3..9dc1b3863 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 @@ -259,7 +259,7 @@ public class SpeedBuilder extends SoloGame { Player lowestPlayer = null; int lowestScore = -1; - boolean allEqual = !_buildRecreations.isEmpty(); + boolean allCorrect = !_buildRecreations.isEmpty(); for (RecreationData recreation : _buildRecreations.values()) { @@ -270,13 +270,13 @@ public class SpeedBuilder extends SoloGame lowestScore = score; } - if (score != lowestScore) + if (score != 125) { - allEqual = false; + allCorrect = false; } } - if (lowestPlayer != null && !allEqual) + if (lowestPlayer != null && !allCorrect) { Manager.addSpectator(lowestPlayer, true); GetTeamList().get(0).SetPlayerState(lowestPlayer, PlayerState.OUT); @@ -289,7 +289,7 @@ public class SpeedBuilder extends SoloGame EndCheck(); } - if (allEqual) + if (allCorrect) Announce(F.main("Build", "Everyone completed the build so nobody was eliminated!")); _reviewState++; From 937d024ea5034fd211678c664d7bf57126a508fb Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 18 Nov 2015 19:26:19 -0500 Subject: [PATCH 04/99] Empty builds are auto eliminated. Damage player 9001 so the elimination is handled by the managers and not us. If there are not enough build areas for the players, the game ends. Shows a message that you completed the build if you complete it correctly. It also plays a sound. It would have a title but the title wasn't showing up for some reason... --- .../games/speedbuilder/RecreationData.java | 11 +++ .../game/games/speedbuilder/SpeedBuilder.java | 67 +++++++++++++++---- 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java index 6cb2355c4..b663fcf5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java @@ -110,6 +110,17 @@ public class RecreationData clearBuildArea(false); } + public boolean isEmptyBuild() + { + for (int x = 0; x < 5; x++) + for (int y = 0; y < 5; y++) + for (int z = 0; z < 5; z++) + if (CornerA.clone().add(x, y, z).getBlock().getType() != Material.AIR) + return false; + + return true; + } + public int calculateScoreFromBuild(BuildData buildData) { int score = 0; 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 9dc1b3863..a1e47d001 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 @@ -10,18 +10,20 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.champions.ChampionsCTF; import nautilus.game.arcade.kit.Kit; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.entity.Item; @@ -29,6 +31,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -69,6 +72,10 @@ public class SpeedBuilder extends SoloGame HungerSet = 20; HealthSet = 20; + + DontAllowOverfill = true; + + DeathMessages = false; } @Override @@ -140,6 +147,13 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; + if (WorldData.GetDataLocs("YELLOW").size() < GetPlayers(true).size()) + { + Announce(C.Bold + "Too many players..."); + SetState(GameState.End); + return; + } + _currentBuild = UtilAlg.Random(_buildData); for (Player player : GetPlayers(true)) @@ -164,7 +178,7 @@ public class SpeedBuilder extends SoloGame _buildRecreations.remove(event.getPlayer()).clearBuildArea(true); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGH) public void onBlockPlace(BlockPlaceEvent event) { if (_state != SpeedBuilderState.Building) @@ -180,6 +194,29 @@ public class SpeedBuilder extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } + @EventHandler(priority = EventPriority.HIGHEST) + public void onBuildFinish(final BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == 125) + { + event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); + UtilPlayer.message(event.getPlayer(), F.main("Build", "You completed the build 100%!")); + } + } + }, 1L); + } + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerPickupItem(PlayerPickupItemEvent event) { @@ -260,6 +297,7 @@ public class SpeedBuilder extends SoloGame Player lowestPlayer = null; int lowestScore = -1; boolean allCorrect = !_buildRecreations.isEmpty(); + ArrayList toEliminate = new ArrayList(); for (RecreationData recreation : _buildRecreations.values()) { @@ -271,20 +309,25 @@ public class SpeedBuilder extends SoloGame } if (score != 125) - { allCorrect = false; - } + + if (recreation.isEmptyBuild()) + toEliminate.add(recreation.Player); } - if (lowestPlayer != null && !allCorrect) + if (lowestPlayer != null && !toEliminate.contains(lowestPlayer)) + toEliminate.add(lowestPlayer); + + if (!toEliminate.isEmpty() && !allCorrect) { - Manager.addSpectator(lowestPlayer, true); - GetTeamList().get(0).SetPlayerState(lowestPlayer, PlayerState.OUT); - GetTeamList().get(0).SetPlacement(lowestPlayer, PlayerState.OUT); - - _buildRecreations.remove(lowestPlayer).clearBuildArea(true); - - Announce(F.main("Build", lowestPlayer.getName() + " has been eliminated!")); + for (Player player : toEliminate) + { + player.damage(9001); + + Announce(F.main("Build", player.getName() + " has been eliminated!")); + + _buildRecreations.remove(player).clearBuildArea(true); + } EndCheck(); } From 975b1df477e6735c9665706b9baf243f78498803 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 18 Nov 2015 22:03:04 -0500 Subject: [PATCH 05/99] Added the title message when a perfect match. Turns out having a '%' in the text caused it not to appear. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 a1e47d001..09b1db977 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 @@ -211,7 +211,8 @@ public class SpeedBuilder extends SoloGame if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == 125) { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - UtilPlayer.message(event.getPlayer(), F.main("Build", "You completed the build 100%!")); + UtilPlayer.message(event.getPlayer(), F.main("Build", "Perfect match!")); + UtilTextMiddle.display("", C.cGreen + "Perfect Match", event.getPlayer()); } } }, 1L); From 6a6807d6f069cc13be0bfd493785eff86daa1daa Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 25 Nov 2015 22:45:23 -0500 Subject: [PATCH 06/99] - Added time left progress bar - Added subtitle to countdown 5, 4, 3, 2, 1, TIME'S UP when a build is about to end - Added an elder guardian who floats and shoots lasers at the losers builds and blows the blocks up with an explosion - Added a subtitle to show who was eliminated - Prevented players from entering other build areas --- .../game/games/speedbuilder/DefaultKit.java | 2 +- .../games/speedbuilder/RecreationData.java | 34 ++ .../game/games/speedbuilder/SpeedBuilder.java | 331 +++++++++++++----- 3 files changed, 275 insertions(+), 92 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java index 34b04e725..55833f919 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java @@ -16,7 +16,7 @@ public class DefaultKit extends Kit super(manager, "Default", KitAvailability.Free, new String[] { - "......" + "Nothing special to it.", }, new Perk[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java index b663fcf5d..392ea76a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; +import java.util.List; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAction; @@ -69,6 +70,29 @@ public class RecreationData return true; } + public boolean inBuildArea(Location loc) + { + if (loc.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX())) + return false; + + if (loc.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY())) + return false; + + if (loc.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ())) + return false; + + if (loc.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()) + 1) + return false; + + if (loc.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()) + 1) + return false; + + if (loc.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()) + 1) + return false; + + return true; + } + public void clearBuildArea(boolean resetGround) { for (Block block : UtilBlock.getInBoundingBox(CornerA, CornerB)) @@ -134,4 +158,14 @@ public class RecreationData return score; } + public Location getMidpoint() + { + return UtilAlg.getMidpoint(CornerA, CornerB); + } + + public List getBlocks() + { + return UtilBlock.getInBoundingBox(CornerA, CornerB); + } + } 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 09b1db977..f3ac5b81e 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 @@ -8,8 +8,11 @@ import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; 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.UtilTime; import mineplex.core.updater.UpdateType; @@ -18,20 +21,23 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.champions.ChampionsCTF; import nautilus.game.arcade.kit.Kit; +import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGuardian; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Guardian; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -41,7 +47,7 @@ public class SpeedBuilder extends SoloGame private SpeedBuilderState _state = SpeedBuilderState.Viewing; private long _stateTime = System.currentTimeMillis(); - private long _reviewState = 0; + private int _countStage; private Location _buildMiddle; @@ -52,6 +58,14 @@ public class SpeedBuilder extends SoloGame private NautHashMap _buildRecreations = new NautHashMap(); + private Guardian _judgeGuardian; + private ArmorStand _judgeSupport; + private Location _judgeSpawn; + private ArmorStand _judgeLaserTarget; + + private ArrayList _toEliminate = new ArrayList(); + private long _lastElimination; + public SpeedBuilder(ArcadeManager manager) { super(manager, GameType.SpeedBuilder, @@ -61,11 +75,8 @@ public class SpeedBuilder extends SoloGame }, new String[] { - ".....", - "....", - "...", - "..", - ".", + "This is here because", + "I got tired of seeing '......'" }); Damage = false; @@ -83,6 +94,8 @@ public class SpeedBuilder extends SoloGame { _buildMiddle = WorldData.GetDataLocs("RED").get(0); + _judgeSpawn = _buildMiddle.clone().add(0, 5, 0); + Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); for (int x = 0; x < 5; x++) @@ -141,6 +154,70 @@ public class SpeedBuilder extends SoloGame MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); } + public void spawnJudge() + { + CreatureAllowOverride = true; + + _judgeGuardian = _judgeSpawn.getWorld().spawn(_judgeSpawn, Guardian.class); + _judgeSupport = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); + + CreatureAllowOverride = false; + + UtilEnt.Vegetate(_judgeGuardian, true); + + _judgeGuardian.setElder(true); + + _judgeSupport.setVisible(false); + _judgeSupport.setGravity(false); + _judgeSupport.setSmall(true); + + _judgeSupport.setPassenger(_judgeGuardian); + } + + public void despawnJudge() + { + _judgeGuardian.remove(); + _judgeSupport.remove(); + + _judgeGuardian = null; + _judgeSupport = null; + } + + public void judgeTargetLocation(Location loc) + { + if (loc == null) + { + if (_judgeLaserTarget == null) + return; + + ((CraftGuardian) _judgeGuardian).getHandle().getDataWatcher().watch(17, 0); + + _judgeLaserTarget.remove(); + + _judgeLaserTarget = null; + } + else + { + if (_judgeLaserTarget != null) + judgeTargetLocation(null); + + CreatureAllowOverride = true; + + _judgeLaserTarget = _judgeGuardian.getWorld().spawn(loc, ArmorStand.class); + + CreatureAllowOverride = false; + + _judgeLaserTarget.setVisible(false); + _judgeLaserTarget.setGravity(false); + _judgeLaserTarget.setSmall(true); + + //Doesn't work correctly while entity is riding another entity #BlameMojang + UtilEnt.CreatureLook(_judgeGuardian, _judgeLaserTarget.getLocation()); + + ((CraftGuardian) _judgeGuardian).getHandle().getDataWatcher().watch(17, _judgeLaserTarget.getEntityId()); + } + } + @EventHandler public void onLive(GameStateChangeEvent event) { @@ -174,8 +251,18 @@ public class SpeedBuilder extends SoloGame @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { + RecreationData recreation = null; + if (_buildRecreations.containsKey(event.getPlayer())) - _buildRecreations.remove(event.getPlayer()).clearBuildArea(true); + recreation = _buildRecreations.remove(event.getPlayer()); + + if (recreation != null) + { + recreation.clearBuildArea(true); + + if (_toEliminate.contains(recreation)) + _toEliminate.remove(recreation); + } } @EventHandler(priority = EventPriority.HIGH) @@ -211,7 +298,7 @@ public class SpeedBuilder extends SoloGame if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == 125) { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - UtilPlayer.message(event.getPlayer(), F.main("Build", "Perfect match!")); + UtilTextMiddle.display("", C.cGreen + "Perfect Match", event.getPlayer()); } } @@ -233,9 +320,32 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } + @EventHandler + public void stopMoveIntoBuildAreas(PlayerMoveEvent event) + { + if (!IsAlive(event.getPlayer())) + return; + + if (!IsLive()) + return; + + for (RecreationData recreation : _buildRecreations.values()) + { + if (recreation.Player.equals(event.getPlayer())) + continue; + + if (recreation.inBuildArea(event.getTo())) + { + UtilPlayer.message(event.getPlayer(), F.main("Build", "You cannot enter other build areas!")); + + event.getPlayer().teleport(_buildRecreations.get(event.getPlayer()).PlayerSpawn); + } + } + } + @EventHandler public void stateUpdate(UpdateEvent event) - { + { if (event.getType() != UpdateType.TICK) return; @@ -257,6 +367,8 @@ public class SpeedBuilder extends SoloGame ItemPickup = true; BlockPlace = true; + _countStage = 0; + Announce(F.main("Build", "Recreate the build shown.")); setSpeedBuilderState(SpeedBuilderState.Building); @@ -279,70 +391,55 @@ public class SpeedBuilder extends SoloGame recreation.Player.teleport(recreation.PlayerSpawn); } - Announce(F.main("Build", "Time's up!")); + //Sometimes it stops on 0.1 and has one bar green + UtilTextBottom.displayProgress("Time Left:", 0, UtilTime.MakeStr(0), UtilServer.getPlayers()); + + //Sometimes doesn't show in the update method + UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); ItemPickup = false; BlockPlace = false; + RecreationData lowest = null; + int lowestScore = -1; + boolean allPerfectMatch = !_buildRecreations.isEmpty(); + + for (RecreationData recreation : _buildRecreations.values()) + { + int score = recreation.calculateScoreFromBuild(_currentBuild); + + if (lowest == null || lowestScore > score) + { + lowest = recreation; + lowestScore = score; + } + + if (score != 125) + allPerfectMatch = false; + + if (recreation.isEmptyBuild()) + _toEliminate.add(recreation); + } + + if (!allPerfectMatch && lowest != null && !_toEliminate.contains(lowest)) + _toEliminate.add(lowest); + pasteBuildInCenter(_currentBuild); - _reviewState = 0; + //SIGILS AND HIS GUARDIANS + spawnJudge(); setSpeedBuilderState(SpeedBuilderState.Reviewing); } } else if (_state == SpeedBuilderState.Reviewing) - { - if (_reviewState == 0 && UtilTime.elapsed(_stateTime, 3500)) - { - Player lowestPlayer = null; - int lowestScore = -1; - boolean allCorrect = !_buildRecreations.isEmpty(); - ArrayList toEliminate = new ArrayList(); - - for (RecreationData recreation : _buildRecreations.values()) - { - int score = recreation.calculateScoreFromBuild(_currentBuild); - if (lowestPlayer == null || lowestScore > score) - { - lowestPlayer = recreation.Player; - lowestScore = score; - } - - if (score != 125) - allCorrect = false; - - if (recreation.isEmptyBuild()) - toEliminate.add(recreation.Player); - } - - if (lowestPlayer != null && !toEliminate.contains(lowestPlayer)) - toEliminate.add(lowestPlayer); - - if (!toEliminate.isEmpty() && !allCorrect) - { - for (Player player : toEliminate) - { - player.damage(9001); - - Announce(F.main("Build", player.getName() + " has been eliminated!")); - - _buildRecreations.remove(player).clearBuildArea(true); - } - - EndCheck(); - } - - if (allCorrect) - Announce(F.main("Build", "Everyone completed the build so nobody was eliminated!")); - - _reviewState++; - } - - if (_reviewState == 1 && IsLive() && UtilTime.elapsed(_stateTime, 7000)) + { + if (_toEliminate.isEmpty()) { clearCenterArea(true); + despawnJudge(); + _currentBuild = UtilAlg.Random(_buildData); for (RecreationData recreation : _buildRecreations.values()) @@ -354,10 +451,89 @@ public class SpeedBuilder extends SoloGame Announce(F.main("Build", "You will recreate this build.")); - _reviewState = 0; - setSpeedBuilderState(SpeedBuilderState.Viewing); } + else + { + if (UtilTime.elapsed(_lastElimination, 3000)) + { + _lastElimination = System.currentTimeMillis(); + + final RecreationData eliminating = UtilAlg.Random(_toEliminate); + + judgeTargetLocation(eliminating.getMidpoint()); + + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + if (!_toEliminate.contains(eliminating)) + return; + + WorldData.World.playEffect(eliminating.getMidpoint(), Effect.EXPLOSION_HUGE, 0); + WorldData.World.playSound(eliminating.getMidpoint(), Sound.EXPLODE, 10F, 1F); + + Manager.GetExplosion().BlockExplosion(eliminating.getBlocks(), eliminating.getMidpoint(), false, false); + + eliminating.clearBuildArea(true); + + judgeTargetLocation(null); + + _toEliminate.remove(eliminating); + + _buildRecreations.remove(eliminating.Player); + + UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!"); + + eliminating.Player.damage(9001); + } + }, 40L); + } + } + } + } + + @EventHandler + public void buildTimeProgressBar(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.Building) + return; + + long timeLeft = 20000 - (System.currentTimeMillis() - _stateTime); + + if (timeLeft < 0) + timeLeft = 0; + + UtilTextBottom.displayProgress("Time Left:", timeLeft / 20000D, UtilTime.MakeStr(timeLeft), UtilServer.getPlayers()); + } + + @EventHandler + public void buildEndCountdown(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.Building) + return; + + if (UtilTime.elapsed(_stateTime, 1000 * _countStage)) + { + if (_countStage == 20) + UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); + else if (_countStage >= 15) + UtilTextMiddle.display("", C.cGreen + (20 - _countStage)); + + _countStage++; } } @@ -375,34 +551,7 @@ public class SpeedBuilder extends SoloGame Scoreboard.Write(C.cGreenB + "Players Left:"); Scoreboard.Write("" + GetPlayers(true).size()); - if (IsLive()) - { - Scoreboard.WriteBlank(); - - if (_state == SpeedBuilderState.Viewing) - { - Scoreboard.Write(C.cRedB + "Breaking In:"); - Scoreboard.Write(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - _stateTime))); - } - else if (_state == SpeedBuilderState.Building) - { - Scoreboard.Write(C.cRedB + "Time Left:"); - Scoreboard.Write(UtilTime.MakeStr(20000 - (System.currentTimeMillis() - _stateTime))); - } - else if (_state == SpeedBuilderState.Reviewing) - { - if (_reviewState == 0) - { - Scoreboard.Write(C.cRedB + "Results In:"); - Scoreboard.Write(UtilTime.MakeStr(3500 - (System.currentTimeMillis() - _stateTime))); - } - else if (_reviewState == 1) - { - Scoreboard.Write(C.cRedB + "Next Build:"); - Scoreboard.Write(UtilTime.MakeStr(7000 - (System.currentTimeMillis() - _stateTime))); - } - } - } + Scoreboard.WriteBlank(); Scoreboard.Draw(); } From 3d74c9ca059f9089c61cf52c7ba16f4fbbff078a Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 26 Nov 2015 23:10:19 -0500 Subject: [PATCH 07/99] Fixed some bugs and finished some items on the checklist, too many to put down here. --- .../games/speedbuilder/RecreationData.java | 8 +- .../game/games/speedbuilder/SpeedBuilder.java | 84 +++++++++++++++---- 2 files changed, 70 insertions(+), 22 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java index 392ea76a9..6b9493dd2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -13,11 +12,8 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockState; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftItem; import org.bukkit.entity.Item; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; public class RecreationData { @@ -38,7 +34,7 @@ public class RecreationData Player = player; CornerA = loc.clone().subtract(2, 0, 2); - CornerB = loc.clone().add(2, 5, 2); + CornerB = loc.clone().add(2, 4, 2); PlayerSpawn = playerSpawn; @@ -160,7 +156,7 @@ public class RecreationData public Location getMidpoint() { - return UtilAlg.getMidpoint(CornerA, CornerB); + return UtilAlg.getMidpoint(CornerA, CornerB.clone().add(1, 1, 1)); } public List getBlocks() 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 f3ac5b81e..dcc98fbe5 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 @@ -1,6 +1,8 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map.Entry; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -36,10 +38,12 @@ import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.world.StructureGrowEvent; public class SpeedBuilder extends SoloGame { @@ -49,6 +53,8 @@ public class SpeedBuilder extends SoloGame private int _countStage; + private int _buildTime = 35; + private Location _buildMiddle; private ArrayList _buildData = new ArrayList(); @@ -66,6 +72,8 @@ public class SpeedBuilder extends SoloGame private ArrayList _toEliminate = new ArrayList(); private long _lastElimination; + private NautHashMap _perfectBuild = new NautHashMap(); + public SpeedBuilder(ArcadeManager manager) { super(manager, GameType.SpeedBuilder, @@ -92,7 +100,7 @@ public class SpeedBuilder extends SoloGame @Override public void ParseData() { - _buildMiddle = WorldData.GetDataLocs("RED").get(0); + _buildMiddle = WorldData.GetDataLocs("RED").get(0).clone().subtract(0.5, 0, 0.5); _judgeSpawn = _buildMiddle.clone().add(0, 5, 0); @@ -103,7 +111,7 @@ public class SpeedBuilder extends SoloGame _defaultMiddleGround[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); for (Location loc : WorldData.GetDataLocs("LIME")) - _buildData.add(new BuildData(loc)); + _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5))); } public void setSpeedBuilderState(SpeedBuilderState state) @@ -125,7 +133,7 @@ public class SpeedBuilder extends SoloGame public void clearCenterArea(boolean resetGround) { Location buildMin = _buildMiddle.clone().subtract(2, 0, 2); - Location buildMax = _buildMiddle.clone().add(2, 5, 2); + Location buildMax = _buildMiddle.clone().add(2, 4, 2); for (Block block : UtilBlock.getInBoundingBox(buildMin, buildMax)) MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); @@ -235,7 +243,7 @@ public class SpeedBuilder extends SoloGame for (Player player : GetPlayers(true)) { - Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")); + Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")).clone().subtract(0.5, 0, 0.5); Location spawnLoc = UtilAlg.findClosest(buildLoc, GetTeamList().get(0).GetSpawns()); _buildRecreations.put(player, new RecreationData(player, buildLoc, spawnLoc)); @@ -292,6 +300,12 @@ public class SpeedBuilder extends SoloGame @Override public void run() { + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.Building) + return; + if (!_buildRecreations.containsKey(event.getPlayer())) return; @@ -300,6 +314,8 @@ public class SpeedBuilder extends SoloGame event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); UtilTextMiddle.display("", C.cGreen + "Perfect Match", event.getPlayer()); + + _perfectBuild.put(event.getPlayer(), System.currentTimeMillis()); } } }, 1L); @@ -358,11 +374,7 @@ public class SpeedBuilder extends SoloGame if (UtilTime.elapsed(_stateTime, 10000)) { for (RecreationData recreation : _buildRecreations.values()) - { recreation.breakAndDropItems(); - - recreation.Player.teleport(recreation.PlayerSpawn); - } ItemPickup = true; BlockPlace = true; @@ -376,8 +388,7 @@ public class SpeedBuilder extends SoloGame } else if (_state == SpeedBuilderState.Building) { - //20sec for now - if (UtilTime.elapsed(_stateTime, 20000)) + if (UtilTime.elapsed(_stateTime, _buildTime * 1000)) { for (RecreationData recreation : _buildRecreations.values()) { @@ -397,6 +408,8 @@ public class SpeedBuilder extends SoloGame //Sometimes doesn't show in the update method UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); + _perfectBuild.clear(); + ItemPickup = false; BlockPlace = false; @@ -449,6 +462,11 @@ public class SpeedBuilder extends SoloGame recreation.Player.teleport(recreation.PlayerSpawn); } + if (_buildTime > 1) + _buildTime--; + + UtilTextMiddle.display("", C.cRed + "Next Build Commencing..."); + Announce(F.main("Build", "You will recreate this build.")); setSpeedBuilderState(SpeedBuilderState.Viewing); @@ -459,7 +477,8 @@ public class SpeedBuilder extends SoloGame { _lastElimination = System.currentTimeMillis(); - final RecreationData eliminating = UtilAlg.Random(_toEliminate); + //Eliminate in order This also means that the empty builds are eliminated first + final RecreationData eliminating = _toEliminate.get(0); judgeTargetLocation(eliminating.getMidpoint()); @@ -506,12 +525,12 @@ public class SpeedBuilder extends SoloGame if (_state != SpeedBuilderState.Building) return; - long timeLeft = 20000 - (System.currentTimeMillis() - _stateTime); + long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime); if (timeLeft < 0) timeLeft = 0; - UtilTextBottom.displayProgress("Time Left:", timeLeft / 20000D, UtilTime.MakeStr(timeLeft), UtilServer.getPlayers()); + UtilTextBottom.displayProgress("Time Left:", timeLeft / (_buildTime * 1000.0D), UtilTime.MakeStr(timeLeft), UtilServer.getPlayers()); } @EventHandler @@ -528,15 +547,48 @@ public class SpeedBuilder extends SoloGame if (UtilTime.elapsed(_stateTime, 1000 * _countStage)) { - if (_countStage == 20) + ArrayList players = new ArrayList(UtilServer.getServer().getOnlinePlayers()); + players.removeAll(_perfectBuild.keySet()); + + if (_countStage == _buildTime) UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); - else if (_countStage >= 15) - UtilTextMiddle.display("", C.cGreen + (20 - _countStage)); + else if (_countStage >= _buildTime - 5) + UtilTextMiddle.display("", C.cGreen + (_buildTime - _countStage), players.toArray(new Player[0])); _countStage++; } } + @EventHandler + public void cleanPerfectBuilders(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator> iterator = _perfectBuild.entrySet().iterator(); + + while (iterator.hasNext()) + { + Entry entry = iterator.next(); + + //Title gets 5 secs so the 5, 4, 3, 2, 1 doesn't override it + if (UtilTime.elapsed(entry.getValue(), 5000)) + iterator.remove(); + } + } + + @EventHandler + public void preventBlockGrowth(BlockGrowEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void preventStructureGrowth(StructureGrowEvent event) + { + event.setCancelled(true); + } + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) From 278082caed287b9f6500964cf8584b6421e1359f Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 28 Nov 2015 15:18:06 -0500 Subject: [PATCH 08/99] Finished the checklist. I might recode eliminations since I kind of don't like it right now. --- Plugins/Mineplex.Game.Clans.Core/.project | 17 ++++ .../games/speedbuilder/DemolitionData.java | 85 +++++++++++++++++++ .../games/speedbuilder/RecreationData.java | 17 +++- .../game/games/speedbuilder/SpeedBuilder.java | 55 ++++++++++-- 4 files changed, 166 insertions(+), 8 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans.Core/.project create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java diff --git a/Plugins/Mineplex.Game.Clans.Core/.project b/Plugins/Mineplex.Game.Clans.Core/.project new file mode 100644 index 000000000..fb0cce853 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans.Core/.project @@ -0,0 +1,17 @@ + + + Mineplex.Game.Clans.Core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java new file mode 100644 index 000000000..91c10b25c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.game.games.speedbuilder; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.MapUtil; +import mineplex.core.hologram.Hologram; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; + +public class DemolitionData +{ + + public RecreationData Parent; + + public Block Block; + public Long Start; + + private Hologram _hologram; + + public DemolitionData(RecreationData parent, Block block) + { + Parent = parent; + + Block = block; + Start = System.currentTimeMillis(); + + spawnHologram(); + } + + public void spawnHologram() + { + _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Block.getLocation().add(0.5, 0.5, 0.5), C.cGreen + "3"); + + _hologram.start(); + } + + public void despawnHologram() + { + _hologram.stop(); + + _hologram = null; + } + + public void update() + { + int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D); + + if (secondsLeft < 0) + secondsLeft = 0; + + if (secondsLeft == 3) + _hologram.setText(C.cGreen + "3"); + else if (secondsLeft == 2) + _hologram.setText(C.cGold + "2"); + else if (secondsLeft == 1) + _hologram.setText(C.cRed + "1"); + else if (secondsLeft == 0) + breakBlock(); + } + + public void cancelBreak() + { + despawnHologram(); + + Parent.BlocksForDemolition.remove(this); + } + + public void breakBlock() + { + despawnHologram(); + + Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), Block.getState().getData().toItemStack(1)); + + Parent.DroppedItems.add(item); + + Block.getWorld().playEffect(Block.getLocation(), Effect.STEP_SOUND, Block.getTypeId()); + + MapUtil.QuickChangeBlockAt(Block.getLocation(), Material.AIR); + + Parent.BlocksForDemolition.remove(this); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java index 6b9493dd2..21bdeaf67 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java @@ -18,6 +18,8 @@ import org.bukkit.entity.Player; public class RecreationData { + public SpeedBuilder Game; + public Player Player; public BlockState[][] DefaultGround = new BlockState[5][5]; @@ -29,8 +31,12 @@ public class RecreationData public ArrayList DroppedItems = new ArrayList(); - public RecreationData(Player player, Location loc, Location playerSpawn) + public ArrayList BlocksForDemolition = new ArrayList(); + + public RecreationData(SpeedBuilder game, Player player, Location loc, Location playerSpawn) { + Game = game; + Player = player; CornerA = loc.clone().subtract(2, 0, 2); @@ -164,4 +170,13 @@ public class RecreationData return UtilBlock.getInBoundingBox(CornerA, CornerB); } + public void addToDemolition(Block block) + { + for (DemolitionData demolition : BlocksForDemolition) + if (demolition.Block.equals(block)) + return; + + BlocksForDemolition.add(new DemolitionData(this, block)); + } + } 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 dcc98fbe5..a4a2cf75b 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 @@ -11,6 +11,8 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -40,6 +42,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -219,7 +222,6 @@ public class SpeedBuilder extends SoloGame _judgeLaserTarget.setGravity(false); _judgeLaserTarget.setSmall(true); - //Doesn't work correctly while entity is riding another entity #BlameMojang UtilEnt.CreatureLook(_judgeGuardian, _judgeLaserTarget.getLocation()); ((CraftGuardian) _judgeGuardian).getHandle().getDataWatcher().watch(17, _judgeLaserTarget.getEntityId()); @@ -246,7 +248,7 @@ public class SpeedBuilder extends SoloGame Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")).clone().subtract(0.5, 0, 0.5); Location spawnLoc = UtilAlg.findClosest(buildLoc, GetTeamList().get(0).GetSpawns()); - _buildRecreations.put(player, new RecreationData(player, buildLoc, spawnLoc)); + _buildRecreations.put(player, new RecreationData(this, player, buildLoc, spawnLoc)); _buildRecreations.get(player).pasteBuildData(_currentBuild); } @@ -370,7 +372,6 @@ public class SpeedBuilder extends SoloGame if (_state == SpeedBuilderState.Viewing) { - //10sec for now if (UtilTime.elapsed(_stateTime, 10000)) { for (RecreationData recreation : _buildRecreations.values()) @@ -447,7 +448,11 @@ public class SpeedBuilder extends SoloGame } else if (_state == SpeedBuilderState.Reviewing) { - if (_toEliminate.isEmpty()) + //If there is nobody to eliminate let it continue so it goes into the next build + if (!UtilTime.elapsed(_stateTime, 5000) && !_toEliminate.isEmpty()) + return; + + if (_toEliminate.isEmpty() && UtilTime.elapsed(_lastElimination, 3000)) { clearCenterArea(true); @@ -473,7 +478,7 @@ public class SpeedBuilder extends SoloGame } else { - if (UtilTime.elapsed(_lastElimination, 3000)) + if (UtilTime.elapsed(_lastElimination, 4000)) { _lastElimination = System.currentTimeMillis(); @@ -482,6 +487,8 @@ public class SpeedBuilder extends SoloGame judgeTargetLocation(eliminating.getMidpoint()); + UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!"); + Manager.runSyncLater(new Runnable() { @Override @@ -503,8 +510,6 @@ public class SpeedBuilder extends SoloGame _buildRecreations.remove(eliminating.Player); - UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!"); - eliminating.Player.damage(9001); } }, 40L); @@ -577,6 +582,42 @@ public class SpeedBuilder extends SoloGame } } + @EventHandler + public void markBlockForDemolition(PlayerInteractEvent event) + { + if (_state != SpeedBuilderState.Building) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (!UtilEvent.isAction(event, ActionType.L_BLOCK)) + return; + + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(event.getClickedBlock())) + return; + + _buildRecreations.get(event.getPlayer()).addToDemolition(event.getClickedBlock()); + } + + @EventHandler + public void updateDemolitionBlocks(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (RecreationData recreation : _buildRecreations.values()) + { + ArrayList blocksForDemolition = new ArrayList(recreation.BlocksForDemolition); + + for (DemolitionData demolition : blocksForDemolition) + if (_state != SpeedBuilderState.Building) + demolition.cancelBreak(); + else + demolition.update(); + } + } + @EventHandler public void preventBlockGrowth(BlockGrowEvent event) { From 840b78423917881bd9e8378861b2a0a85ce94e05 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 29 Nov 2015 13:42:30 -0500 Subject: [PATCH 09/99] Removed some redundant calls and replaced them with a call to one method. --- .../game/games/speedbuilder/RecreationData.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java index 21bdeaf67..7dabb88b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java @@ -97,7 +97,7 @@ public class RecreationData public void clearBuildArea(boolean resetGround) { - for (Block block : UtilBlock.getInBoundingBox(CornerA, CornerB)) + for (Block block : getBlocks()) MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); if (resetGround) @@ -122,27 +122,25 @@ public class RecreationData public void breakAndDropItems() { - for (Block block : UtilBlock.getInBoundingBox(CornerA, CornerB)) + for (Block block : getBlocks()) { - Item item = block.getWorld().dropItem(UtilAlg.getMidpoint(CornerA, CornerB), block.getState().getData().toItemStack(1)); + Item item = block.getWorld().dropItem(getMidpoint(), block.getState().getData().toItemStack(1)); //UtilAction.velocity(item, new Vector(0, 0, 0)); DroppedItems.add(item); } - CornerA.getWorld().playEffect(UtilAlg.getMidpoint(CornerA, CornerB), Effect.STEP_SOUND, Material.LOG.getId()); + CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); clearBuildArea(false); } public boolean isEmptyBuild() { - for (int x = 0; x < 5; x++) - for (int y = 0; y < 5; y++) - for (int z = 0; z < 5; z++) - if (CornerA.clone().add(x, y, z).getBlock().getType() != Material.AIR) - return false; + for (Block block : getBlocks()) + if (block.getType() != Material.AIR) + return false; return true; } From e7960d65e0e7424a30d166d5faa2fe012d93b6c2 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 29 Nov 2015 14:36:51 -0500 Subject: [PATCH 10/99] Moved classes into separate packages so it is more organized. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 4 ++++ .../arcade/game/games/speedbuilder/{ => data}/BuildData.java | 2 +- .../game/games/speedbuilder/{ => data}/DemolitionData.java | 2 +- .../game/games/speedbuilder/{ => data}/RecreationData.java | 3 ++- .../arcade/game/games/speedbuilder/{ => kits}/DefaultKit.java | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/{ => data}/BuildData.java (91%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/{ => data}/DemolitionData.java (96%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/{ => data}/RecreationData.java (97%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/{ => kits}/DefaultKit.java (90%) 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 a4a2cf75b..7bf4a4615 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 @@ -25,6 +25,10 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.speedbuilder.data.BuildData; +import nautilus.game.arcade.game.games.speedbuilder.data.DemolitionData; +import nautilus.game.arcade.game.games.speedbuilder.data.RecreationData; +import nautilus.game.arcade.game.games.speedbuilder.kits.DefaultKit; import nautilus.game.arcade.kit.Kit; import org.bukkit.Effect; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java similarity index 91% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java index 1084f8523..e0c2524a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder; +package nautilus.game.arcade.game.games.speedbuilder.data; import org.bukkit.Location; import org.bukkit.block.BlockState; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java similarity index 96% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java index 91c10b25c..aaa0fb440 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DemolitionData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder; +package nautilus.game.arcade.game.games.speedbuilder.data; import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java index 7dabb88b6..a7d2cdc54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder; +package nautilus.game.arcade.game.games.speedbuilder.data; import java.util.ArrayList; import java.util.List; @@ -6,6 +6,7 @@ import java.util.List; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; import org.bukkit.Effect; import org.bukkit.Location; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java similarity index 90% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java index 55833f919..687115c04 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder; +package nautilus.game.arcade.game.games.speedbuilder.kits; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; From d24135771fa81884365e5d6c041a04c5d58ad250 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 30 Nov 2015 19:10:59 -0500 Subject: [PATCH 11/99] Fixed formatting by adding bodies to all for loops. --- .../game/games/speedbuilder/SpeedBuilder.java | 28 ++++++++++++++++ .../games/speedbuilder/data/BuildData.java | 10 ++++++ .../speedbuilder/data/RecreationData.java | 32 +++++++++++++++++++ 3 files changed, 70 insertions(+) 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 7bf4a4615..2084d8769 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 @@ -114,11 +114,17 @@ public class SpeedBuilder extends SoloGame Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { _defaultMiddleGround[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); + } + } for (Location loc : WorldData.GetDataLocs("LIME")) + { _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5))); + } } public void setSpeedBuilderState(SpeedBuilderState state) @@ -146,9 +152,15 @@ public class SpeedBuilder extends SoloGame MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); if (resetGround) + { for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, -1, z), _defaultMiddleGround[x][z].getType(), _defaultMiddleGround[x][z].getRawData()); + } + } + } } public void pasteBuildInCenter(BuildData buildData) @@ -158,15 +170,25 @@ public class SpeedBuilder extends SoloGame Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { MapUtil.QuickChangeBlockAt(groundMin.clone().add(x, 0, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData()); + } + } Location buildMin = _buildMiddle.clone().subtract(2, 0, 2); for (int x = 0; x < 5; x++) + { for (int y = 0; y < 5; y++) + { for (int z = 0; z < 5; z++) + { MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); + } + } + } } public void spawnJudge() @@ -379,7 +401,9 @@ public class SpeedBuilder extends SoloGame if (UtilTime.elapsed(_stateTime, 10000)) { for (RecreationData recreation : _buildRecreations.values()) + { recreation.breakAndDropItems(); + } ItemPickup = true; BlockPlace = true; @@ -398,7 +422,9 @@ public class SpeedBuilder extends SoloGame for (RecreationData recreation : _buildRecreations.values()) { for (Item item : recreation.DroppedItems) + { item.remove(); + } recreation.DroppedItems.clear(); @@ -615,10 +641,12 @@ public class SpeedBuilder extends SoloGame ArrayList blocksForDemolition = new ArrayList(recreation.BlocksForDemolition); for (DemolitionData demolition : blocksForDemolition) + { if (_state != SpeedBuilderState.Building) demolition.cancelBreak(); else demolition.update(); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java index e0c2524a5..067e508af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java @@ -14,15 +14,25 @@ public class BuildData Location groundMin = loc.clone().add(-2, 2, -2); for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); + } + } Location buildMin = loc.clone().add(-2, 3, -2); for (int x = 0; x < 5; x++) + { for (int y = 0; y < 5; y++) + { for (int z = 0; z < 5; z++) + { Build[x][y][z] = buildMin.clone().add(x, y, z).getBlock().getState(); + } + } + } } } 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 a7d2cdc54..c2e6ef4a4 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 @@ -46,8 +46,12 @@ public class RecreationData PlayerSpawn = playerSpawn; for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState(); + } + } } public boolean inBuildArea(Block block) @@ -99,12 +103,20 @@ public class RecreationData public void clearBuildArea(boolean resetGround) { for (Block block : getBlocks()) + { MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + } if (resetGround) + { for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), DefaultGround[x][z].getType(), DefaultGround[x][z].getRawData()); + } + } + } } public void pasteBuildData(BuildData buildData) @@ -112,13 +124,23 @@ public class RecreationData clearBuildArea(true); for (int x = 0; x < 5; x++) + { for (int z = 0; z < 5; z++) + { MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData()); + } + } for (int x = 0; x < 5; x++) + { for (int y = 0; y < 5; y++) + { for (int z = 0; z < 5; z++) + { MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); + } + } + } } public void breakAndDropItems() @@ -140,8 +162,10 @@ public class RecreationData public boolean isEmptyBuild() { for (Block block : getBlocks()) + { if (block.getType() != Material.AIR) return false; + } return true; } @@ -151,10 +175,16 @@ public class RecreationData int score = 0; for (int x = 0; x < 5; x++) + { for (int y = 0; y < 5; y++) + { for (int z = 0; z < 5; z++) + { if (buildData.Build[x][y][z].getType() == CornerA.clone().add(x, y, z).getBlock().getType() && buildData.Build[x][y][z].getRawData() == CornerA.clone().add(x, y, z).getBlock().getData()) score++; + } + } + } return score; } @@ -172,8 +202,10 @@ public class RecreationData public void addToDemolition(Block block) { for (DemolitionData demolition : BlocksForDemolition) + { if (demolition.Block.equals(block)) return; + } BlocksForDemolition.add(new DemolitionData(this, block)); } From 1ad534366ef574f43bf5b06f5d42d4b9ed7e57bd Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 30 Nov 2015 22:09:15 -0500 Subject: [PATCH 12/99] Switch item dropping to the new util method. --- .../arcade/game/games/speedbuilder/data/DemolitionData.java | 3 ++- .../arcade/game/games/speedbuilder/data/RecreationData.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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 aaa0fb440..e305d4ae1 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 @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.speedbuilder.data; import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilBlock; import mineplex.core.hologram.Hologram; import org.bukkit.Effect; @@ -71,7 +72,7 @@ public class DemolitionData { despawnHologram(); - Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), Block.getState().getData().toItemStack(1)); + Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), UtilBlock.blockToInventoryItemStack(Block)); Parent.DroppedItems.add(item); 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 c2e6ef4a4..c99ab5d65 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 @@ -147,7 +147,7 @@ public class RecreationData { for (Block block : getBlocks()) { - Item item = block.getWorld().dropItem(getMidpoint(), block.getState().getData().toItemStack(1)); + Item item = block.getWorld().dropItem(getMidpoint(), UtilBlock.blockToInventoryItemStack(block)); //UtilAction.velocity(item, new Vector(0, 0, 0)); From f0c28e6234e1a70af42efac004ef88d6c1ee49c4 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 2 Dec 2015 20:20:14 -0500 Subject: [PATCH 13/99] Updated references to the util method. --- .../game/games/speedbuilder/data/DemolitionData.java | 10 +++++++--- .../game/games/speedbuilder/data/RecreationData.java | 12 +++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) 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 e305d4ae1..377376952 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 @@ -9,6 +9,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Item; +import org.bukkit.inventory.ItemStack; public class DemolitionData { @@ -72,9 +73,12 @@ public class DemolitionData { despawnHologram(); - Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), UtilBlock.blockToInventoryItemStack(Block)); - - Parent.DroppedItems.add(item); + for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(Block)) + { + Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), itemStack); + + Parent.DroppedItems.add(item); + } Block.getWorld().playEffect(Block.getLocation(), Effect.STEP_SOUND, Block.getTypeId()); 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 c99ab5d65..f815d027a 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 @@ -15,6 +15,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.entity.Item; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class RecreationData { @@ -147,11 +148,12 @@ public class RecreationData { for (Block block : getBlocks()) { - Item item = block.getWorld().dropItem(getMidpoint(), UtilBlock.blockToInventoryItemStack(block)); - - //UtilAction.velocity(item, new Vector(0, 0, 0)); - - DroppedItems.add(item); + for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) + { + Item item = block.getWorld().dropItem(getMidpoint(), itemStack); + + DroppedItems.add(item); + } } CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); From ee51766e1f67d9a662c5af6e614b793df6a02186 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 2 Dec 2015 22:12:53 -0500 Subject: [PATCH 14/99] Removed teleports. Made the spawns face the middle but it doesn't work yet because of GameTeam changing the direction again. --- .../arcade/game/games/speedbuilder/SpeedBuilder.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 2084d8769..4b6cf5e7b 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 @@ -51,6 +51,7 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.StructureGrowEvent; +import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame { @@ -125,6 +126,11 @@ public class SpeedBuilder extends SoloGame { _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5))); } + + for (Location loc : GetTeamList().get(0).GetSpawns()) + { + loc.setDirection(UtilAlg.getTrajectory(loc, _buildMiddle)); + } } public void setSpeedBuilderState(SpeedBuilderState state) @@ -429,8 +435,6 @@ public class SpeedBuilder extends SoloGame recreation.DroppedItems.clear(); UtilInv.Clear(recreation.Player); - - recreation.Player.teleport(recreation.PlayerSpawn); } //Sometimes it stops on 0.1 and has one bar green @@ -493,8 +497,6 @@ public class SpeedBuilder extends SoloGame for (RecreationData recreation : _buildRecreations.values()) { recreation.pasteBuildData(_currentBuild); - - recreation.Player.teleport(recreation.PlayerSpawn); } if (_buildTime > 1) From 465f8c28f63dba30f66f11cc6ec3fb09e8965ae2 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 3 Dec 2015 21:13:33 -0500 Subject: [PATCH 15/99] Set FixSpawnFacing to false so that out looking at the middle feature would work. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 2 ++ 1 file changed, 2 insertions(+) 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 4b6cf5e7b..d38162a6b 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 @@ -103,6 +103,8 @@ public class SpeedBuilder extends SoloGame DontAllowOverfill = true; DeathMessages = false; + + FixSpawnFacing = false; } @Override From efbabb1519f7d5c6b3c76ef30e298bf58742a648 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 3 Dec 2015 21:27:10 -0500 Subject: [PATCH 16/99] Players now look at the middle of the middle block instead of the corner. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 3 +-- 1 file changed, 1 insertion(+), 2 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 d38162a6b..f07dcebf6 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 @@ -51,7 +51,6 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.StructureGrowEvent; -import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame { @@ -131,7 +130,7 @@ public class SpeedBuilder extends SoloGame for (Location loc : GetTeamList().get(0).GetSpawns()) { - loc.setDirection(UtilAlg.getTrajectory(loc, _buildMiddle)); + loc.setDirection(UtilAlg.getTrajectory(loc, _buildMiddle.clone().add(0.5, 0, 0.5))); } } From 62c49fa8e6bac6335f47d2533a6f47f3a358f7c9 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Fri, 4 Dec 2015 23:04:52 -0500 Subject: [PATCH 17/99] some more stuff on the checklist --- .../game/games/speedbuilder/SpeedBuilder.java | 107 +++++++++++++----- .../speedbuilder/data/DemolitionData.java | 13 +-- 2 files changed, 85 insertions(+), 35 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 f07dcebf6..95fec44bc 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 @@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -37,15 +38,15 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockState; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGuardian; import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Guardian; import org.bukkit.entity.Item; import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -58,7 +59,8 @@ public class SpeedBuilder extends SoloGame private SpeedBuilderState _state = SpeedBuilderState.Viewing; private long _stateTime = System.currentTimeMillis(); - private int _countStage; + private int _buildCountStage; + private int _viewCountStage; private int _buildTime = 35; @@ -71,7 +73,8 @@ public class SpeedBuilder extends SoloGame private NautHashMap _buildRecreations = new NautHashMap(); - private Guardian _judgeGuardian; + private Zombie _judgeEntity; + private DisguiseGuardian _judgeDisguise; private ArmorStand _judgeSupport; private Location _judgeSpawn; private ArmorStand _judgeLaserTarget; @@ -202,28 +205,35 @@ public class SpeedBuilder extends SoloGame { CreatureAllowOverride = true; - _judgeGuardian = _judgeSpawn.getWorld().spawn(_judgeSpawn, Guardian.class); + _judgeEntity = _judgeSpawn.getWorld().spawn(_judgeSpawn, Zombie.class); _judgeSupport = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); CreatureAllowOverride = false; - UtilEnt.Vegetate(_judgeGuardian, true); + UtilEnt.Vegetate(_judgeEntity, true); - _judgeGuardian.setElder(true); + _judgeDisguise = new DisguiseGuardian(_judgeEntity); + + _judgeDisguise.setElder(true); + + Manager.GetDisguise().disguise(_judgeDisguise); _judgeSupport.setVisible(false); _judgeSupport.setGravity(false); _judgeSupport.setSmall(true); - _judgeSupport.setPassenger(_judgeGuardian); + _judgeSupport.setPassenger(_judgeEntity); } public void despawnJudge() { - _judgeGuardian.remove(); + Manager.GetDisguise().undisguise(_judgeEntity); + + _judgeEntity.remove(); _judgeSupport.remove(); - _judgeGuardian = null; + _judgeDisguise = null; + _judgeEntity = null; _judgeSupport = null; } @@ -234,7 +244,9 @@ public class SpeedBuilder extends SoloGame if (_judgeLaserTarget == null) return; - ((CraftGuardian) _judgeGuardian).getHandle().getDataWatcher().watch(17, 0); + _judgeDisguise.setTarget(0); + + Manager.GetDisguise().updateDisguise(_judgeDisguise); _judgeLaserTarget.remove(); @@ -247,7 +259,7 @@ public class SpeedBuilder extends SoloGame CreatureAllowOverride = true; - _judgeLaserTarget = _judgeGuardian.getWorld().spawn(loc, ArmorStand.class); + _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); CreatureAllowOverride = false; @@ -255,12 +267,24 @@ public class SpeedBuilder extends SoloGame _judgeLaserTarget.setGravity(false); _judgeLaserTarget.setSmall(true); - UtilEnt.CreatureLook(_judgeGuardian, _judgeLaserTarget.getLocation()); + UtilEnt.CreatureLook(_judgeEntity, _judgeLaserTarget.getLocation()); - ((CraftGuardian) _judgeGuardian).getHandle().getDataWatcher().watch(17, _judgeLaserTarget.getEntityId()); + _judgeDisguise.setTarget(_judgeLaserTarget.getEntityId()); + + Manager.GetDisguise().updateDisguise(_judgeDisguise); } } + @EventHandler + public void onPrepare(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + spawnJudge(); + //GUARDIAN LAZORZ WILL ROXORZ YOUR BOXORZ + } + @EventHandler public void onLive(GameStateChangeEvent event) { @@ -415,7 +439,10 @@ public class SpeedBuilder extends SoloGame ItemPickup = true; BlockPlace = true; - _countStage = 0; + _buildCountStage = 0; + + //Sometimes it doesn't show in the update method + UtilTextMiddle.display("", C.cRed + "View Time Over!"); Announce(F.main("Build", "Recreate the build shown.")); @@ -475,9 +502,6 @@ public class SpeedBuilder extends SoloGame pasteBuildInCenter(_currentBuild); - //SIGILS AND HIS GUARDIANS - spawnJudge(); - setSpeedBuilderState(SpeedBuilderState.Reviewing); } } @@ -491,8 +515,6 @@ public class SpeedBuilder extends SoloGame { clearCenterArea(true); - despawnJudge(); - _currentBuild = UtilAlg.Random(_buildData); for (RecreationData recreation : _buildRecreations.values()) @@ -503,7 +525,7 @@ public class SpeedBuilder extends SoloGame if (_buildTime > 1) _buildTime--; - UtilTextMiddle.display("", C.cRed + "Next Build Commencing..."); + _viewCountStage = 0; Announce(F.main("Build", "You will recreate this build.")); @@ -544,6 +566,9 @@ public class SpeedBuilder extends SoloGame _buildRecreations.remove(eliminating.Player); eliminating.Player.damage(9001); + + if (_toEliminate.isEmpty() && GetPlayers(true).size() > 1) + UtilTextMiddle.display("", C.cRed + "Next Build Commencing..."); } }, 40L); } @@ -583,17 +608,40 @@ public class SpeedBuilder extends SoloGame if (_state != SpeedBuilderState.Building) return; - if (UtilTime.elapsed(_stateTime, 1000 * _countStage)) + if (UtilTime.elapsed(_stateTime, 1000 * _buildCountStage)) { ArrayList players = new ArrayList(UtilServer.getServer().getOnlinePlayers()); players.removeAll(_perfectBuild.keySet()); - if (_countStage == _buildTime) + if (_buildCountStage == _buildTime) UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); - else if (_countStage >= _buildTime - 5) - UtilTextMiddle.display("", C.cGreen + (_buildTime - _countStage), players.toArray(new Player[0])); + else if (_buildCountStage >= _buildTime - 5) + UtilTextMiddle.display("", C.cGreen + (_buildTime - _buildCountStage), players.toArray(new Player[0])); - _countStage++; + _buildCountStage++; + } + } + + @EventHandler + public void viewCountdown(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.Viewing) + return; + + if (UtilTime.elapsed(_stateTime, _viewCountStage * 1000)) + { + if (_viewCountStage == 10) + UtilTextMiddle.display("", C.cRed + "View Time Over!"); + else + UtilTextMiddle.display("", C.cGreen + (10 - _viewCountStage)); + + _viewCountStage++; } } @@ -665,6 +713,13 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } + @EventHandler + public void stopJudgeCombust(EntityCombustEvent event) + { + if (event.getEntity().equals(_judgeEntity)) + event.setCancelled(true); + } + @Override @EventHandler public void ScoreboardUpdate(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 377376952..86941c901 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 @@ -1,6 +1,5 @@ package nautilus.game.arcade.game.games.speedbuilder.data; -import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilBlock; import mineplex.core.hologram.Hologram; @@ -33,7 +32,7 @@ public class DemolitionData public void spawnHologram() { - _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Block.getLocation().add(0.5, 0.5, 0.5), C.cGreen + "3"); + _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Block.getLocation().add(0.5, 0.5, 0.5), "3"); _hologram.start(); } @@ -52,13 +51,9 @@ public class DemolitionData if (secondsLeft < 0) secondsLeft = 0; - if (secondsLeft == 3) - _hologram.setText(C.cGreen + "3"); - else if (secondsLeft == 2) - _hologram.setText(C.cGold + "2"); - else if (secondsLeft == 1) - _hologram.setText(C.cRed + "1"); - else if (secondsLeft == 0) + _hologram.setText("" + secondsLeft); + + if (secondsLeft == 0) breakBlock(); } From d3ce0d64349451e8d37f7c8110694bb14673c549 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 5 Dec 2015 19:57:48 -0500 Subject: [PATCH 18/99] Some more stuff on the checklist. --- .../game/games/speedbuilder/SpeedBuilder.java | 100 +++++++++++------- .../speedbuilder/data/DemolitionData.java | 30 ++++++ .../speedbuilder/data/RecreationData.java | 39 ++++++- 3 files changed, 132 insertions(+), 37 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 95fec44bc..1780de8a3 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 @@ -14,6 +14,7 @@ import mineplex.core.common.util.UtilEnt; 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.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; @@ -48,7 +49,6 @@ import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.StructureGrowEvent; @@ -62,7 +62,8 @@ public class SpeedBuilder extends SoloGame private int _buildCountStage; private int _viewCountStage; - private int _buildTime = 35; + private int _buildTime = 25; + private int _viewTime = 6; private Location _buildMiddle; @@ -131,6 +132,11 @@ public class SpeedBuilder extends SoloGame _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5))); } + for (Location loc : WorldData.GetDataLocs("YELLOW")) + { + loc.subtract(0.5, 0, 0.5); + } + for (Location loc : GetTeamList().get(0).GetSpawns()) { loc.setDirection(UtilAlg.getTrajectory(loc, _buildMiddle.clone().add(0.5, 0, 0.5))); @@ -275,7 +281,7 @@ public class SpeedBuilder extends SoloGame } } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onPrepare(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) @@ -283,6 +289,17 @@ public class SpeedBuilder extends SoloGame spawnJudge(); //GUARDIAN LAZORZ WILL ROXORZ YOUR BOXORZ + + ArrayList players = GetPlayers(true); + + for (int i = 0; i < players.size(); i++) + { + if (i >= WorldData.GetDataLocs("YELLOW").size()) + { + Manager.addSpectator(players.get(i), true); + GetTeamList().get(0).RemovePlayer(players.get(i)); + } + } } @EventHandler @@ -302,7 +319,7 @@ public class SpeedBuilder extends SoloGame for (Player player : GetPlayers(true)) { - Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")).clone().subtract(0.5, 0, 0.5); + Location buildLoc = UtilAlg.findClosest(player.getLocation(), WorldData.GetDataLocs("YELLOW")); Location spawnLoc = UtilAlg.findClosest(buildLoc, GetTeamList().get(0).GetSpawns()); _buildRecreations.put(player, new RecreationData(this, player, buildLoc, spawnLoc)); @@ -332,7 +349,7 @@ public class SpeedBuilder extends SoloGame } } - @EventHandler(priority = EventPriority.HIGH) + @EventHandler public void onBlockPlace(BlockPlaceEvent event) { if (_state != SpeedBuilderState.Building) @@ -341,6 +358,12 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; + if (_perfectBuild.containsKey(event.getPlayer())) + { + event.setCancelled(true); + return; + } + if (_buildRecreations.get(event.getPlayer()).inBuildArea(event.getBlock())) return; @@ -374,6 +397,8 @@ public class SpeedBuilder extends SoloGame UtilTextMiddle.display("", C.cGreen + "Perfect Match", event.getPlayer()); + Announce(F.main("Build", C.mElem + event.getPlayer().getName() + C.mBody + " got a perfect build!")); + _perfectBuild.put(event.getPlayer(), System.currentTimeMillis()); } } @@ -396,24 +421,37 @@ public class SpeedBuilder extends SoloGame } @EventHandler - public void stopMoveIntoBuildAreas(PlayerMoveEvent event) + public void stopMoveOffArea(UpdateEvent event) { - if (!IsAlive(event.getPlayer())) + if (event.getType() != UpdateType.FAST) return; if (!IsLive()) return; - for (RecreationData recreation : _buildRecreations.values()) + for (Player player : GetPlayers(true)) { - if (recreation.Player.equals(event.getPlayer())) + if (!_buildRecreations.containsKey(player)) continue; - if (recreation.inBuildArea(event.getTo())) - { - UtilPlayer.message(event.getPlayer(), F.main("Build", "You cannot enter other build areas!")); + RecreationData recreation = _buildRecreations.get(player); + double dist = UtilMath.offsetSquared(player.getLocation(), recreation.OriginalBuildLocation.clone().add(0.5, 0, 0.5)); + + for (Location loc : WorldData.GetDataLocs("YELLOW")) + { + if (loc.equals(recreation.OriginalBuildLocation)) + continue; - event.getPlayer().teleport(_buildRecreations.get(event.getPlayer()).PlayerSpawn); + double distFromOther = UtilMath.offsetSquared(player.getLocation(), loc.clone().add(0.5, 0, 0.5)); + + if (dist > distFromOther || player.getLocation().getY() < recreation.OriginalBuildLocation.getY() - 2) + { + player.teleport(recreation.PlayerSpawn); + + UtilPlayer.message(player, F.main("Build", "You cannot leave your area!")); + + break; + } } } } @@ -429,7 +467,7 @@ public class SpeedBuilder extends SoloGame if (_state == SpeedBuilderState.Viewing) { - if (UtilTime.elapsed(_stateTime, 10000)) + if (UtilTime.elapsed(_stateTime, _viewTime * 1000)) { for (RecreationData recreation : _buildRecreations.values()) { @@ -593,7 +631,7 @@ public class SpeedBuilder extends SoloGame if (timeLeft < 0) timeLeft = 0; - UtilTextBottom.displayProgress("Time Left:", timeLeft / (_buildTime * 1000.0D), UtilTime.MakeStr(timeLeft), UtilServer.getPlayers()); + UtilTextBottom.displayProgress("Time Left", timeLeft / (_buildTime * 1000.0D), UtilTime.MakeStr(timeLeft), UtilServer.getPlayers()); } @EventHandler @@ -611,7 +649,12 @@ public class SpeedBuilder extends SoloGame if (UtilTime.elapsed(_stateTime, 1000 * _buildCountStage)) { ArrayList players = new ArrayList(UtilServer.getServer().getOnlinePlayers()); - players.removeAll(_perfectBuild.keySet()); + + for (Entry entry : _perfectBuild.entrySet()) + { + if (!UtilTime.elapsed(entry.getValue(), 5000)) + players.remove(entry.getKey()); + } if (_buildCountStage == _buildTime) UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); @@ -636,33 +679,15 @@ public class SpeedBuilder extends SoloGame if (UtilTime.elapsed(_stateTime, _viewCountStage * 1000)) { - if (_viewCountStage == 10) + if (_viewCountStage == _viewTime) UtilTextMiddle.display("", C.cRed + "View Time Over!"); else - UtilTextMiddle.display("", C.cGreen + (10 - _viewCountStage)); + UtilTextMiddle.display("", C.cGreen + (_viewTime - _viewCountStage)); _viewCountStage++; } } - @EventHandler - public void cleanPerfectBuilders(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - Iterator> iterator = _perfectBuild.entrySet().iterator(); - - while (iterator.hasNext()) - { - Entry entry = iterator.next(); - - //Title gets 5 secs so the 5, 4, 3, 2, 1 doesn't override it - if (UtilTime.elapsed(entry.getValue(), 5000)) - iterator.remove(); - } - } - @EventHandler public void markBlockForDemolition(PlayerInteractEvent event) { @@ -675,6 +700,9 @@ public class SpeedBuilder extends SoloGame if (!UtilEvent.isAction(event, ActionType.L_BLOCK)) return; + if (_perfectBuild.containsKey(event.getPlayer())) + return; + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(event.getClickedBlock())) return; 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 86941c901..91bb4fedf 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 @@ -7,8 +7,11 @@ import mineplex.core.hologram.Hologram; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.Bed; +import org.bukkit.material.Door; public class DemolitionData { @@ -73,6 +76,33 @@ public class DemolitionData Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), itemStack); Parent.DroppedItems.add(item); + + //Destroy the other part + if (Block.getType() == Material.BED_BLOCK) + { + Bed bed = (Bed) Block.getState().getData(); + + if (bed.isHeadOfBed()) + MapUtil.QuickChangeBlockAt(Block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(Block.getRelative(bed.getFacing()).getLocation(), Material.AIR); + } + else if (Block.getType() == Material.WOODEN_DOOR || Block.getType() == Material.IRON_DOOR_BLOCK || Block.getType() == Material.SPRUCE_DOOR || Block.getType() == Material.BIRCH_DOOR || Block.getType() == Material.JUNGLE_DOOR || Block.getType() == Material.ACACIA_DOOR || Block.getType() == Material.DARK_OAK_DOOR) + { + Door door = (Door) Block.getState().getData(); + + if (door.isTopHalf()) + MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + } + else if (Block.getType() == Material.DOUBLE_PLANT) + { + if (Block.getData() > 7) + MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + } } Block.getWorld().playEffect(Block.getLocation(), Effect.STEP_SOUND, Block.getTypeId()); 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 f815d027a..424cf93e6 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 @@ -12,10 +12,13 @@ import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.Bed; +import org.bukkit.material.Door; public class RecreationData { @@ -26,6 +29,8 @@ public class RecreationData public BlockState[][] DefaultGround = new BlockState[5][5]; + public Location OriginalBuildLocation; + public Location CornerA; public Location CornerB; @@ -41,6 +46,8 @@ public class RecreationData Player = player; + OriginalBuildLocation = loc; + CornerA = loc.clone().subtract(2, 0, 2); CornerB = loc.clone().add(2, 4, 2); @@ -147,13 +154,43 @@ public class RecreationData public void breakAndDropItems() { for (Block block : getBlocks()) - { + { + if (block.getType() == Material.AIR) + continue; + for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) { Item item = block.getWorld().dropItem(getMidpoint(), itemStack); DroppedItems.add(item); } + + //Destroy the other part + if (block.getType() == Material.BED_BLOCK) + { + Bed bed = (Bed) block.getState().getData(); + + if (bed.isHeadOfBed()) + MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing()).getLocation(), Material.AIR); + } + else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR) + { + Door door = (Door) block.getState().getData(); + + if (door.isTopHalf()) + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + } + else if (block.getType() == Material.DOUBLE_PLANT) + { + if (block.getData() > 7) + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + } } CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); From 9144ab7b3f81c848e1e153109a34597eff5f259a Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 5 Dec 2015 20:30:21 -0500 Subject: [PATCH 19/99] Fixed some demolition stuff. --- .../speedbuilder/data/DemolitionData.java | 92 +++++++++++-------- .../speedbuilder/data/RecreationData.java | 34 ++++++- 2 files changed, 84 insertions(+), 42 deletions(-) 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 91bb4fedf..ee9563b91 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 @@ -1,5 +1,7 @@ package nautilus.game.arcade.game.games.speedbuilder.data; +import java.util.ArrayList; + import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilBlock; import mineplex.core.hologram.Hologram; @@ -18,16 +20,16 @@ public class DemolitionData public RecreationData Parent; - public Block Block; + public ArrayList Blocks; public Long Start; private Hologram _hologram; - public DemolitionData(RecreationData parent, Block block) + public DemolitionData(RecreationData parent, ArrayList blocks) { Parent = parent; - Block = block; + Blocks = blocks; Start = System.currentTimeMillis(); spawnHologram(); @@ -35,7 +37,7 @@ public class DemolitionData public void spawnHologram() { - _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Block.getLocation().add(0.5, 0.5, 0.5), "3"); + _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Blocks.get(0).getLocation().add(0.5, 0.5, 0.5), "3"); _hologram.start(); } @@ -57,7 +59,7 @@ public class DemolitionData _hologram.setText("" + secondsLeft); if (secondsLeft == 0) - breakBlock(); + breakBlocks(); } public void cancelBreak() @@ -67,47 +69,57 @@ public class DemolitionData Parent.BlocksForDemolition.remove(this); } - public void breakBlock() + public void breakBlocks() { despawnHologram(); - for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(Block)) + //Effect will play for all blocks even two-parted ones + for (Block block : Blocks) { - Item item = Block.getWorld().dropItem(Block.getLocation().add(0.5, 0.5, 0.5), itemStack); - - Parent.DroppedItems.add(item); - - //Destroy the other part - if (Block.getType() == Material.BED_BLOCK) - { - Bed bed = (Bed) Block.getState().getData(); - - if (bed.isHeadOfBed()) - MapUtil.QuickChangeBlockAt(Block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR); - else - MapUtil.QuickChangeBlockAt(Block.getRelative(bed.getFacing()).getLocation(), Material.AIR); - } - else if (Block.getType() == Material.WOODEN_DOOR || Block.getType() == Material.IRON_DOOR_BLOCK || Block.getType() == Material.SPRUCE_DOOR || Block.getType() == Material.BIRCH_DOOR || Block.getType() == Material.JUNGLE_DOOR || Block.getType() == Material.ACACIA_DOOR || Block.getType() == Material.DARK_OAK_DOOR) - { - Door door = (Door) Block.getState().getData(); - - if (door.isTopHalf()) - MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); - else - MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.UP).getLocation(), Material.AIR); - } - else if (Block.getType() == Material.DOUBLE_PLANT) - { - if (Block.getData() > 7) - MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); - else - MapUtil.QuickChangeBlockAt(Block.getRelative(BlockFace.UP).getLocation(), Material.AIR); - } + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); } - Block.getWorld().playEffect(Block.getLocation(), Effect.STEP_SOUND, Block.getTypeId()); - - MapUtil.QuickChangeBlockAt(Block.getLocation(), Material.AIR); + for (Block block : Blocks) + { + if (block.getType() == Material.AIR) + continue; + + for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) + { + Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack); + + Parent.DroppedItems.add(item); + } + + //Destroy the other part + if (block.getType() == Material.BED_BLOCK) + { + Bed bed = (Bed) block.getState().getData(); + + if (bed.isHeadOfBed()) + MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing().getOppositeFace()).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getRelative(bed.getFacing()).getLocation(), Material.AIR); + } + else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR) + { + Door door = (Door) block.getState().getData(); + + if (door.isTopHalf()) + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + } + else if (block.getType() == Material.DOUBLE_PLANT) + { + if (block.getData() > 7) + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.DOWN).getLocation(), Material.AIR); + else + MapUtil.QuickChangeBlockAt(block.getRelative(BlockFace.UP).getLocation(), Material.AIR); + } + + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + } Parent.BlocksForDemolition.remove(this); } 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 424cf93e6..1f21d4ebb 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 @@ -242,11 +242,41 @@ public class RecreationData { for (DemolitionData demolition : BlocksForDemolition) { - if (demolition.Block.equals(block)) + if (demolition.Blocks.contains(block)) return; } - BlocksForDemolition.add(new DemolitionData(this, block)); + ArrayList blocks = new ArrayList(); + blocks.add(block); + + //Add the other part of the block + if (block.getType() == Material.BED_BLOCK) + { + Bed bed = (Bed) block.getState().getData(); + + if (bed.isHeadOfBed()) + blocks.add(block.getRelative(bed.getFacing().getOppositeFace())); + else + blocks.add(block.getRelative(bed.getFacing())); + } + else if (block.getType() == Material.WOODEN_DOOR || block.getType() == Material.IRON_DOOR_BLOCK || block.getType() == Material.SPRUCE_DOOR || block.getType() == Material.BIRCH_DOOR || block.getType() == Material.JUNGLE_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR) + { + Door door = (Door) block.getState().getData(); + + if (door.isTopHalf()) + blocks.add(block.getRelative(BlockFace.DOWN)); + else + blocks.add(block.getRelative(BlockFace.UP)); + } + else if (block.getType() == Material.DOUBLE_PLANT) + { + if (block.getData() > 7) + blocks.add(block.getRelative(BlockFace.DOWN)); + else + blocks.add(block.getRelative(BlockFace.UP)); + } + + BlocksForDemolition.add(new DemolitionData(this, blocks)); } } From ca7e5d0d6dd6ed727bacd242d062d4cff03faa52 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 6 Dec 2015 16:37:00 -0500 Subject: [PATCH 20/99] remove later --- .../game/games/speedbuilder/SpeedBuilder.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 1780de8a3..f0baa0c06 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 @@ -748,6 +748,21 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } + @EventHandler + public void judgeRandomLook(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.Building) + return; + + + } + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) From 6904f7c9a9253b2dba85f42f85de6b8287af161e Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 6 Dec 2015 22:54:45 -0500 Subject: [PATCH 21/99] Tons more stuff on the checklist. --- .../game/games/speedbuilder/SpeedBuilder.java | 202 +++++++++++++++--- .../speedbuilder/data/DemolitionData.java | 39 +++- .../speedbuilder/data/RecreationData.java | 14 +- 3 files changed, 212 insertions(+), 43 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 f0baa0c06..bcdc816d5 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 @@ -1,13 +1,13 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; -import java.util.Iterator; import java.util.Map.Entry; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; @@ -26,14 +26,21 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.speedbuilder.data.BuildData; import nautilus.game.arcade.game.games.speedbuilder.data.DemolitionData; import nautilus.game.arcade.game.games.speedbuilder.data.RecreationData; import nautilus.game.arcade.game.games.speedbuilder.kits.DefaultKit; import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; +import org.bukkit.ChatColor; import org.bukkit.Effect; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -42,16 +49,16 @@ import org.bukkit.block.BlockState; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Item; import org.bukkit.entity.Player; -import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.StructureGrowEvent; +import org.bukkit.material.Bed; +import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame { @@ -74,9 +81,8 @@ public class SpeedBuilder extends SoloGame private NautHashMap _buildRecreations = new NautHashMap(); - private Zombie _judgeEntity; + private ArmorStand _judgeEntity; private DisguiseGuardian _judgeDisguise; - private ArmorStand _judgeSupport; private Location _judgeSpawn; private ArmorStand _judgeLaserTarget; @@ -211,24 +217,19 @@ public class SpeedBuilder extends SoloGame { CreatureAllowOverride = true; - _judgeEntity = _judgeSpawn.getWorld().spawn(_judgeSpawn, Zombie.class); - _judgeSupport = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); + _judgeEntity = _judgeSpawn.getWorld().spawn(_judgeSpawn, ArmorStand.class); CreatureAllowOverride = false; - UtilEnt.Vegetate(_judgeEntity, true); + _judgeEntity.setVisible(false); + _judgeEntity.setGravity(false); + _judgeEntity.setSmall(true); _judgeDisguise = new DisguiseGuardian(_judgeEntity); _judgeDisguise.setElder(true); Manager.GetDisguise().disguise(_judgeDisguise); - - _judgeSupport.setVisible(false); - _judgeSupport.setGravity(false); - _judgeSupport.setSmall(true); - - _judgeSupport.setPassenger(_judgeEntity); } public void despawnJudge() @@ -236,11 +237,9 @@ public class SpeedBuilder extends SoloGame Manager.GetDisguise().undisguise(_judgeEntity); _judgeEntity.remove(); - _judgeSupport.remove(); _judgeDisguise = null; _judgeEntity = null; - _judgeSupport = null; } public void judgeTargetLocation(Location loc) @@ -272,6 +271,7 @@ public class SpeedBuilder extends SoloGame _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); _judgeLaserTarget.setSmall(true); + _judgeLaserTarget.setGhost(true); UtilEnt.CreatureLook(_judgeEntity, _judgeLaserTarget.getLocation()); @@ -281,6 +281,22 @@ public class SpeedBuilder extends SoloGame } } + public void moveToGuardians(Player player) + { + GetTeamList().get(0).SetPlacement(player, PlayerState.OUT); + GetTeamList().get(0).RemovePlayer(player); + + GetTeamList().get(1).AddPlayer(player, true); + + DisguiseGuardian disguise = new DisguiseGuardian(player); + Manager.GetDisguise().disguise(disguise); + + player.setAllowFlight(true); + player.setFlying(true); + + EndCheck(); + } + @EventHandler(priority = EventPriority.LOWEST) public void onPrepare(GameStateChangeEvent event) { @@ -290,6 +306,8 @@ public class SpeedBuilder extends SoloGame spawnJudge(); //GUARDIAN LAZORZ WILL ROXORZ YOUR BOXORZ + AddTeam(new GameTeam(this, "Guardians", ChatColor.RED, new ArrayList())); + ArrayList players = GetPlayers(true); for (int i = 0; i < players.size(); i++) @@ -364,8 +382,33 @@ public class SpeedBuilder extends SoloGame return; } - if (_buildRecreations.get(event.getPlayer()).inBuildArea(event.getBlock())) + if (_buildRecreations.get(event.getPlayer()).isQueuedForDemolition(event.getBlock())) + { + event.setCancelled(true); return; + } + + if (_buildRecreations.get(event.getPlayer()).inBuildArea(event.getBlock()) && event.getBlock().getType() != Material.BED_BLOCK) + return; + else if (event.getBlock().getType() == Material.BED_BLOCK) + { + Bed bed = (Bed) event.getBlock().getState().getData(); + + if (bed.isHeadOfBed()) + { + Block foot = event.getBlock().getRelative(bed.getFacing().getOppositeFace()); + + if (_buildRecreations.get(event.getPlayer()).inBuildArea(foot)) + return; + } + else + { + Block head = event.getBlock().getRelative(bed.getFacing()); + + if (_buildRecreations.get(event.getPlayer()).inBuildArea(head)) + return; + } + } event.setCancelled(true); UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); @@ -429,6 +472,9 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; + if (_state == SpeedBuilderState.Reviewing) + return; + for (Player player : GetPlayers(true)) { if (!_buildRecreations.containsKey(player)) @@ -456,6 +502,25 @@ public class SpeedBuilder extends SoloGame } } + @EventHandler + public void stopGuardiansBuildEnter(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!IsLive()) + return; + + for (Player player : GetTeamList().get(1).GetPlayers(false)) + { + for (RecreationData recreation : _buildRecreations.values()) + { + if (UtilMath.offsetSquared(player.getLocation(), recreation.getMidpoint()) < 25) + UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1)); + } + } + } + @EventHandler public void stateUpdate(UpdateEvent event) { @@ -509,6 +574,15 @@ public class SpeedBuilder extends SoloGame //Sometimes doesn't show in the update method UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); + for (Player player : UtilServer.getPlayers()) + { + player.setGameMode(GameMode.SPECTATOR); + player.setSpectatorTarget(_judgeEntity); + + PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(10, 0.0F); + UtilPlayer.sendPacket(player, packet); + } + _perfectBuild.clear(); ItemPickup = false; @@ -560,6 +634,22 @@ public class SpeedBuilder extends SoloGame recreation.pasteBuildData(_currentBuild); } + for (Player player : UtilServer.getPlayers()) + { + player.setGameMode(GameMode.SURVIVAL); + + if (_buildRecreations.containsKey(player)) + player.teleport(_buildRecreations.get(player).PlayerSpawn); + + if (!IsAlive(player) || GetTeamList().get(1).HasPlayer(player)) + { + player.setAllowFlight(true); + player.setFlying(true); + + player.teleport(GetSpectatorLocation()); + } + } + if (_buildTime > 1) _buildTime--; @@ -603,10 +693,7 @@ public class SpeedBuilder extends SoloGame _buildRecreations.remove(eliminating.Player); - eliminating.Player.damage(9001); - - if (_toEliminate.isEmpty() && GetPlayers(true).size() > 1) - UtilTextMiddle.display("", C.cRed + "Next Build Commencing..."); + moveToGuardians(eliminating.Player); } }, 40L); } @@ -742,25 +829,70 @@ public class SpeedBuilder extends SoloGame } @EventHandler - public void stopJudgeCombust(EntityCombustEvent event) + public void judgeStaring(UpdateEvent event) { - if (event.getEntity().equals(_judgeEntity)) - event.setCancelled(true); - } - - @EventHandler - public void judgeRandomLook(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) + if (event.getType() != UpdateType.FASTEST) return; + if (!InProgress()) + return; + + if (_state != SpeedBuilderState.Building && _state != SpeedBuilderState.Viewing) + return; + + for (Player player : UtilServer.getPlayers()) + { + Vector trajectory = UtilAlg.getTrajectory(_judgeEntity.getEyeLocation(), player.getEyeLocation()); + + PacketPlayOutEntityLook packetLook = new PacketPlayOutEntityLook(); + + packetLook.a = _judgeEntity.getEntityId(); + packetLook.e = (byte)(int)(UtilAlg.GetYaw(trajectory) * 256d / 360d); + packetLook.f = (byte)(int)(UtilAlg.GetPitch(trajectory) * 256d / 360d); + packetLook.g = false; + packetLook.h = true; + + PacketPlayOutEntityHeadRotation packetRot = new PacketPlayOutEntityHeadRotation(); + + packetRot.a = packetLook.a; + packetRot.b = packetLook.e; + + UtilPlayer.sendPacket(player, packetLook, packetRot); + } + } + + @Override + public void EndCheck() + { if (!IsLive()) return; - if (_state != SpeedBuilderState.Building) - return; - - + GameTeam playersTeam = GetTeamList().get(0); + + if (playersTeam.GetPlayers(true).size() <= 1) + { + ArrayList places = playersTeam.GetPlacements(true); + + //Announce + AnnounceEnd(places); + + //Gems + if (places.size() >= 1) + AddGems(places.get(0), 20, "1st Place", false, false); + + if (places.size() >= 2) + AddGems(places.get(1), 15, "2nd Place", false, false); + + if (places.size() >= 3) + AddGems(places.get(2), 10, "3rd Place", false, false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + + //End + SetState(GameState.End); + } } @Override @@ -775,7 +907,7 @@ public class SpeedBuilder extends SoloGame Scoreboard.WriteBlank(); Scoreboard.Write(C.cGreenB + "Players Left:"); - Scoreboard.Write("" + GetPlayers(true).size()); + Scoreboard.Write("" + GetTeamList().get(0).GetPlayers(true).size()); Scoreboard.WriteBlank(); 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 ee9563b91..25b102303 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 @@ -3,13 +3,16 @@ package nautilus.game.arcade.game.games.speedbuilder.data; import java.util.ArrayList; import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; @@ -20,16 +23,25 @@ public class DemolitionData public RecreationData Parent; - public ArrayList Blocks; + public NautHashMap Blocks; public Long Start; private Hologram _hologram; + private boolean _flickerAir = true; + private long _lastFlicker = System.currentTimeMillis(); + public DemolitionData(RecreationData parent, ArrayList blocks) { Parent = parent; - Blocks = blocks; + Blocks = new NautHashMap(); + + for (Block block : blocks) + { + Blocks.put(block, block.getState()); + } + Start = System.currentTimeMillis(); spawnHologram(); @@ -37,7 +49,7 @@ public class DemolitionData public void spawnHologram() { - _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Blocks.get(0).getLocation().add(0.5, 0.5, 0.5), "3"); + _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5), "3"); _hologram.start(); } @@ -58,6 +70,21 @@ public class DemolitionData _hologram.setText("" + secondsLeft); + if (UtilTime.elapsed(_lastFlicker, 500)) + { + _lastFlicker = System.currentTimeMillis(); + + for (Block block : Blocks.keySet()) + { + if (_flickerAir) + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + else + Blocks.get(block).update(true, false); + } + + _flickerAir = !_flickerAir; + } + if (secondsLeft == 0) breakBlocks(); } @@ -74,12 +101,14 @@ public class DemolitionData despawnHologram(); //Effect will play for all blocks even two-parted ones - for (Block block : Blocks) + for (Block block : Blocks.keySet()) { + Blocks.get(block).update(true, false); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); } - for (Block block : Blocks) + for (Block block : Blocks.keySet()) { if (block.getType() == Material.AIR) continue; 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 1f21d4ebb..45ef62369 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 @@ -238,14 +238,22 @@ public class RecreationData return UtilBlock.getInBoundingBox(CornerA, CornerB); } - public void addToDemolition(Block block) + public boolean isQueuedForDemolition(Block block) { for (DemolitionData demolition : BlocksForDemolition) { - if (demolition.Blocks.contains(block)) - return; + if (demolition.Blocks.containsKey(block)) + return true; } + return false; + } + + public void addToDemolition(Block block) + { + if (isQueuedForDemolition(block)) + return; + ArrayList blocks = new ArrayList(); blocks.add(block); From d22a9052069dad0132142579fa5be9530accb5c7 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 7 Dec 2015 23:29:33 -0500 Subject: [PATCH 22/99] Lot more stuff! :D --- .../game/games/speedbuilder/SpeedBuilder.java | 79 ++++++++++++++----- 1 file changed, 60 insertions(+), 19 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 bcdc816d5..8cfcf1fe9 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 @@ -56,6 +56,7 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.material.Bed; import org.bukkit.util.Vector; @@ -88,6 +89,7 @@ public class SpeedBuilder extends SoloGame private ArrayList _toEliminate = new ArrayList(); private long _lastElimination; + private boolean _eliminating; private NautHashMap _perfectBuild = new NautHashMap(); @@ -289,6 +291,9 @@ public class SpeedBuilder extends SoloGame GetTeamList().get(1).AddPlayer(player, true); DisguiseGuardian disguise = new DisguiseGuardian(player); + disguise.setName(C.cGray + player.getName()); + disguise.setCustomNameVisible(true); + Manager.GetDisguise().disguise(disguise); player.setAllowFlight(true); @@ -306,7 +311,7 @@ public class SpeedBuilder extends SoloGame spawnJudge(); //GUARDIAN LAZORZ WILL ROXORZ YOUR BOXORZ - AddTeam(new GameTeam(this, "Guardians", ChatColor.RED, new ArrayList())); + AddTeam(new GameTeam(this, "Guardians", ChatColor.GRAY, new ArrayList())); ArrayList players = GetPlayers(true); @@ -438,7 +443,7 @@ public class SpeedBuilder extends SoloGame { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - UtilTextMiddle.display("", C.cGreen + "Perfect Match", event.getPlayer()); + UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, event.getPlayer()); Announce(F.main("Build", C.mElem + event.getPlayer().getName() + C.mBody + " got a perfect build!")); @@ -515,7 +520,7 @@ public class SpeedBuilder extends SoloGame { for (RecreationData recreation : _buildRecreations.values()) { - if (UtilMath.offsetSquared(player.getLocation(), recreation.getMidpoint()) < 25) + if (UtilMath.offsetSquared(player.getLocation(), recreation.getMidpoint()) < 64) UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1)); } } @@ -545,7 +550,7 @@ public class SpeedBuilder extends SoloGame _buildCountStage = 0; //Sometimes it doesn't show in the update method - UtilTextMiddle.display("", C.cRed + "View Time Over!"); + UtilTextMiddle.display("", C.cRed + "View Time Over!", 0, 30, 10); Announce(F.main("Build", "Recreate the build shown.")); @@ -572,7 +577,7 @@ public class SpeedBuilder extends SoloGame UtilTextBottom.displayProgress("Time Left:", 0, UtilTime.MakeStr(0), UtilServer.getPlayers()); //Sometimes doesn't show in the update method - UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); + UtilTextMiddle.display("", C.cRed + "TIME'S UP!", 0, 30, 10); for (Player player : UtilServer.getPlayers()) { @@ -612,18 +617,16 @@ public class SpeedBuilder extends SoloGame if (!allPerfectMatch && lowest != null && !_toEliminate.contains(lowest)) _toEliminate.add(lowest); + _lastElimination = System.currentTimeMillis(); + pasteBuildInCenter(_currentBuild); setSpeedBuilderState(SpeedBuilderState.Reviewing); } } else if (_state == SpeedBuilderState.Reviewing) - { - //If there is nobody to eliminate let it continue so it goes into the next build - if (!UtilTime.elapsed(_stateTime, 5000) && !_toEliminate.isEmpty()) - return; - - if (_toEliminate.isEmpty() && UtilTime.elapsed(_lastElimination, 3000)) + { + if (_toEliminate.isEmpty()) { clearCenterArea(true); @@ -661,22 +664,26 @@ public class SpeedBuilder extends SoloGame } else { - if (UtilTime.elapsed(_lastElimination, 4000)) + if (UtilTime.elapsed(_lastElimination, 2000)) { - _lastElimination = System.currentTimeMillis(); - //Eliminate in order This also means that the empty builds are eliminated first final RecreationData eliminating = _toEliminate.get(0); judgeTargetLocation(eliminating.getMidpoint()); - UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!"); + UtilTextMiddle.display("", C.cRed + eliminating.Player.getName() + C.cGreen + " was eliminated!", 0, 30, 10); + + _eliminating = true; Manager.runSyncLater(new Runnable() { @Override public void run() { + _lastElimination = System.currentTimeMillis(); + + _eliminating = false; + if (!_toEliminate.contains(eliminating)) return; @@ -697,6 +704,18 @@ public class SpeedBuilder extends SoloGame } }, 40L); } + else if (!_eliminating) + { + double speed = 10d; + + double oX = -Math.sin(_judgeEntity.getTicksLived() / speed) * 12; + double oY = 0; + double oZ = Math.cos(_judgeEntity.getTicksLived() / speed) * 12; + + Location toLook = _judgeEntity.getLocation().add(new Vector(oX, oY, oZ)); + + UtilEnt.CreatureLook(_judgeEntity, toLook); + } } } } @@ -744,9 +763,9 @@ public class SpeedBuilder extends SoloGame } if (_buildCountStage == _buildTime) - UtilTextMiddle.display("", C.cRed + "TIME'S UP!"); + UtilTextMiddle.display("", C.cRed + "TIME'S UP!", 0, 30, 10); else if (_buildCountStage >= _buildTime - 5) - UtilTextMiddle.display("", C.cGreen + (_buildTime - _buildCountStage), players.toArray(new Player[0])); + UtilTextMiddle.display("", C.cGreen + (_buildTime - _buildCountStage), 0, 30, 10, players.toArray(new Player[0])); _buildCountStage++; } @@ -767,9 +786,9 @@ public class SpeedBuilder extends SoloGame if (UtilTime.elapsed(_stateTime, _viewCountStage * 1000)) { if (_viewCountStage == _viewTime) - UtilTextMiddle.display("", C.cRed + "View Time Over!"); + UtilTextMiddle.display("", C.cRed + "View Time Over!", 0, 30, 10); else - UtilTextMiddle.display("", C.cGreen + (_viewTime - _viewCountStage)); + UtilTextMiddle.display("", C.cGreen + (_viewTime - _viewCountStage), 0, 30, 10); _viewCountStage++; } @@ -861,6 +880,25 @@ public class SpeedBuilder extends SoloGame } } + @EventHandler + public void stopJudgeUnspec(final PlayerToggleSneakEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.Reviewing) + return; + + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + event.getPlayer().setSpectatorTarget(_judgeEntity); + } + }, 1L); + } + @Override public void EndCheck() { @@ -902,6 +940,9 @@ public class SpeedBuilder extends SoloGame if (event.getType() != UpdateType.FAST) return; + if (GetTeamList().isEmpty()) + return; + Scoreboard.Reset(); Scoreboard.WriteBlank(); From be6f9ac6dcf821eda36511a2ed7bbf7d8424a5cb Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 9 Dec 2015 19:17:12 -0500 Subject: [PATCH 23/99] Capitalize enum names. --- .../game/games/speedbuilder/SpeedBuilder.java | 38 +++++++++---------- .../games/speedbuilder/SpeedBuilderState.java | 8 ++-- 2 files changed, 23 insertions(+), 23 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 8cfcf1fe9..266afc399 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 @@ -64,7 +64,7 @@ import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame { - private SpeedBuilderState _state = SpeedBuilderState.Viewing; + private SpeedBuilderState _state = SpeedBuilderState.VIEWING; private long _stateTime = System.currentTimeMillis(); private int _buildCountStage; @@ -352,7 +352,7 @@ public class SpeedBuilder extends SoloGame Announce(F.main("Build", "You will recreate this build.")); - setSpeedBuilderState(SpeedBuilderState.Viewing); + setSpeedBuilderState(SpeedBuilderState.VIEWING); } @EventHandler @@ -375,7 +375,7 @@ public class SpeedBuilder extends SoloGame @EventHandler public void onBlockPlace(BlockPlaceEvent event) { - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -433,7 +433,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -456,7 +456,7 @@ public class SpeedBuilder extends SoloGame @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerPickupItem(PlayerPickupItemEvent event) { - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -477,7 +477,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state == SpeedBuilderState.Reviewing) + if (_state == SpeedBuilderState.REVIEWING) return; for (Player player : GetPlayers(true)) @@ -535,7 +535,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state == SpeedBuilderState.Viewing) + if (_state == SpeedBuilderState.VIEWING) { if (UtilTime.elapsed(_stateTime, _viewTime * 1000)) { @@ -554,10 +554,10 @@ public class SpeedBuilder extends SoloGame Announce(F.main("Build", "Recreate the build shown.")); - setSpeedBuilderState(SpeedBuilderState.Building); + setSpeedBuilderState(SpeedBuilderState.BUILDING); } } - else if (_state == SpeedBuilderState.Building) + else if (_state == SpeedBuilderState.BUILDING) { if (UtilTime.elapsed(_stateTime, _buildTime * 1000)) { @@ -621,10 +621,10 @@ public class SpeedBuilder extends SoloGame pasteBuildInCenter(_currentBuild); - setSpeedBuilderState(SpeedBuilderState.Reviewing); + setSpeedBuilderState(SpeedBuilderState.REVIEWING); } } - else if (_state == SpeedBuilderState.Reviewing) + else if (_state == SpeedBuilderState.REVIEWING) { if (_toEliminate.isEmpty()) { @@ -660,7 +660,7 @@ public class SpeedBuilder extends SoloGame Announce(F.main("Build", "You will recreate this build.")); - setSpeedBuilderState(SpeedBuilderState.Viewing); + setSpeedBuilderState(SpeedBuilderState.VIEWING); } else { @@ -729,7 +729,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) return; long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime); @@ -749,7 +749,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) return; if (UtilTime.elapsed(_stateTime, 1000 * _buildCountStage)) @@ -780,7 +780,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.Viewing) + if (_state != SpeedBuilderState.VIEWING) return; if (UtilTime.elapsed(_stateTime, _viewCountStage * 1000)) @@ -797,7 +797,7 @@ public class SpeedBuilder extends SoloGame @EventHandler public void markBlockForDemolition(PlayerInteractEvent event) { - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -827,7 +827,7 @@ public class SpeedBuilder extends SoloGame for (DemolitionData demolition : blocksForDemolition) { - if (_state != SpeedBuilderState.Building) + if (_state != SpeedBuilderState.BUILDING) demolition.cancelBreak(); else demolition.update(); @@ -856,7 +856,7 @@ public class SpeedBuilder extends SoloGame if (!InProgress()) return; - if (_state != SpeedBuilderState.Building && _state != SpeedBuilderState.Viewing) + if (_state != SpeedBuilderState.BUILDING && _state != SpeedBuilderState.VIEWING) return; for (Player player : UtilServer.getPlayers()) @@ -886,7 +886,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.Reviewing) + if (_state != SpeedBuilderState.REVIEWING) return; Manager.runSyncLater(new Runnable() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java index b379a034a..67b86616a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java @@ -2,9 +2,9 @@ package nautilus.game.arcade.game.games.speedbuilder; public enum SpeedBuilderState { - - Viewing, - Building, - Reviewing; + + VIEWING, + BUILDING, + REVIEWING; } From 0ff87cf13438331aa65c1caf4594eda23ac35614 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 9 Dec 2015 21:14:45 -0500 Subject: [PATCH 24/99] Stuff. --- .../game/games/speedbuilder/SpeedBuilder.java | 64 ++++++++++++++----- 1 file changed, 49 insertions(+), 15 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 266afc399..87ad7c2be 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 @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; +import java.util.HashSet; import java.util.Map.Entry; import mineplex.core.common.util.C; @@ -85,6 +86,7 @@ public class SpeedBuilder extends SoloGame private ArmorStand _judgeEntity; private DisguiseGuardian _judgeDisguise; private Location _judgeSpawn; + private ArmorStand _judgeLaserHelper; private ArmorStand _judgeLaserTarget; private ArrayList _toEliminate = new ArrayList(); @@ -123,7 +125,7 @@ public class SpeedBuilder extends SoloGame { _buildMiddle = WorldData.GetDataLocs("RED").get(0).clone().subtract(0.5, 0, 0.5); - _judgeSpawn = _buildMiddle.clone().add(0, 5, 0); + _judgeSpawn = _buildMiddle.clone().add(0.5, 5, 0.5); Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); @@ -250,13 +252,13 @@ public class SpeedBuilder extends SoloGame { if (_judgeLaserTarget == null) return; - - _judgeDisguise.setTarget(0); - - Manager.GetDisguise().updateDisguise(_judgeDisguise); - + + Manager.GetDisguise().undisguise(_judgeLaserHelper); + + _judgeLaserHelper.remove(); _judgeLaserTarget.remove(); - + + _judgeLaserHelper = null; _judgeLaserTarget = null; } else @@ -265,21 +267,28 @@ public class SpeedBuilder extends SoloGame judgeTargetLocation(null); CreatureAllowOverride = true; - + + _judgeLaserHelper = _judgeEntity.getWorld().spawn(_judgeEntity.getLocation().subtract(_judgeEntity.getLocation().getDirection()), ArmorStand.class); _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); CreatureAllowOverride = false; + + _judgeLaserHelper.setVisible(false); + _judgeLaserHelper.setGravity(false); + _judgeLaserHelper.setSmall(true); _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); _judgeLaserTarget.setSmall(true); - _judgeLaserTarget.setGhost(true); UtilEnt.CreatureLook(_judgeEntity, _judgeLaserTarget.getLocation()); + + DisguiseGuardian disguise = new DisguiseGuardian(_judgeLaserHelper); - _judgeDisguise.setTarget(_judgeLaserTarget.getEntityId()); + disguise.setTarget(_judgeLaserTarget.getEntityId()); + disguise.setInvisible(true); - Manager.GetDisguise().updateDisguise(_judgeDisguise); + Manager.GetDisguise().disguise(disguise); } } @@ -636,6 +645,18 @@ public class SpeedBuilder extends SoloGame { recreation.pasteBuildData(_currentBuild); } + + Location specLocation = GetSpectatorLocation(); + double avgDist = 0; + + //Add up all the distances + for (Location loc : GetTeamList().get(0).GetSpawns()) + { + avgDist += UtilMath.offset2d(specLocation, loc); + } + + //Get the average by dividing + avgDist /= GetTeamList().get(0).GetSpawns().size(); for (Player player : UtilServer.getPlayers()) { @@ -648,8 +669,16 @@ public class SpeedBuilder extends SoloGame { player.setAllowFlight(true); player.setFlying(true); + + Location toTeleport = specLocation.clone(); + + //Spread players by getting a random x and z in that radius + toTeleport.setX(toTeleport.getX() + (Math.random() * avgDist * 2 - avgDist)); + toTeleport.setZ(toTeleport.getZ() + (Math.random() * avgDist * 2 - avgDist)); + + toTeleport.setDirection(UtilAlg.getTrajectory(toTeleport, _buildMiddle.clone().add(0.5, 0, 0.5))); - player.teleport(GetSpectatorLocation()); + player.teleport(toTeleport); } } @@ -689,9 +718,14 @@ public class SpeedBuilder extends SoloGame WorldData.World.playEffect(eliminating.getMidpoint(), Effect.EXPLOSION_HUGE, 0); WorldData.World.playSound(eliminating.getMidpoint(), Sound.EXPLODE, 10F, 1F); - - Manager.GetExplosion().BlockExplosion(eliminating.getBlocks(), eliminating.getMidpoint(), false, false); - + + HashSet blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), null, 1000); + + //Sets should remove duplicates + blocks.addAll(eliminating.getBlocks()); + + Manager.GetExplosion().BlockExplosion(blocks, eliminating.getMidpoint(), false, true); + eliminating.clearBuildArea(true); judgeTargetLocation(null); From 9b53e15b4f18275e66af9dc7d564e0f6d3acb1c6 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 9 Dec 2015 21:38:00 -0500 Subject: [PATCH 25/99] More stuff. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 87ad7c2be..3d9a2dc30 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 @@ -719,7 +719,7 @@ public class SpeedBuilder extends SoloGame WorldData.World.playEffect(eliminating.getMidpoint(), Effect.EXPLOSION_HUGE, 0); WorldData.World.playSound(eliminating.getMidpoint(), Sound.EXPLODE, 10F, 1F); - HashSet blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), null, 1000); + HashSet blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), eliminating.OriginalBuildLocation.getBlock(), null, 2000, 7); //Sets should remove duplicates blocks.addAll(eliminating.getBlocks()); From 0e9d4017175c2443e5b6374b594cb606bf821552 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 9 Dec 2015 22:32:39 -0500 Subject: [PATCH 26/99] Restore block when break is cancelled because it can be in the air phase and not get restored. --- .../game/games/speedbuilder/data/DemolitionData.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 25b102303..45c3992e1 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 @@ -92,7 +92,12 @@ public class DemolitionData public void cancelBreak() { despawnHologram(); - + + for (Block block : Blocks.keySet()) + { + Blocks.get(block).update(true, false); + } + Parent.BlocksForDemolition.remove(this); } From 68360c6705c27a50b39d60093c9526930f172ef3 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 10 Dec 2015 22:17:10 -0500 Subject: [PATCH 27/99] shortened if --- .../arcade/game/games/speedbuilder/data/RecreationData.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 45ef62369..ad8e985af 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 @@ -219,7 +219,10 @@ public class RecreationData { for (int z = 0; z < 5; z++) { - if (buildData.Build[x][y][z].getType() == CornerA.clone().add(x, y, z).getBlock().getType() && buildData.Build[x][y][z].getRawData() == CornerA.clone().add(x, y, z).getBlock().getData()) + Block currentBlock = CornerA.clone().add(x, y, z).getBlock(); + BlockState expectedState = buildData.Build[x][y][z]; + + if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData()) score++; } } From 2a45018fcd8224bfa4ebcb1f1a8e6b24f76113b9 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Fri, 11 Dec 2015 23:41:46 -0500 Subject: [PATCH 28/99] array thing --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3d9a2dc30..3493e16dc 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 @@ -799,7 +799,7 @@ public class SpeedBuilder extends SoloGame if (_buildCountStage == _buildTime) UtilTextMiddle.display("", C.cRed + "TIME'S UP!", 0, 30, 10); else if (_buildCountStage >= _buildTime - 5) - UtilTextMiddle.display("", C.cGreen + (_buildTime - _buildCountStage), 0, 30, 10, players.toArray(new Player[0])); + UtilTextMiddle.display("", C.cGreen + (_buildTime - _buildCountStage), 0, 30, 10, players.toArray(new Player[players.size()])); _buildCountStage++; } From ec86cad7ee159c0a13195478a44217d90797bbd9 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 13 Dec 2015 01:38:38 -0500 Subject: [PATCH 29/99] Changed descriptions. --- .../arcade/game/games/speedbuilder/SpeedBuilder.java | 9 +++++---- .../arcade/game/games/speedbuilder/data/BuildData.java | 5 ++++- .../game/games/speedbuilder/data/RecreationData.java | 9 +++++++++ .../arcade/game/games/speedbuilder/kits/DefaultKit.java | 4 ++-- 4 files changed, 20 insertions(+), 7 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 3493e16dc..00cc402eb 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 @@ -104,8 +104,9 @@ public class SpeedBuilder extends SoloGame }, new String[] { - "This is here because", - "I got tired of seeing '......'" + "Re-create the build shown to you.", + "The least correct build is eliminated.", + "Last person left wins!" }); Damage = false; @@ -363,7 +364,7 @@ public class SpeedBuilder extends SoloGame setSpeedBuilderState(SpeedBuilderState.VIEWING); } - + @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { @@ -880,7 +881,7 @@ public class SpeedBuilder extends SoloGame { event.setCancelled(true); } - + @EventHandler public void judgeStaring(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java index 067e508af..349767071 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.speedbuilder.data; import org.bukkit.Location; +import org.bukkit.block.Block; import org.bukkit.block.BlockState; public class BuildData @@ -29,7 +30,9 @@ public class BuildData { for (int z = 0; z < 5; z++) { - Build[x][y][z] = buildMin.clone().add(x, y, z).getBlock().getState(); + Block block = buildMin.clone().add(x, y, z).getBlock(); + + Build[x][y][z] = block.getState(); } } } 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 ad8e985af..0785f2604 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 @@ -19,6 +19,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; import org.bukkit.material.Door; +import org.bukkit.material.Stairs; public class RecreationData { @@ -223,7 +224,15 @@ public class RecreationData BlockState expectedState = buildData.Build[x][y][z]; if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData()) + { score++; + continue; + } + + if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) + { + //TODO + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java index 687115c04..e59573a41 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java @@ -13,10 +13,10 @@ public class DefaultKit extends Kit public DefaultKit(ArcadeManager manager) { - super(manager, "Default", KitAvailability.Free, + super(manager, "Speed Builder", KitAvailability.Free, new String[] { - "Nothing special to it.", + "Professional build re-creator!", }, new Perk[] { From 12eba41975c298cab044dcd9d1ea1f35644c5c32 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 13 Dec 2015 19:52:32 -0500 Subject: [PATCH 30/99] Fixed corner stairs. --- .../games/speedbuilder/data/BuildData.java | 23 ++++++++++++++++++- .../speedbuilder/data/RecreationData.java | 20 ++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java index 349767071..898c7c519 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java @@ -1,8 +1,16 @@ package nautilus.game.arcade.game.games.speedbuilder.data; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.BlockStairs; +import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape; +import net.minecraft.server.v1_8_R3.IBlockData; + import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.material.Stairs; public class BuildData { @@ -10,6 +18,9 @@ public class BuildData public BlockState[][][] Build = new BlockState[5][5][5]; public BlockState[][] Ground = new BlockState[5][5]; + //Store stair shapes for stair fix + public EnumStairShape[][][] StairShapes = new EnumStairShape[5][5][5]; + public BuildData(Location loc) { Location groundMin = loc.clone().add(-2, 2, -2); @@ -33,9 +44,19 @@ public class BuildData Block block = buildMin.clone().add(x, y, z).getBlock(); Build[x][y][z] = block.getState(); + + if (block.getState().getData() instanceof Stairs) + { + net.minecraft.server.v1_8_R3.Block nmsBlock = CraftMagicNumbers.getBlock(block); + + IBlockData blockData = nmsBlock.getBlockData(); + blockData = nmsBlock.updateState(blockData, ((CraftWorld) block.getWorld()).getHandle(), new BlockPosition(block.getX(), block.getY(), block.getZ())); + + StairShapes[x][y][z] = blockData.get(BlockStairs.SHAPE); + } } } } } - + } 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 0785f2604..3d3c54c8f 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 @@ -7,6 +7,10 @@ import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.BlockStairs; +import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape; +import net.minecraft.server.v1_8_R3.IBlockData; import org.bukkit.Effect; import org.bukkit.Location; @@ -14,6 +18,8 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -228,10 +234,20 @@ public class RecreationData score++; continue; } - + + //Fix for corner stair shape if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) { - //TODO + net.minecraft.server.v1_8_R3.Block nmsBlock = CraftMagicNumbers.getBlock(currentBlock); + + IBlockData blockData = nmsBlock.getBlockData(); + blockData = nmsBlock.updateState(blockData, ((CraftWorld) currentBlock.getWorld()).getHandle(), new BlockPosition(currentBlock.getX(), currentBlock.getY(), currentBlock.getZ())); + + EnumStairShape expectedShape = buildData.StairShapes[x][y][z]; + EnumStairShape currentShape = blockData.get(BlockStairs.SHAPE); + + if ((expectedShape == EnumStairShape.INNER_LEFT && currentShape == EnumStairShape.INNER_RIGHT) || (expectedShape == EnumStairShape.INNER_RIGHT && currentShape == EnumStairShape.INNER_LEFT) || (expectedShape == EnumStairShape.OUTER_LEFT && currentShape == EnumStairShape.OUTER_RIGHT) || (expectedShape == EnumStairShape.OUTER_RIGHT && currentShape == EnumStairShape.OUTER_LEFT)) + score++; } } } From d8f44434ff63d43aec6f6c30ddc3ce92a721773f Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 14 Dec 2015 00:00:40 -0500 Subject: [PATCH 31/99] Fixed a bunch of bugs. Still need to fix clicking compass ending game. --- .../game/games/speedbuilder/SpeedBuilder.java | 76 ++++++++++++++++--- .../speedbuilder/data/RecreationData.java | 12 ++- 2 files changed, 75 insertions(+), 13 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 00cc402eb..5d2201152 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 @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Map.Entry; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; @@ -54,10 +55,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.material.Bed; import org.bukkit.util.Vector; @@ -348,7 +350,7 @@ public class SpeedBuilder extends SoloGame return; } - _currentBuild = UtilAlg.Random(_buildData); + _currentBuild = _buildData.get(_build); for (Player player : GetPlayers(true)) { @@ -520,7 +522,7 @@ public class SpeedBuilder extends SoloGame @EventHandler public void stopGuardiansBuildEnter(UpdateEvent event) { - if (event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.FASTER) return; if (!IsLive()) @@ -530,8 +532,13 @@ public class SpeedBuilder extends SoloGame { for (RecreationData recreation : _buildRecreations.values()) { + Vector vec = player.getLocation().getDirection().multiply(-1); + if (UtilMath.offsetSquared(player.getLocation(), recreation.getMidpoint()) < 64) - UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1)); + { + player.playSound(player.getEyeLocation(), Sound.NOTE_PLING, 10F, 0.5F); + UtilAction.velocity(player, vec, 1.6, false, 0, 0.4, vec.length(), false); + } } } } @@ -916,22 +923,67 @@ public class SpeedBuilder extends SoloGame } @EventHandler - public void stopJudgeUnspec(final PlayerToggleSneakEvent event) + public void stopJudgeUnspec(UpdateEvent event) { + if (event.getType() != UpdateType.TICK) + return; + if (!IsLive()) return; if (_state != SpeedBuilderState.REVIEWING) return; - Manager.runSyncLater(new Runnable() + for (Player player : UtilServer.getPlayers()) { - @Override - public void run() - { - event.getPlayer().setSpectatorTarget(_judgeEntity); - } - }, 1L); + player.setGameMode(GameMode.SPECTATOR); + player.setSpectatorTarget(_judgeEntity); + } + } + + @EventHandler + public void stopGuardianSpecPickup(PlayerPickupItemEvent event) + { + if (GetState().ordinal() < GameState.Prepare.ordinal()) + return; + + if (Manager.isSpectator(event.getPlayer()) || GetTeamList().get(1).HasPlayer(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void stopGuardianSpecPlace(BlockPlaceEvent event) + { + if (GetState().ordinal() < GameState.Prepare.ordinal()) + return; + + if (Manager.isSpectator(event.getPlayer()) || GetTeamList().get(1).HasPlayer(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void stopEntityChangeBlock(EntityChangeBlockEvent event) + { + event.setCancelled(true); + } + + private int _build; + + @EventHandler + public void setBuild(PlayerCommandPreprocessEvent event) + { + if (GetState() != GameState.Recruit) + return; + + if (!event.getMessage().startsWith("/setbuild ")) + return; + + if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.SNR_MODERATOR)) + return; + + _build = Integer.parseInt(event.getMessage().split(" ")[1]); + + Announce(F.main("Build", "BUILD SET TO " + C.mElem + _build)); } @Override 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 3d3c54c8f..3aef94868 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 @@ -18,6 +18,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; +import org.bukkit.block.Skull; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; @@ -228,13 +229,22 @@ public class RecreationData { Block currentBlock = CornerA.clone().add(x, y, z).getBlock(); BlockState expectedState = buildData.Build[x][y][z]; - + if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData()) { score++; continue; } + //Sapling growth fix + if (expectedState.getType() == Material.SAPLING && currentBlock.getType() == Material.SAPLING) + { + if (currentBlock.getData() % 8 == expectedState.getRawData() % 8) + score++; + + Game.Announce("SPECIAL SAPLING CHECK = " + (currentBlock.getData() % 8 == expectedState.getRawData() % 8)); + } + //Fix for corner stair shape if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) { From 93c13d138dbbad56b020b2d582273aa00705930a Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 14 Dec 2015 00:10:45 -0500 Subject: [PATCH 32/99] Remove some debug stuff I forgot to remove. --- .../game/games/speedbuilder/SpeedBuilder.java | 23 +------------------ .../speedbuilder/data/RecreationData.java | 3 --- 2 files changed, 1 insertion(+), 25 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 5d2201152..2f833d6af 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 @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Map.Entry; -import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; @@ -56,7 +55,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -350,7 +348,7 @@ public class SpeedBuilder extends SoloGame return; } - _currentBuild = _buildData.get(_build); + _currentBuild = UtilAlg.Random(_buildData); for (Player player : GetPlayers(true)) { @@ -967,25 +965,6 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } - private int _build; - - @EventHandler - public void setBuild(PlayerCommandPreprocessEvent event) - { - if (GetState() != GameState.Recruit) - return; - - if (!event.getMessage().startsWith("/setbuild ")) - return; - - if (!Manager.GetClients().hasRank(event.getPlayer(), Rank.SNR_MODERATOR)) - return; - - _build = Integer.parseInt(event.getMessage().split(" ")[1]); - - Announce(F.main("Build", "BUILD SET TO " + C.mElem + _build)); - } - @Override public void EndCheck() { 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 3aef94868..c09d06275 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 @@ -18,7 +18,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; -import org.bukkit.block.Skull; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; @@ -241,8 +240,6 @@ public class RecreationData { if (currentBlock.getData() % 8 == expectedState.getRawData() % 8) score++; - - Game.Announce("SPECIAL SAPLING CHECK = " + (currentBlock.getData() % 8 == expectedState.getRawData() % 8)); } //Fix for corner stair shape From 628ee8a13790a109e5f11e4a48cebfaac644498f Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Wed, 16 Dec 2015 00:02:21 -0500 Subject: [PATCH 33/99] Some small fixes. --- .../game/games/speedbuilder/SpeedBuilder.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 2f833d6af..a2c06a9a1 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 @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Map.Entry; import mineplex.core.common.util.C; @@ -269,7 +270,7 @@ public class SpeedBuilder extends SoloGame CreatureAllowOverride = true; - _judgeLaserHelper = _judgeEntity.getWorld().spawn(_judgeEntity.getLocation().subtract(_judgeEntity.getLocation().getDirection()), ArmorStand.class); + _judgeLaserHelper = _judgeEntity.getWorld().spawn(_judgeEntity.getLocation().subtract(_judgeEntity.getLocation().getDirection().multiply(2)), ArmorStand.class); _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); CreatureAllowOverride = false; @@ -999,6 +1000,21 @@ public class SpeedBuilder extends SoloGame } } + @Override + public List getLosers() + { + List winners = getWinners(); + + if (winners == null) + return null; + + List losers = GetTeamList().get(1).GetPlayers(false); + + losers.removeAll(winners); + + return losers; + } + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) From 5f506e38103f0c3cc02908a7b9b14c104f4ff581 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 17 Dec 2015 21:49:15 -0500 Subject: [PATCH 34/99] Moved team generation. --- .../game/games/speedbuilder/SpeedBuilder.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 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 a2c06a9a1..ca9fb9c37 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 @@ -313,6 +313,17 @@ public class SpeedBuilder extends SoloGame EndCheck(); } + @EventHandler(priority = EventPriority.MONITOR) + public void teamGen(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + GameTeam guardians = new GameTeam(this, "Guardians", ChatColor.GRAY, new ArrayList()); + + AddTeam(guardians); + } + @EventHandler(priority = EventPriority.LOWEST) public void onPrepare(GameStateChangeEvent event) { @@ -322,8 +333,6 @@ public class SpeedBuilder extends SoloGame spawnJudge(); //GUARDIAN LAZORZ WILL ROXORZ YOUR BOXORZ - AddTeam(new GameTeam(this, "Guardians", ChatColor.GRAY, new ArrayList())); - ArrayList players = GetPlayers(true); for (int i = 0; i < players.size(); i++) From c0ab31fdac7e66fd5dd094b45218f13cbc3bc385 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 19 Dec 2015 00:19:50 -0500 Subject: [PATCH 35/99] Finished up fixes. --- .../game/games/speedbuilder/SpeedBuilder.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 ca9fb9c37..386e3c6fe 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 @@ -25,6 +25,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -120,6 +121,8 @@ public class SpeedBuilder extends SoloGame DeathMessages = false; FixSpawnFacing = false; + + AllowParticles = false; } @Override @@ -343,6 +346,8 @@ public class SpeedBuilder extends SoloGame GetTeamList().get(0).RemovePlayer(players.get(i)); } } + + Manager.getCosmeticManager().setHideParticles(true); } @EventHandler @@ -374,6 +379,15 @@ public class SpeedBuilder extends SoloGame setSpeedBuilderState(SpeedBuilderState.VIEWING); } + + @EventHandler + public void onEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End && event.GetState() != GameState.Dead) + return; + + Manager.getCosmeticManager().setHideParticles(false); + } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) @@ -609,6 +623,8 @@ public class SpeedBuilder extends SoloGame player.setGameMode(GameMode.SPECTATOR); player.setSpectatorTarget(_judgeEntity); + Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); + PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(10, 0.0F); UtilPlayer.sendPacket(player, packet); } @@ -678,6 +694,8 @@ public class SpeedBuilder extends SoloGame { player.setGameMode(GameMode.SURVIVAL); + Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Guardian POV"); + if (_buildRecreations.containsKey(player)) player.teleport(_buildRecreations.get(player).PlayerSpawn); @@ -946,6 +964,9 @@ public class SpeedBuilder extends SoloGame { player.setGameMode(GameMode.SPECTATOR); player.setSpectatorTarget(_judgeEntity); + + if (!Manager.GetCondition().HasCondition(player, ConditionType.CLOAK, "Guardian POV")) + Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); } } From fe658b30a1d8bd5927ab7d6d06f0ed9d98588ac3 Mon Sep 17 00:00:00 2001 From: fooify Date: Sat, 19 Dec 2015 15:03:42 -0800 Subject: [PATCH 36/99] Grammatical errors hath been fixed! --- .../Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java | 2 +- .../src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java | 2 +- .../src/mineplex/core/gadget/gadgets/hat/HatRudolph.java | 2 +- .../src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java | 2 +- .../src/mineplex/core/mount/types/MountBabyReindeer.java | 2 +- .../nautilus/game/arcade/game/games/christmas/parts/Part.java | 2 +- .../nautilus/game/arcade/game/games/christmas/parts/Part5.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 76077f8f6..2adf3548e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -165,7 +165,7 @@ public class Menu extends ShopPageBase if (enabled.containsKey(type)) addGlow(gadgetSlot); type = GadgetType.Morph; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Ever want to be a tiger? Well, you can’t be a tiger! That’s silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Ever want to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(morphSlot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java index a6ccbda55..58bb91a1b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/DeathCandyCane.java @@ -19,7 +19,7 @@ public class DeathCandyCane extends DeathEffectGadget public DeathCandyCane(GadgetManager manager) { super(manager, "Candy Cane Remains", - UtilText.splitLineToArray(C.cGray + "The biggest enemy of the Holidays, is January.", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "The biggest enemy of the Holidays is January.", LineFormat.LORE), -3, Material.INK_SACK, (byte)1); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java index 1dfd9fa5c..9979aec81 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java @@ -13,7 +13,7 @@ public class HatRudolph extends HatGadget public HatRudolph(GadgetManager manager) { super(manager, "Rudolph", - UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.RUDOLPH.getSkull()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java index 92da2218c..c3ea07224 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemPartyPopper.java @@ -32,7 +32,7 @@ public class ItemPartyPopper extends ItemGadget implements IThrown public ItemPartyPopper(GadgetManager manager) { super(manager, "Party Popper", - UtilText.splitLineToArray(C.cWhite + "Celebrate by blasting confetti into peoples eyes!", LineFormat.LORE), + UtilText.splitLineToArray(C.cWhite + "Celebrate by blasting confetti into peoples' eyes!", LineFormat.LORE), 1, Material.GOLDEN_CARROT, (byte) 0, 1000, new Ammo("Party Popper", "1 Party Popper", Material.GOLDEN_CARROT, (byte) 0, new String[] { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java index 64e56f971..da0c765bc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountBabyReindeer.java @@ -32,7 +32,7 @@ public class MountBabyReindeer extends HorseMount public MountBabyReindeer(MountManager manager) { super(manager, "Baby Reindeer", - UtilText.splitLineToArray(C.cGray + "One of Santas baby reindeers. He's still learning how to fly...", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "One of Santa's baby reindeers. He's still learning how to fly...", LineFormat.LORE), Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index ea8e171cc..80c3a276e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -223,7 +223,7 @@ public abstract class Part implements Listener Host.GetSleigh().AddPresent(present.getBlock().getLocation()); - Host.SantaSay("Well done " + event.getPlayer().getName() + "! You collected a present!", null); + Host.SantaSay("Well done, " + event.getPlayer().getName() + "! You collected a present!", null); } public void SetObjectiveText(String text, double percent) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java index 2dceaca60..b91aa0d13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java @@ -143,7 +143,7 @@ public class Part5 extends Part _a = true; _dialogueDelay = System.currentTimeMillis(); - Host.SantaSay("WHAT IS THIS?! Who's castle is this?!", ChristmasAudio.BANTER_A); + Host.SantaSay("WHAT IS THIS?! Whose castle is this?!", ChristmasAudio.BANTER_A); } else if (_a && !_b && UtilTime.elapsed(_dialogueDelay, _delayTime)) { From a8d99568468b07e5e1e5a04e5e544f03380e8621 Mon Sep 17 00:00:00 2001 From: fooify Date: Tue, 22 Dec 2015 10:35:20 -0800 Subject: [PATCH 37/99] more grammatical errors hast been fixed --- .../core/gadget/gadgets/particle/ParticleCandyCane.java | 2 +- .../core/gadget/gadgets/particle/ParticleFrostLord.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java index d36ca5021..9f72c5a2f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java @@ -29,7 +29,7 @@ public class ParticleCandyCane extends ParticleGadget public ParticleCandyCane(GadgetManager manager) { super(manager, "Crushed Candy Cane", - UtilText.splitLineToArray(C.cGray + "There’s no such thing as too much Christmas Candy. Don’t listen to your dentist.", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "There’s no such thing as too much Christmas Candy. Don't listen to your dentist.", LineFormat.LORE), -3, Material.INK_SACK, (byte)1); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java index 035615c59..aaaa4d79c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFrostLord.java @@ -28,7 +28,7 @@ public class ParticleFrostLord extends ParticleGadget public ParticleFrostLord(GadgetManager manager) { super(manager, "Wind of the Frost Lord", - UtilText.splitLineToArray(C.cGray + "He’s not passing wind okay? HE HAS A CONDITION!", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "He's not passing wind, okay? HE HAS A CONDITION!", LineFormat.LORE), -3, Material.SNOW_BALL, (byte)0, "Frost Lord"); } From 255dd0bdb36f04ad2a7bfd3652a016c45db195f2 Mon Sep 17 00:00:00 2001 From: fooify Date: Tue, 22 Dec 2015 11:02:37 -0800 Subject: [PATCH 38/99] fixed cosmetic menu item dropping bug --- .../src/mineplex/core/cosmetic/CosmeticManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 9394628ae..3afb1ae7e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -108,7 +108,7 @@ public class CosmeticManager extends MiniPlugin if (event.getPlayer().isOnline()) { event.getPlayer().getInventory().remove(Material.CHEST); - event.getPlayer().getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Inventory Menu")); + event.getPlayer().getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Cosmetic Menu")); event.getPlayer().updateInventory(); } } From 0ac2158988e0196cbc732ee799e98e5eb5ace563 Mon Sep 17 00:00:00 2001 From: fooify Date: Tue, 22 Dec 2015 11:02:57 -0800 Subject: [PATCH 39/99] i before e! --- .../src/mineplex/core/gadget/gadgets/hat/HatCoal.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java index 7897272a8..c83e00ed4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatCoal.java @@ -15,7 +15,7 @@ public class HatCoal extends HatGadget public HatCoal(GadgetManager manager) { super(manager, "Lump of Coal Hat", - UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a wierd cube hat out it!", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, new ItemStack(Material.COAL_BLOCK)); } From 41f56e9853f8cc0c9e03949bb8bd2d94b594f955 Mon Sep 17 00:00:00 2001 From: fooify Date: Thu, 24 Dec 2015 11:13:54 -0800 Subject: [PATCH 40/99] Lots of typo fixes and such --- .../src/mineplex/core/cosmetic/ui/page/Menu.java | 2 +- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 2 +- .../core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java | 2 +- .../core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java | 2 +- .../src/mineplex/core/gadget/gadgets/hat/HatGrinch.java | 2 +- .../src/mineplex/core/gadget/gadgets/hat/HatPresent.java | 2 +- .../src/mineplex/core/gadget/gadgets/hat/HatRudolph.java | 2 +- .../src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java | 2 +- .../src/mineplex/core/gadget/gadgets/morph/MorphBunny.java | 6 +++--- .../src/mineplex/core/gadget/gadgets/morph/MorphSlime.java | 2 +- .../src/mineplex/core/gadget/gadgets/morph/MorphTitan.java | 2 +- .../core/gadget/gadgets/particle/ParticleCandyCane.java | 2 +- .../core/gadget/gadgets/particle/ParticleEnchant.java | 2 +- .../core/gadget/gadgets/particle/ParticleGreen.java | 2 +- .../core/gadget/gadgets/particle/ParticleHelix.java | 2 +- .../nautilus/game/arcade/game/games/typewars/Minion.java | 2 +- 16 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 2adf3548e..7671463cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -165,7 +165,7 @@ public class Menu extends ShopPageBase if (enabled.containsKey(type)) addGlow(gadgetSlot); type = GadgetType.Morph; - lore = getLore(ownedCount.get(type), maxCount.get(type), "Ever want to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(morphSlot); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 4e796c47e..114b700ce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -193,7 +193,7 @@ public class PetPage extends ShopPageBase } else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER) { - addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Coins", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); + addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); } slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java index ec6b33ba6..d528c4a7c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailCandyCane.java @@ -20,7 +20,7 @@ public class ArrowTrailCandyCane extends ArrowEffectGadget public ArrowTrailCandyCane(GadgetManager manager) { super(manager, "Candy Cane Arrows", - UtilText.splitLineToArray(C.cGray + "The real reason no one visits the North Pole? Santa’s Elves are deadly shots.", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "The real reason no one visits the North Pole? Santa's Elves are deadly shots.", LineFormat.LORE), -3, Material.INK_SACK, (byte)1); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java index 171860cd5..3a7c910b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailFrostLord.java @@ -18,7 +18,7 @@ public class ArrowTrailFrostLord extends ArrowEffectGadget public ArrowTrailFrostLord(GadgetManager manager) { super(manager, "Arrows of the Frost Lord", - UtilText.splitLineToArray(C.cGray + "The Frost Lord’s arrows bring a blast of winter in the wind of their passing.", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "The Frost Lord's arrows bring a blast of winter in the wind of their passing.", LineFormat.LORE), -3, Material.SNOW_BALL, (byte)0, "Frost Lord"); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java index 9ef68b04a..747d969d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatGrinch.java @@ -13,7 +13,7 @@ public class HatGrinch extends HatGadget public HatGrinch(GadgetManager manager) { super(manager, "The Grinch", - UtilText.splitLineToArray(C.cGray + "Great! Now where’s the Roast Beast?!", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH.getSkull(), "The Grinch Hat"); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java index e92b2b398..12ccc8db2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatPresent.java @@ -13,7 +13,7 @@ public class HatPresent extends HatGadget public HatPresent(GadgetManager manager) { super(manager, "Present", - UtilText.splitLineToArray(C.cGray + "WHAT IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT.getSkull()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java index 9979aec81..574508d1e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatRudolph.java @@ -13,7 +13,7 @@ public class HatRudolph extends HatGadget public HatRudolph(GadgetManager manager) { super(manager, "Rudolph", - UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH.getSkull()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java index d0039cd87..1f9f69217 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoinBomb.java @@ -38,7 +38,7 @@ public class ItemCoinBomb extends ItemGadget public ItemCoinBomb(GadgetManager manager) { super(manager, "Treasure Party Bomb", - UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyones favourite player when you use one of these!", LineFormat.LORE), + UtilText.splitLineToArray(C.cWhite + "It's party time! You'll be everyone's favourite player when you use one of these!", LineFormat.LORE), -1, Material.PRISMARINE, (byte)0, 30000, new Ammo("Treasure Party Bomb", "1 Coin Party Bomb", Material.PRISMARINE, (byte)0, new String[] { C.cWhite + "1 Treasure Party Bomb" }, 2000, 1)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index 55f67dc0d..50d789985 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -59,7 +59,7 @@ public class MorphBunny extends MorphGadget "#" + C.cWhite + "Charge Crouch to use Super Jump", "#" + C.cWhite + "Left Click to use Hide Easter Egg", C.blankLine, - "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" , + "#" + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Shards" , }, LineFormat.LORE), -5, Material.MONSTER_EGG, (byte)98); @@ -154,7 +154,7 @@ public class MorphBunny extends MorphGadget if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Coins) < 500) { - UtilPlayer.message(player, F.main("Gadget", "You do not have enough Coins.")); + UtilPlayer.message(player, F.main("Gadget", "You do not have enough Shards.")); return; } @@ -183,7 +183,7 @@ public class MorphBunny extends MorphGadget ChatColor.RESET + C.Bold + " hid an " + C.cYellow + C.Bold + "Easter Egg" + ChatColor.RESET + C.Bold + " worth " + - C.cYellow + C.Bold + "450 Coins"); + C.cYellow + C.Bold + "450 Shards"); for (Player other : UtilServer.getPlayers()) other.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 7a8430173..7e539bf90 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -29,7 +29,7 @@ public class MorphSlime extends MorphGadget { super(manager, "Big Larry Morph", UtilText.splitLinesToArray(new String[] { - C.cGray + "Have you ever looked at Big Larry and thought, \'I really want to be that guy!\'? Well, today is your lucky day!", + C.cGray + "Have you ever looked at Big Larry and thought, \'I really want to be that guy\'!? Well, today is your lucky day!", C.blankLine, "#" + C.cWhite + "Left Click to use Bounce", C.blankLine, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index 13fe0ee14..68091b674 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -46,7 +46,7 @@ public class MorphTitan extends MorphGadget { super(manager, "Elder Guardian Morph", UtilText.splitLinesToArray(new String[] { - C.cGray + "From the depths of the sea, the Elder Guardian posseses powers more amazing than any seen before!", + C.cGray + "From the depths of the sea, the Elder Guardian possesses powers more amazing than any seen before!", C.blankLine, "#" + C.cWhite + "Left-Click to use Guardians Laser", }, LineFormat.LORE), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java index 9f72c5a2f..2d9c8c8c7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleCandyCane.java @@ -29,7 +29,7 @@ public class ParticleCandyCane extends ParticleGadget public ParticleCandyCane(GadgetManager manager) { super(manager, "Crushed Candy Cane", - UtilText.splitLineToArray(C.cGray + "There’s no such thing as too much Christmas Candy. Don't listen to your dentist.", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "There's no such thing as too much Christmas Candy. Don't listen to your dentist.", LineFormat.LORE), -3, Material.INK_SACK, (byte)1); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java index 230705505..43319483c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleEnchant.java @@ -22,7 +22,7 @@ public class ParticleEnchant extends ParticleGadget public ParticleEnchant(GadgetManager manager) { super(manager, "Enchanted", - UtilText.splitLineToArray(C.cGray + "The wisdom of the universe suddenly find you extremely attractive, and wants to \'enchant\' you.", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "The wisdom of the universe suddenly finds you extremely attractive, and wants to \'enchant\' you.", LineFormat.LORE), -2, Material.BOOK, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java index a9bd2739d..68304788a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleGreen.java @@ -24,7 +24,7 @@ public class ParticleGreen extends ParticleGadget public ParticleGreen(GadgetManager manager) { super(manager, "Green Ring", - UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkle with CaptainSparklez!", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkling with CaptainSparklez!", LineFormat.LORE), -2, Material.EMERALD, (byte)0); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java index a9336927b..9e33bdc52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleHelix.java @@ -24,7 +24,7 @@ public class ParticleHelix extends ParticleGadget public ParticleHelix(GadgetManager manager) { super(manager, "Blood Helix", - UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous... but also very cool!", LineFormat.LORE), + UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous...but also very cool!", LineFormat.LORE), -2, Material.REDSTONE, (byte)0); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index b4c4832cf..91d05aef2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -122,7 +122,7 @@ public class Minion "Purpose", "Symptom", "Sticks", "Measure", "Slimes", "Greece", "Spooky", "Coffee", "Aliens", "Cities", "Bikini", "Mortal", "Serena", "Future", "Bottle", "Helmet", "Crunch", "Afraid", "Threat", "Static", "Happy", "Knife", "Scary", "Lapis", "Skirt", "Waves", "Calem", "Clock", "Taste", "Lucas", - "Anger", "Spork", "Maike", "Candy", "Shirt", "Tides", "Ocean", "Crawl", "Smell", "React", + "Anger", "Spork", "Make", "Candy", "Shirt", "Tides", "Ocean", "Crawl", "Smell", "React", "Dolls", "Roses", "Trips", "Flute", "Pants", "Brick", "Three", "Ethan", "Uncle", "Lunch", "Legos", "Tulip", "Beach", "Wipes", "Heels", "Straw", "Seven", "Hands", "Queen", "Books", "Couch", "Grass", "Clans", "Frame", "Nails", "Cream", "Eight", "Belly", "Crown", "Polls", From 162b3eb33fa5896770a9761d8c37d13f92de28e2 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 27 Dec 2015 14:34:24 -0500 Subject: [PATCH 41/99] Stopped a bunch of block events. --- .../game/games/speedbuilder/SpeedBuilder.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) 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 386e3c6fe..a587ae906 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 @@ -54,8 +54,15 @@ import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -996,6 +1003,54 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } + @EventHandler + public void stopBlockFade(BlockFadeEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopBlockBurn(BlockBurnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopLeavesDecay(LeavesDecayEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopBlockForm(BlockFormEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopBlockSpread(BlockSpreadEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopBlockFromTo(BlockFromToEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopBlockPhysics(BlockPhysicsEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void stopInteract(PlayerInteractEvent event) + { + event.setCancelled(true); + } + @Override public void EndCheck() { From 3d9a25286867904d6745457f0e366dbf37b87ce5 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 27 Dec 2015 15:26:43 -0500 Subject: [PATCH 42/99] Added auto pickup and fixed some stuff. --- .../game/games/speedbuilder/SpeedBuilder.java | 100 +++++++++++++++--- .../speedbuilder/data/DemolitionData.java | 4 +- .../speedbuilder/data/RecreationData.java | 5 +- 3 files changed, 88 insertions(+), 21 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 a587ae906..025bbc5cf 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 @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map.Entry; @@ -37,6 +38,7 @@ import nautilus.game.arcade.game.games.speedbuilder.data.DemolitionData; import nautilus.game.arcade.game.games.speedbuilder.data.RecreationData; import nautilus.game.arcade.game.games.speedbuilder.kits.DefaultKit; import nautilus.game.arcade.kit.Kit; +import net.minecraft.server.v1_8_R3.PacketPlayOutCollect; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; @@ -57,7 +59,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFormEvent; -import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPlaceEvent; @@ -460,10 +461,45 @@ public class SpeedBuilder extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBuildFinish(final BlockPlaceEvent event) { - if (event.isCancelled()) + if (_perfectBuild.containsKey(event.getPlayer())) + return; + + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.BUILDING) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == 125) + { + event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); + + UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, event.getPlayer()); + + Announce(F.main("Build", C.mElem + event.getPlayer().getName() + C.mBody + " got a perfect build!")); + + _perfectBuild.put(event.getPlayer(), System.currentTimeMillis()); + } + } + }, 1L); + } + + //This is here because if you open a door then close it you won't be informed of a perfect build + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void interactInformSuccess(PlayerInteractEvent event) + { + if (_perfectBuild.containsKey(event.getPlayer())) return; Manager.runSyncLater(new Runnable() @@ -503,12 +539,54 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; - if (_buildRecreations.get(event.getPlayer()).DroppedItems.contains(event.getItem())) + if (_buildRecreations.get(event.getPlayer()).DroppedItems.containsKey(event.getItem())) _buildRecreations.get(event.getPlayer()).DroppedItems.remove(event.getItem()); else event.setCancelled(true); } + @EventHandler + public void itemUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.BUILDING) + return; + + for (RecreationData recreation : _buildRecreations.values()) + { + Iterator> iterator = recreation.DroppedItems.entrySet().iterator(); + + while (iterator.hasNext()) + { + Entry entry = iterator.next(); + + if (!UtilTime.elapsed(entry.getValue(), 3000)) + continue; + + UtilInv.insert(recreation.Player, entry.getKey().getItemStack()); + + recreation.Player.playSound(recreation.Player.getEyeLocation(), Sound.ITEM_PICKUP, 1f, 1f); + + //Play pickup animation + PacketPlayOutCollect packet = new PacketPlayOutCollect(recreation.Player.getEntityId(), entry.getKey().getEntityId()); + + for (Player player : UtilServer.getPlayers()) + { + UtilPlayer.sendPacket(player, packet); + } + + entry.getKey().remove(); + + iterator.remove(); + } + } + } + @EventHandler public void stopMoveOffArea(UpdateEvent event) { @@ -609,7 +687,7 @@ public class SpeedBuilder extends SoloGame { for (RecreationData recreation : _buildRecreations.values()) { - for (Item item : recreation.DroppedItems) + for (Item item : recreation.DroppedItems.keySet()) { item.remove(); } @@ -1033,24 +1111,12 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } - @EventHandler - public void stopBlockFromTo(BlockFromToEvent event) - { - event.setCancelled(true); - } - @EventHandler public void stopBlockPhysics(BlockPhysicsEvent event) { event.setCancelled(true); } - @EventHandler - public void stopInteract(PlayerInteractEvent event) - { - event.setCancelled(true); - } - @Override public void EndCheck() { 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 45c3992e1..94508fc4a 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 @@ -24,7 +24,7 @@ public class DemolitionData public RecreationData Parent; public NautHashMap Blocks; - public Long Start; + public long Start; private Hologram _hologram; @@ -122,7 +122,7 @@ public class DemolitionData { Item item = block.getWorld().dropItem(block.getLocation().add(0.5, 0.5, 0.5), itemStack); - Parent.DroppedItems.add(item); + Parent.DroppedItems.put(item, System.currentTimeMillis()); } //Destroy the other part 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 c09d06275..e593bfac0 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 @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; @@ -43,7 +44,7 @@ public class RecreationData public Location PlayerSpawn; - public ArrayList DroppedItems = new ArrayList(); + public NautHashMap DroppedItems = new NautHashMap(); public ArrayList BlocksForDemolition = new ArrayList(); @@ -169,7 +170,7 @@ public class RecreationData { Item item = block.getWorld().dropItem(getMidpoint(), itemStack); - DroppedItems.add(item); + DroppedItems.put(item, System.currentTimeMillis()); } //Destroy the other part From 8a8d5b088b3389c99013b85f0752e7aeccf571c4 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 28 Dec 2015 16:48:03 -0500 Subject: [PATCH 43/99] Switch to 7x7 builds. --- .../game/games/speedbuilder/SpeedBuilder.java | 104 +++++------------- .../games/speedbuilder/data/BuildData.java | 28 +++-- .../speedbuilder/data/RecreationData.java | 32 +++--- 3 files changed, 62 insertions(+), 102 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 025bbc5cf..ee91d9c24 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 @@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.speedbuilder; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map.Entry; @@ -38,7 +37,6 @@ import nautilus.game.arcade.game.games.speedbuilder.data.DemolitionData; import nautilus.game.arcade.game.games.speedbuilder.data.RecreationData; import nautilus.game.arcade.game.games.speedbuilder.kits.DefaultKit; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_8_R3.PacketPlayOutCollect; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; @@ -60,7 +58,6 @@ import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFormEvent; import org.bukkit.event.block.BlockGrowEvent; -import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; @@ -74,6 +71,11 @@ import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame { + //Build Size and some other values used commonly + public int BuildSize = 7; + public int BuildSizeDiv2 = BuildSize / 2; + public int BuildSizeMin1 = BuildSize - 1; + public int BuildSizePow3 = BuildSize * BuildSize * BuildSize; private SpeedBuilderState _state = SpeedBuilderState.VIEWING; private long _stateTime = System.currentTimeMillis(); @@ -81,15 +83,15 @@ public class SpeedBuilder extends SoloGame private int _buildCountStage; private int _viewCountStage; - private int _buildTime = 25; - private int _viewTime = 6; + private int _buildTime = 40; + private int _viewTime = 8; private Location _buildMiddle; private ArrayList _buildData = new ArrayList(); private BuildData _currentBuild; - private BlockState[][] _defaultMiddleGround = new BlockState[5][5]; + private BlockState[][] _defaultMiddleGround = new BlockState[BuildSize][BuildSize]; private NautHashMap _buildRecreations = new NautHashMap(); @@ -138,13 +140,13 @@ public class SpeedBuilder extends SoloGame { _buildMiddle = WorldData.GetDataLocs("RED").get(0).clone().subtract(0.5, 0, 0.5); - _judgeSpawn = _buildMiddle.clone().add(0.5, 5, 0.5); + _judgeSpawn = _buildMiddle.clone().add(0.5, BuildSize, 0.5); - Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); + Location groundMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 1, BuildSizeDiv2); - for (int x = 0; x < 5; x++) + for (int x = 0; x < BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < BuildSize; z++) { _defaultMiddleGround[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); } @@ -152,7 +154,7 @@ public class SpeedBuilder extends SoloGame for (Location loc : WorldData.GetDataLocs("LIME")) { - _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5))); + _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5), this)); } for (Location loc : WorldData.GetDataLocs("YELLOW")) @@ -184,17 +186,17 @@ public class SpeedBuilder extends SoloGame public void clearCenterArea(boolean resetGround) { - Location buildMin = _buildMiddle.clone().subtract(2, 0, 2); - Location buildMax = _buildMiddle.clone().add(2, 4, 2); + Location buildMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 0, BuildSizeDiv2); + Location buildMax = _buildMiddle.clone().add(BuildSizeDiv2, BuildSizeMin1, BuildSizeDiv2); for (Block block : UtilBlock.getInBoundingBox(buildMin, buildMax)) MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); if (resetGround) { - for (int x = 0; x < 5; x++) + for (int x = 0; x < BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < BuildSize; z++) { MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, -1, z), _defaultMiddleGround[x][z].getType(), _defaultMiddleGround[x][z].getRawData()); } @@ -206,23 +208,23 @@ public class SpeedBuilder extends SoloGame { clearCenterArea(true); - Location groundMin = _buildMiddle.clone().subtract(2, 1, 2); + Location groundMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 1, BuildSizeDiv2); - for (int x = 0; x < 5; x++) + for (int x = 0; x < BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < BuildSize; z++) { MapUtil.QuickChangeBlockAt(groundMin.clone().add(x, 0, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData()); } } - Location buildMin = _buildMiddle.clone().subtract(2, 0, 2); + Location buildMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 0, BuildSizeDiv2); - for (int x = 0; x < 5; x++) + for (int x = 0; x < BuildSize; x++) { - for (int y = 0; y < 5; y++) + for (int y = 0; y < BuildSize; y++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < BuildSize; z++) { MapUtil.QuickChangeBlockAt(buildMin.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); } @@ -481,7 +483,7 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; - if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == 125) + if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3) { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); @@ -516,7 +518,7 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; - if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == 125) + if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3) { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); @@ -545,48 +547,6 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } - @EventHandler - public void itemUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - if (!IsLive()) - return; - - if (_state != SpeedBuilderState.BUILDING) - return; - - for (RecreationData recreation : _buildRecreations.values()) - { - Iterator> iterator = recreation.DroppedItems.entrySet().iterator(); - - while (iterator.hasNext()) - { - Entry entry = iterator.next(); - - if (!UtilTime.elapsed(entry.getValue(), 3000)) - continue; - - UtilInv.insert(recreation.Player, entry.getKey().getItemStack()); - - recreation.Player.playSound(recreation.Player.getEyeLocation(), Sound.ITEM_PICKUP, 1f, 1f); - - //Play pickup animation - PacketPlayOutCollect packet = new PacketPlayOutCollect(recreation.Player.getEntityId(), entry.getKey().getEntityId()); - - for (Player player : UtilServer.getPlayers()) - { - UtilPlayer.sendPacket(player, packet); - } - - entry.getKey().remove(); - - iterator.remove(); - } - } - } - @EventHandler public void stopMoveOffArea(UpdateEvent event) { @@ -733,7 +693,7 @@ public class SpeedBuilder extends SoloGame lowestScore = score; } - if (score != 125) + if (score != BuildSizePow3) allPerfectMatch = false; if (recreation.isEmptyBuild()) @@ -838,14 +798,12 @@ public class SpeedBuilder extends SoloGame WorldData.World.playEffect(eliminating.getMidpoint(), Effect.EXPLOSION_HUGE, 0); WorldData.World.playSound(eliminating.getMidpoint(), Sound.EXPLODE, 10F, 1F); - HashSet blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), eliminating.OriginalBuildLocation.getBlock(), null, 2000, 7); + HashSet blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), eliminating.OriginalBuildLocation.getBlock(), null, 2000, 8); //Sets should remove duplicates blocks.addAll(eliminating.getBlocks()); Manager.GetExplosion().BlockExplosion(blocks, eliminating.getMidpoint(), false, true); - - eliminating.clearBuildArea(true); judgeTargetLocation(null); @@ -1111,12 +1069,6 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } - @EventHandler - public void stopBlockPhysics(BlockPhysicsEvent event) - { - event.setCancelled(true); - } - @Override public void EndCheck() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java index 898c7c519..7ba542eb5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.speedbuilder.data; +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape; @@ -15,31 +16,36 @@ import org.bukkit.material.Stairs; public class BuildData { - public BlockState[][][] Build = new BlockState[5][5][5]; - public BlockState[][] Ground = new BlockState[5][5]; + public BlockState[][][] Build; + public BlockState[][] Ground; //Store stair shapes for stair fix - public EnumStairShape[][][] StairShapes = new EnumStairShape[5][5][5]; + public EnumStairShape[][][] StairShapes; - public BuildData(Location loc) + public BuildData(Location loc, SpeedBuilder game) { - Location groundMin = loc.clone().add(-2, 2, -2); + Build = new BlockState[game.BuildSize][game.BuildSize][game.BuildSize]; + Ground = new BlockState[game.BuildSize][game.BuildSize]; - for (int x = 0; x < 5; x++) + StairShapes = new EnumStairShape[game.BuildSize][game.BuildSize][game.BuildSize]; + + Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, -2, game.BuildSizeDiv2); + + for (int x = 0; x < game.BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < game.BuildSize; z++) { Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); } } - Location buildMin = loc.clone().add(-2, 3, -2); + Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, -3, game.BuildSizeDiv2); - for (int x = 0; x < 5; x++) + for (int x = 0; x < game.BuildSize; x++) { - for (int y = 0; y < 5; y++) + for (int y = 0; y < game.BuildSize; y++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < game.BuildSize; z++) { Block block = buildMin.clone().add(x, y, z).getBlock(); 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 e593bfac0..45a563c73 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 @@ -35,7 +35,7 @@ public class RecreationData public Player Player; - public BlockState[][] DefaultGround = new BlockState[5][5]; + public BlockState[][] DefaultGround; public Location OriginalBuildLocation; @@ -52,18 +52,20 @@ public class RecreationData { Game = game; + DefaultGround = new BlockState[game.BuildSize][game.BuildSize]; + Player = player; OriginalBuildLocation = loc; - CornerA = loc.clone().subtract(2, 0, 2); - CornerB = loc.clone().add(2, 4, 2); + CornerA = loc.clone().subtract(game.BuildSizeDiv2, 0, game.BuildSizeDiv2); + CornerB = loc.clone().add(game.BuildSizeDiv2, game.BuildSizeMin1, game.BuildSizeDiv2); PlayerSpawn = playerSpawn; - for (int x = 0; x < 5; x++) + for (int x = 0; x < game.BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < game.BuildSize; z++) { DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState(); } @@ -125,9 +127,9 @@ public class RecreationData if (resetGround) { - for (int x = 0; x < 5; x++) + for (int x = 0; x < Game.BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < Game.BuildSize; z++) { MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), DefaultGround[x][z].getType(), DefaultGround[x][z].getRawData()); } @@ -139,19 +141,19 @@ public class RecreationData { clearBuildArea(true); - for (int x = 0; x < 5; x++) + for (int x = 0; x < Game.BuildSize; x++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < Game.BuildSize; z++) { MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, -1, z), buildData.Ground[x][z].getType(), buildData.Ground[x][z].getRawData()); } } - for (int x = 0; x < 5; x++) + for (int x = 0; x < Game.BuildSize; x++) { - for (int y = 0; y < 5; y++) + for (int y = 0; y < Game.BuildSize; y++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < Game.BuildSize; z++) { MapUtil.QuickChangeBlockAt(CornerA.clone().add(x, y, z), buildData.Build[x][y][z].getType(), buildData.Build[x][y][z].getRawData()); } @@ -221,11 +223,11 @@ public class RecreationData { int score = 0; - for (int x = 0; x < 5; x++) + for (int x = 0; x < Game.BuildSize; x++) { - for (int y = 0; y < 5; y++) + for (int y = 0; y < Game.BuildSize; y++) { - for (int z = 0; z < 5; z++) + for (int z = 0; z < Game.BuildSize; z++) { Block currentBlock = CornerA.clone().add(x, y, z).getBlock(); BlockState expectedState = buildData.Build[x][y][z]; From b27d5849d8140403eb8c92310cf2a725dfb5ed71 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 12 Jan 2016 20:23:25 -0500 Subject: [PATCH 44/99] General fixes. --- .../game/games/speedbuilder/SpeedBuilder.java | 140 ++++++++++-------- 1 file changed, 75 insertions(+), 65 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 ee91d9c24..86c9c9097 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 @@ -25,7 +25,6 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -43,7 +42,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; import org.bukkit.ChatColor; import org.bukkit.Effect; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -483,6 +481,9 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; + if (_perfectBuild.containsKey(event.getPlayer())) + return; + if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3) { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); @@ -518,6 +519,9 @@ public class SpeedBuilder extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; + if (_perfectBuild.containsKey(event.getPlayer())) + return; + if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3) { event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); @@ -636,7 +640,10 @@ public class SpeedBuilder extends SoloGame //Sometimes it doesn't show in the update method UtilTextMiddle.display("", C.cRed + "View Time Over!", 0, 30, 10); - Announce(F.main("Build", "Recreate the build shown.")); + for (Player player : GetTeamList().get(0).GetPlayers(true)) + { + UtilPlayer.message(player, F.main("Build", "Recreate the build shown.")); + } setSpeedBuilderState(SpeedBuilderState.BUILDING); } @@ -665,10 +672,10 @@ public class SpeedBuilder extends SoloGame for (Player player : UtilServer.getPlayers()) { - player.setGameMode(GameMode.SPECTATOR); - player.setSpectatorTarget(_judgeEntity); +// player.setGameMode(GameMode.SPECTATOR); +// player.setSpectatorTarget(_judgeEntity); - Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); +// Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(10, 0.0F); UtilPlayer.sendPacket(player, packet); @@ -723,50 +730,53 @@ public class SpeedBuilder extends SoloGame recreation.pasteBuildData(_currentBuild); } - Location specLocation = GetSpectatorLocation(); - double avgDist = 0; - - //Add up all the distances - for (Location loc : GetTeamList().get(0).GetSpawns()) - { - avgDist += UtilMath.offset2d(specLocation, loc); - } - - //Get the average by dividing - avgDist /= GetTeamList().get(0).GetSpawns().size(); - - for (Player player : UtilServer.getPlayers()) - { - player.setGameMode(GameMode.SURVIVAL); - - Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Guardian POV"); - - if (_buildRecreations.containsKey(player)) - player.teleport(_buildRecreations.get(player).PlayerSpawn); - - if (!IsAlive(player) || GetTeamList().get(1).HasPlayer(player)) - { - player.setAllowFlight(true); - player.setFlying(true); - - Location toTeleport = specLocation.clone(); - - //Spread players by getting a random x and z in that radius - toTeleport.setX(toTeleport.getX() + (Math.random() * avgDist * 2 - avgDist)); - toTeleport.setZ(toTeleport.getZ() + (Math.random() * avgDist * 2 - avgDist)); - - toTeleport.setDirection(UtilAlg.getTrajectory(toTeleport, _buildMiddle.clone().add(0.5, 0, 0.5))); - - player.teleport(toTeleport); - } - } +// Location specLocation = GetSpectatorLocation(); +// double avgDist = 0; +// +// //Add up all the distances +// for (Location loc : GetTeamList().get(0).GetSpawns()) +// { +// avgDist += UtilMath.offset2d(specLocation, loc); +// } +// +// //Get the average by dividing +// avgDist /= GetTeamList().get(0).GetSpawns().size(); +// +// for (Player player : UtilServer.getPlayers()) +// { +// player.setGameMode(GameMode.SURVIVAL); +// +// Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, "Guardian POV"); +// +// if (_buildRecreations.containsKey(player)) +// player.teleport(_buildRecreations.get(player).PlayerSpawn); +// +// if (!IsAlive(player) || GetTeamList().get(1).HasPlayer(player)) +// { +// player.setAllowFlight(true); +// player.setFlying(true); +// +// Location toTeleport = specLocation.clone(); +// +// //Spread players by getting a random x and z in that radius +// toTeleport.setX(toTeleport.getX() + (Math.random() * avgDist * 2 - avgDist)); +// toTeleport.setZ(toTeleport.getZ() + (Math.random() * avgDist * 2 - avgDist)); +// +// toTeleport.setDirection(UtilAlg.getTrajectory(toTeleport, _buildMiddle.clone().add(0.5, 0, 0.5))); +// +// player.teleport(toTeleport); +// } +// } if (_buildTime > 1) _buildTime--; _viewCountStage = 0; - Announce(F.main("Build", "You will recreate this build.")); + for (Player player : GetTeamList().get(0).GetPlayers(true)) + { + UtilPlayer.message(player, F.main("Build", "You will recreate this build.")); + } setSpeedBuilderState(SpeedBuilderState.VIEWING); } @@ -991,27 +1001,27 @@ public class SpeedBuilder extends SoloGame } } - @EventHandler - public void stopJudgeUnspec(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - if (!IsLive()) - return; - - if (_state != SpeedBuilderState.REVIEWING) - return; - - for (Player player : UtilServer.getPlayers()) - { - player.setGameMode(GameMode.SPECTATOR); - player.setSpectatorTarget(_judgeEntity); - - if (!Manager.GetCondition().HasCondition(player, ConditionType.CLOAK, "Guardian POV")) - Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); - } - } +// @EventHandler +// public void stopJudgeUnspec(UpdateEvent event) +// { +// if (event.getType() != UpdateType.TICK) +// return; +// +// if (!IsLive()) +// return; +// +// if (_state != SpeedBuilderState.REVIEWING) +// return; +// +// for (Player player : UtilServer.getPlayers()) +// { +// player.setGameMode(GameMode.SPECTATOR); +// player.setSpectatorTarget(_judgeEntity); +// +// if (!Manager.GetCondition().HasCondition(player, ConditionType.CLOAK, "Guardian POV")) +// Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); +// } +// } @EventHandler public void stopGuardianSpecPickup(PlayerPickupItemEvent event) 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 45/99] 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); } } From ee6425bbaf50a783bff05e7dfbc6969891c9852c Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 12 Jan 2016 23:31:35 -0500 Subject: [PATCH 46/99] Removed extra blank lines. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 2 -- 1 file changed, 2 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 cb6f0adec..6f51de839 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,8 +355,6 @@ public class SpeedBuilder extends SoloGame } } - - Manager.getCosmeticManager().setHideParticles(true); } From 2e433d8b0654507a9a41d9bbae313ab90e92471f Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 14 Jan 2016 07:17:40 -0500 Subject: [PATCH 47/99] Made sure that the active morph gets disabled on clear --- .../src/nautilus/game/arcade/ArcadeManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 91f502c5d..ed8431314 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -58,6 +58,8 @@ import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; import mineplex.core.giveaway.GiveawayManager; import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; @@ -123,7 +125,6 @@ import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTestingManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; -import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.player.ArcadePlayer; @@ -890,6 +891,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation HubClock(player); GetDisguise().undisguise(player); + + Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph); + if (morph.IsActive(player)) + morph.Disable(player); } public ArrayList LoadFiles(String gameName) From 376f719c261bd2152a6646a152472a2485e1b689 Mon Sep 17 00:00:00 2001 From: fooify Date: Tue, 19 Jan 2016 18:52:54 -0800 Subject: [PATCH 48/99] fixes important bug, fixed a scary typo! --- .../src/mineplex/core/account/CoreClientManager.java | 9 ++++++++- .../src/mineplex/core/cosmetic/ui/page/Menu.java | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index d92f4e5b7..444352cb8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -466,6 +466,13 @@ public class CoreClientManager extends MiniPlugin if (event.getReason().contains("You logged in from another location")) { _duplicateLoginGlitchPreventionList.add(event.getPlayer().getName()); + Bukkit.getScheduler().runTask(_plugin, new Runnable() { + public void run() { + if(!_clientList.containsKey(event.getPlayer().getName())) return; + Player p = _clientList.get(event.getPlayer().getName()).GetPlayer(); + p.kickPlayer("You're already logged in."); + } + }); } } @@ -473,7 +480,7 @@ public class CoreClientManager extends MiniPlugin public void Quit(PlayerQuitEvent event) { // When an account is logged in to this server and the same account name logs in - // Then it Fires events in this order (original, new for accounts) + // Then it Fires events in this order (original, new for acco unts) // AsyncPreLogin -> new // PlayerLogin -> new // PlayerKick -> old diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 7671463cc..3954e1edc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -160,7 +160,7 @@ public class Menu extends ShopPageBase if (enabled.containsKey(type)) addGlow(deathSlot); type = GadgetType.Item; - lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zaney contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); + lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type))); if (enabled.containsKey(type)) addGlow(gadgetSlot); From 6ab6307f74d7d87da8ced344373e3c46750cc9d6 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 21 Jan 2016 19:08:38 -0500 Subject: [PATCH 49/99] Pushing all my stuff for Shaunpai. --- .../mineplex/core/common/util/UtilAlg.java | 1 + .../core/achievement/Achievement.java | 26 +- .../core/achievement/AchievementCategory.java | 14 +- .../game/games/speedbuilder/SpeedBuilder.java | 344 ++++++++++++++---- .../games/speedbuilder/data/BuildData.java | 54 ++- .../speedbuilder/data/DemolitionData.java | 3 + .../game/games/speedbuilder/data/MobData.java | 23 ++ .../speedbuilder/data/RecreationData.java | 64 +++- .../events/PerfectBuildEvent.java | 44 +++ .../games/speedbuilder/kits/DefaultKit.java | 2 +- .../stattrackers/DependableTracker.java | 23 ++ .../stattrackers/FirstBuildTracker.java | 30 ++ .../stattrackers/PerfectionistTracker.java | 50 +++ 13 files changed, 596 insertions(+), 82 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index 40f1147c9..a1136d211 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -515,4 +515,5 @@ public class UtilAlg { return new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ()); } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index d7e71c18e..489393721 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -854,7 +854,31 @@ public enum Achievement new String[]{"Type Wars.Wins"}, new String[]{"Win 30 Games"}, new int[]{30}, - AchievementCategory.TYPE_WARS); + AchievementCategory.TYPE_WARS), + + SPEED_BUILDER_SPEED_MASTER("Speed Master", 800, + new String[]{"Speed Builder.Wins"}, + new String[]{"Win 10 Games of Speed Builder"}, + new int[]{10}, + AchievementCategory.SPEED_BUILDER), + + SPEED_BUILDER_DEPENDABLE("Dependable", 1200, + new String[]{"Speed Builder.PerfectBuild"}, + new String[]{"Complete 10 Perfect Builds"}, + new int[]{10}, + AchievementCategory.SPEED_BUILDER), + + SPEED_BUILDER_FIRST_BUILD("First Build!", 1800, + new String[]{"Speed Builder.PerfectFirst"}, + new String[]{"Be the first person to complete a build in the game 10 times"}, + new int[]{10}, + AchievementCategory.SPEED_BUILDER), + + SPEED_BUILDER_PERFECTIONIST("Perfectionist", 2200, + new String[]{"Speed Builder.PerfectWins"}, + new String[]{"Win a game of Speed Builder with a perfect build every round"}, + new int[]{1}, + AchievementCategory.SPEED_BUILDER); private String _name; private String[] _desc; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 4a12d45cb..3dc276aed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -2,10 +2,6 @@ package mineplex.core.achievement; import java.util.List; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; - import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -14,6 +10,10 @@ import mineplex.core.game.GameDisplay; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + public enum AchievementCategory { GLOBAL("Global", null, @@ -157,7 +157,11 @@ public enum AchievementCategory TYPE_WARS("Type Wars", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED}, - Material.NAME_TAG, 0, GameCategory.CLASSICS, null); + Material.NAME_TAG, 0, GameCategory.CLASSICS, null), + + SPEED_BUILDER("Speed Builder", null, + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, + Material.QUARTZ_BLOCK, 0, GameCategory.ARCADE, null); private String _name; 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 6f51de839..0371d20b1 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 @@ -33,13 +33,17 @@ import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.speedbuilder.data.BuildData; import nautilus.game.arcade.game.games.speedbuilder.data.DemolitionData; +import nautilus.game.arcade.game.games.speedbuilder.data.MobData; import nautilus.game.arcade.game.games.speedbuilder.data.RecreationData; +import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; import nautilus.game.arcade.game.games.speedbuilder.kits.DefaultKit; +import nautilus.game.arcade.game.games.speedbuilder.stattrackers.DependableTracker; +import nautilus.game.arcade.game.games.speedbuilder.stattrackers.FirstBuildTracker; +import nautilus.game.arcade.game.games.speedbuilder.stattrackers.PerfectionistTracker; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutEntityLook; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.Location; @@ -47,7 +51,10 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -55,16 +62,22 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.material.Bed; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame @@ -78,6 +91,8 @@ public class SpeedBuilder extends SoloGame private SpeedBuilderState _state = SpeedBuilderState.VIEWING; private long _stateTime = System.currentTimeMillis(); + private int _roundsPlayed; + private int _buildCountStage; private int _viewCountStage; @@ -90,6 +105,7 @@ public class SpeedBuilder extends SoloGame private BuildData _currentBuild; private BlockState[][] _defaultMiddleGround = new BlockState[BuildSize][BuildSize]; + private ArrayList _middleMobs = new ArrayList(); private NautHashMap _buildRecreations = new NautHashMap(); @@ -105,6 +121,14 @@ public class SpeedBuilder extends SoloGame private NautHashMap _perfectBuild = new NautHashMap(); + private Location _lookTarget; + private ArmorStand _lookStand; + private long _targetReached; + private long _stayTime; + private RecreationData _lastRecreationTarget; + private double _standMoveProgress; + private Location _standStart; + public SpeedBuilder(ArcadeManager manager) { super(manager, GameType.SpeedBuilder, @@ -114,7 +138,7 @@ public class SpeedBuilder extends SoloGame }, new String[] { - "Re-create the build shown to you.", + "Recreate the build shown to you.", "The least correct build is eliminated.", "Last person left wins!" }); @@ -131,6 +155,12 @@ public class SpeedBuilder extends SoloGame FixSpawnFacing = false; AllowParticles = false; + + registerStatTrackers( + new DependableTracker(this), + new FirstBuildTracker(this), + new PerfectionistTracker(this) + ); } @Override @@ -150,9 +180,9 @@ public class SpeedBuilder extends SoloGame } } - for (Location loc : WorldData.GetDataLocs("LIME")) + for (Entry> entry : WorldData.GetAllCustomLocs().entrySet()) { - _buildData.add(new BuildData(loc.clone().subtract(0.5, 0, 0.5), this)); + _buildData.add(new BuildData(entry.getValue().get(0).clone().subtract(0.5, 0, 0.5), ChatColor.translateAlternateColorCodes('&', entry.getKey()), this)); } for (Location loc : WorldData.GetDataLocs("YELLOW")) @@ -182,13 +212,27 @@ public class SpeedBuilder extends SoloGame return _stateTime; } + public int getRoundsPlayed() + { + return _roundsPlayed; + } + public void clearCenterArea(boolean resetGround) { Location buildMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 0, BuildSizeDiv2); Location buildMax = _buildMiddle.clone().add(BuildSizeDiv2, BuildSizeMin1, BuildSizeDiv2); for (Block block : UtilBlock.getInBoundingBox(buildMin, buildMax)) + { MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + } + + for (Entity entity : _middleMobs) + { + entity.remove(); + } + + _middleMobs.clear(); if (resetGround) { @@ -228,6 +272,22 @@ public class SpeedBuilder extends SoloGame } } } + + CreatureAllowOverride = true; + + for (MobData mobData : buildData.Mobs) + { + Location loc = buildMin.clone().add(mobData.DX + 0.5, mobData.DY, mobData.DZ + 0.5); + + Entity entity = loc.getWorld().spawnEntity(loc, mobData.EntityType); + + UtilEnt.Vegetate(entity, true); + UtilEnt.ghost(entity, true, false); + + _middleMobs.add(entity); + } + + CreatureAllowOverride = false; } public void spawnJudge() @@ -371,7 +431,13 @@ public class SpeedBuilder extends SoloGame return; } - _currentBuild = UtilAlg.Random(_buildData); + //_currentBuild = UtilAlg.Random(_buildData);; + + do + { + _currentBuild = UtilAlg.Random(_buildData); + } + while (_currentBuild.Mobs.isEmpty()); HashSet usedBuildLocs = new HashSet(); @@ -402,6 +468,10 @@ public class SpeedBuilder extends SoloGame UtilPlayer.message(player, F.main("Build", "Recreate the build shown.")); } + UtilTextMiddle.display("", C.cGold + _currentBuild.BuildText, 0, 80, 10); + + _roundsPlayed++; + setSpeedBuilderState(SpeedBuilderState.VIEWING); } @@ -481,45 +551,19 @@ public class SpeedBuilder extends SoloGame @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBuildFinish(final BlockPlaceEvent event) { - if (_perfectBuild.containsKey(event.getPlayer())) - return; - - Manager.runSyncLater(new Runnable() - { - @Override - public void run() - { - if (!IsLive()) - return; - - if (_state != SpeedBuilderState.BUILDING) - return; - - if (!_buildRecreations.containsKey(event.getPlayer())) - return; - - if (_perfectBuild.containsKey(event.getPlayer())) - return; - - if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3) - { - event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - - UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, event.getPlayer()); - - Announce(F.main("Build", C.mElem + event.getPlayer().getName() + C.mBody + " got a perfect build!")); - - _perfectBuild.put(event.getPlayer(), System.currentTimeMillis()); - } - } - }, 1L); + checkPerfectBuild(event.getPlayer()); } //This is here because if you open a door then close it you won't be informed of a perfect build @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void interactInformSuccess(PlayerInteractEvent event) { - if (_perfectBuild.containsKey(event.getPlayer())) + checkPerfectBuild(event.getPlayer()); + } + + public void checkPerfectBuild(Player player) + { + if (_perfectBuild.containsKey(player)) return; Manager.runSyncLater(new Runnable() @@ -533,21 +577,25 @@ public class SpeedBuilder extends SoloGame if (_state != SpeedBuilderState.BUILDING) return; - if (!_buildRecreations.containsKey(event.getPlayer())) + if (!_buildRecreations.containsKey(player)) return; - if (_perfectBuild.containsKey(event.getPlayer())) + if (_perfectBuild.containsKey(player)) return; - if (_buildRecreations.get(event.getPlayer()).calculateScoreFromBuild(_currentBuild) == BuildSizePow3) + if (_buildRecreations.get(player).calculateScoreFromBuild(_currentBuild) == _currentBuild.getPerfectScore()) { - event.getPlayer().playSound(event.getPlayer().getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); + PerfectBuildEvent perfectBuildEvent = new PerfectBuildEvent(player, SpeedBuilder.this); - UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, event.getPlayer()); + Bukkit.getServer().getPluginManager().callEvent(perfectBuildEvent); - Announce(F.main("Build", C.mElem + event.getPlayer().getName() + C.mBody + " got a perfect build!")); + player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - _perfectBuild.put(event.getPlayer(), System.currentTimeMillis()); + UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, player); + + Announce(F.main("Build", F.name(player.getName()) + " got a perfect build!")); + + _perfectBuild.put(player, System.currentTimeMillis()); } } }, 1L); @@ -577,9 +625,6 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state == SpeedBuilderState.REVIEWING) - return; - for (Player player : GetPlayers(true)) { if (!_buildRecreations.containsKey(player)) @@ -600,6 +645,7 @@ public class SpeedBuilder extends SoloGame player.teleport(recreation.PlayerSpawn); UtilPlayer.message(player, F.main("Build", "You cannot leave your area!")); + UtilTextMiddle.display("", C.cRed + "You cannot leave your area!", 0, 30, 10, player); break; } @@ -717,10 +763,10 @@ public class SpeedBuilder extends SoloGame lowestScore = score; } - if (score != BuildSizePow3) + if (score != _currentBuild.getPerfectScore()) allPerfectMatch = false; - if (recreation.isEmptyBuild()) + if (recreation.isEmptyBuild(_currentBuild)) _toEliminate.add(recreation); } @@ -738,6 +784,9 @@ public class SpeedBuilder extends SoloGame { if (_toEliminate.isEmpty()) { + if (!UtilTime.elapsed(_lastElimination, 3000)) + return; + clearCenterArea(true); _currentBuild = UtilAlg.Random(_buildData); @@ -787,6 +836,8 @@ public class SpeedBuilder extends SoloGame // } // } + _roundsPlayed++; + if (_buildTime > 1) _buildTime--; @@ -797,6 +848,8 @@ public class SpeedBuilder extends SoloGame UtilPlayer.message(player, F.main("Build", "You will recreate this build.")); } + UtilTextMiddle.display("", C.cGold + _currentBuild.BuildText, 0, 80, 10); + setSpeedBuilderState(SpeedBuilderState.VIEWING); } else @@ -927,7 +980,7 @@ public class SpeedBuilder extends SoloGame { if (_viewCountStage == _viewTime) UtilTextMiddle.display("", C.cRed + "View Time Over!", 0, 30, 10); - else + else if (_viewCountStage > 3) UtilTextMiddle.display("", C.cGreen + (_viewTime - _viewCountStage), 0, 30, 10); _viewCountStage++; @@ -970,7 +1023,7 @@ public class SpeedBuilder extends SoloGame for (DemolitionData demolition : blocksForDemolition) { - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuilderState.BUILDING || _perfectBuild.containsKey(demolition.Parent.Player)) demolition.cancelBreak(); else demolition.update(); @@ -991,7 +1044,7 @@ public class SpeedBuilder extends SoloGame } @EventHandler - public void judgeStaring(UpdateEvent event) + public void judgeLooking(UpdateEvent event) { if (event.getType() != UpdateType.FASTEST) return; @@ -1002,27 +1055,63 @@ public class SpeedBuilder extends SoloGame if (_state != SpeedBuilderState.BUILDING && _state != SpeedBuilderState.VIEWING) return; - for (Player player : UtilServer.getPlayers()) + if (_buildRecreations.isEmpty()) + return; + + if (_lookTarget == null || (UtilTime.elapsed(_targetReached, _stayTime) && _standMoveProgress > 1)) { - Vector trajectory = UtilAlg.getTrajectory(_judgeEntity.getEyeLocation(), player.getEyeLocation()); - PacketPlayOutEntityLook packetLook = new PacketPlayOutEntityLook(); + RecreationData target = null; - packetLook.a = _judgeEntity.getEntityId(); - packetLook.e = (byte)(int)(UtilAlg.GetYaw(trajectory) * 256d / 360d); - packetLook.f = (byte)(int)(UtilAlg.GetPitch(trajectory) * 256d / 360d); - packetLook.g = false; - packetLook.h = true; + do + { + target = _buildRecreations.get(UtilAlg.Random(_buildRecreations.keySet())); + } + while (target.equals(_lastRecreationTarget) && _buildRecreations.size() > 1); - PacketPlayOutEntityHeadRotation packetRot = new PacketPlayOutEntityHeadRotation(); + _lookTarget = target.getMidpoint().subtract(UtilAlg.getTrajectory(_judgeEntity.getEyeLocation(), target.getMidpoint()).multiply(5)); + _stayTime = UtilMath.rRange(4000, 8000); + _lastRecreationTarget = target; + _standMoveProgress = 0; - packetRot.a = packetLook.a; - packetRot.b = packetLook.e; - - UtilPlayer.sendPacket(player, packetLook, packetRot); + if (_lookStand != null) + _standStart = _lookStand.getLocation(); } + + if (_lookStand == null) + { + _lookStand = WorldData.World.spawn(_judgeEntity.getEyeLocation().add(_judgeEntity.getEyeLocation().getDirection().multiply(10)), ArmorStand.class); + + _lookStand.setGravity(false); + _lookStand.setSmall(true); + _lookStand.setVisible(false); + _lookStand.setGhost(true); + _lookStand.setMarker(false); + + _standStart = _lookStand.getLocation(); + } + + if (_standMoveProgress > 1) + return; + + Location newLoc = _standStart.clone().add(UtilAlg.getTrajectory(_standStart, _lookTarget).multiply(UtilMath.offset(_standStart, _lookTarget) * _standMoveProgress)); + + moveEntity(newLoc, _lookStand); + + UtilEnt.CreatureLook(_judgeEntity, _lookStand); + + _standMoveProgress += 0.2; } - + + private void moveEntity(Location loc, Entity entity) + { + double dx = loc.getX() - entity.getLocation().getX(); + double dy = loc.getY() - entity.getLocation().getY(); + double dz = loc.getZ() - entity.getLocation().getZ(); + + ((CraftEntity) entity).getHandle().move(dx, dy, dz); + } + @EventHandler public void specNightVision(UpdateEvent event) { @@ -1036,8 +1125,8 @@ public class SpeedBuilder extends SoloGame { 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); + player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, Integer.MAX_VALUE, 0, true, false), true); } } } @@ -1120,6 +1209,108 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } + @EventHandler + public void stopLiquidLeaks(BlockFromToEvent event) + { + for (RecreationData recreation : _buildRecreations.values()) + { + if ((recreation.inBuildArea(event.getBlock()) && !recreation.inBuildArea(event.getToBlock())) || (!recreation.inBuildArea(event.getBlock()) && recreation.inBuildArea(event.getToBlock()))) + event.setCancelled(true); + } + } + + @EventHandler + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.BUILDING) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + Block liquid = event.getBlockClicked().getRelative(event.getBlockFace()); + + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(liquid)) + { + event.setCancelled(true); + + UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); + } + } + + @EventHandler + public void onPlayerBucketFill(PlayerBucketFillEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.BUILDING) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + Block liquid = event.getBlockClicked().getRelative(event.getBlockFace()); + + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(liquid)) + { + event.setCancelled(true); + + UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); + } + } + + @EventHandler + public void addMob(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + if (_state != SpeedBuilderState.BUILDING) + return; + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getItem() == null) + return; + + if (event.getItem().getType() != Material.MONSTER_EGG) + return; + + if (!_buildRecreations.containsKey(event.getPlayer())) + return; + + EntityType type = EntityType.fromId(event.getItem().getDurability()); + + Block block = event.getClickedBlock().getRelative(event.getBlockFace()); + + if (!_buildRecreations.get(event.getPlayer()).inBuildArea(block)) + return; + + CreatureAllowOverride = true; + + Entity entity = block.getWorld().spawnEntity(block.getLocation().add(0.5, 0, 0.5), type); + + UtilEnt.Vegetate(entity, true); + UtilEnt.ghost(entity, true, false); + + CreatureAllowOverride = false; + + _buildRecreations.get(event.getPlayer()).Mobs.add(entity); + + UtilInv.remove(event.getPlayer(), Material.MONSTER_EGG, (byte) event.getItem().getDurability(), 1); + } + + @EventHandler + public void stopCombust(EntityCombustEvent event) + { + event.setCancelled(true); + } + @Override public void EndCheck() { @@ -1188,6 +1379,19 @@ public class SpeedBuilder extends SoloGame Scoreboard.WriteBlank(); + if (_state == SpeedBuilderState.BUILDING) + { + long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime); + + if (timeLeft < 0) + timeLeft = 0; + + Scoreboard.Write(C.cRedB + "Round Time:"); + Scoreboard.Write(UtilTime.MakeStr(timeLeft)); + + Scoreboard.WriteBlank(); + } + Scoreboard.Draw(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java index 7ba542eb5..c9a8299e0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java @@ -1,5 +1,8 @@ package nautilus.game.arcade.game.games.speedbuilder.data; +import java.util.ArrayList; + +import mineplex.core.common.util.MapUtil; import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; @@ -7,29 +10,44 @@ import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape; import net.minecraft.server.v1_8_R3.IBlockData; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockState; +import org.bukkit.block.Sign; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.entity.EntityType; import org.bukkit.material.Stairs; public class BuildData { + public SpeedBuilder Game; + + public Location BuildMin; + public BlockState[][][] Build; public BlockState[][] Ground; //Store stair shapes for stair fix public EnumStairShape[][][] StairShapes; - public BuildData(Location loc, SpeedBuilder game) + public String BuildText; + + public ArrayList Mobs = new ArrayList(); + + public BuildData(Location loc, String buildText, SpeedBuilder game) { Build = new BlockState[game.BuildSize][game.BuildSize][game.BuildSize]; Ground = new BlockState[game.BuildSize][game.BuildSize]; StairShapes = new EnumStairShape[game.BuildSize][game.BuildSize][game.BuildSize]; - Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, -2, game.BuildSizeDiv2); + BuildText = buildText; + + Game = game; + + Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, -3, game.BuildSizeDiv2); for (int x = 0; x < game.BuildSize; x++) { @@ -39,7 +57,9 @@ public class BuildData } } - Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, -3, game.BuildSizeDiv2); + Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, -4, game.BuildSizeDiv2); + + BuildMin = buildMin; for (int x = 0; x < game.BuildSize; x++) { @@ -48,6 +68,29 @@ public class BuildData for (int z = 0; z < game.BuildSize; z++) { Block block = buildMin.clone().add(x, y, z).getBlock(); + + if (block.getType() == Material.SIGN_POST) + { + Sign sign = (Sign) block.getState(); + + EntityType type = null; + + try + { + type = EntityType.valueOf(sign.getLine(0).toUpperCase()); + } + catch (IllegalArgumentException e) + { + // Not a entity sign or someone messed up... + } + + if (type != null) + { + Mobs.add(new MobData(type, x, y, z)); + + MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); + } + } Build[x][y][z] = block.getState(); @@ -65,4 +108,9 @@ public class BuildData } } + public int getPerfectScore() + { + return Game.BuildSizePow3 + Mobs.size(); + } + } 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 7f2eea1c4..83e913cc8 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 @@ -24,6 +24,7 @@ public class DemolitionData public RecreationData Parent; public NautHashMap Blocks; + public long Start; private Hologram _hologram; @@ -164,6 +165,8 @@ public class DemolitionData } Parent.BlocksForDemolition.remove(this); + + Parent.Game.checkPerfectBuild(Parent.Player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java new file mode 100644 index 000000000..ac07eb0be --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.game.games.speedbuilder.data; + +import org.bukkit.entity.EntityType; + +public class MobData +{ + + public EntityType EntityType; + + public int DX; + public int DY; + public int DZ; + + public MobData(EntityType entityType, int dx, int dy, int dz) + { + EntityType = entityType; + + DX = dx; + DY = dy; + DZ = dz; + } + +} 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 ce22ee99a..11e1c3072 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 @@ -7,6 +7,7 @@ import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; @@ -21,6 +22,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -48,6 +50,8 @@ public class RecreationData public ArrayList BlocksForDemolition = new ArrayList(); + public ArrayList Mobs = new ArrayList(); + public RecreationData(SpeedBuilder game, Player player, Location loc, Location playerSpawn) { Game = game; @@ -125,6 +129,13 @@ public class RecreationData MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); } + for (Entity entity : Mobs) + { + entity.remove(); + } + + Mobs.clear(); + if (resetGround) { for (int x = 0; x < Game.BuildSize; x++) @@ -159,6 +170,22 @@ public class RecreationData } } } + + Game.CreatureAllowOverride = true; + + for (MobData mobData : buildData.Mobs) + { + Location loc = CornerA.clone().add(mobData.DX + 0.5, mobData.DY, mobData.DZ + 0.5); + + Entity entity = loc.getWorld().spawnEntity(loc, mobData.EntityType); + + UtilEnt.Vegetate(entity, true); + UtilEnt.ghost(entity, true, false); + + Mobs.add(entity); + } + + Game.CreatureAllowOverride = false; } public void breakAndDropItems() @@ -211,12 +238,21 @@ public class RecreationData } } + for (Entity entity : Mobs) + { + ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId()); + + Item item = entity.getWorld().dropItem(getMidpoint(), spawnEgg); + + DroppedItems.put(item, System.currentTimeMillis()); + } + CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); clearBuildArea(false); } - public boolean isEmptyBuild() + public boolean isEmptyBuild(BuildData buildData) { for (Block block : getBlocks()) { @@ -224,7 +260,7 @@ public class RecreationData return false; } - return true; + return !buildData.Mobs.isEmpty() && Mobs.isEmpty(); } public int calculateScoreFromBuild(BuildData buildData) @@ -246,6 +282,13 @@ public class RecreationData continue; } + //Ender portal direction fix & 0x4 is a check to see if the frame has an ender eye in it + if (currentBlock.getType() == Material.ENDER_PORTAL_FRAME && expectedState.getType() == Material.ENDER_PORTAL_FRAME && (currentBlock.getData() & 0x4) == (expectedState.getRawData() & 0x4)) + { + score++; + continue; + } + //Sapling growth fix if (expectedState.getType() == Material.SAPLING && currentBlock.getType() == Material.SAPLING) { @@ -271,6 +314,23 @@ public class RecreationData } } + for (MobData mobData : buildData.Mobs) + { + for (Entity entity : Mobs) + { + int dx = (int) (entity.getLocation().getX() - (CornerA.getX() + 0.5)); + int dy = (int) (entity.getLocation().getY() - CornerA.getY()); + int dz = (int) (entity.getLocation().getZ() - (CornerA.getZ() + 0.5)); + + if (mobData.EntityType == entity.getType() && mobData.DX == dx && mobData.DY == dy && mobData.DZ == dz) + { + score++; + + break; + } + } + } + return score; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java new file mode 100644 index 000000000..ada7d8b8d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.game.games.speedbuilder.events; + +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PerfectBuildEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private Player _player; + private SpeedBuilder _game; + + public PerfectBuildEvent(Player player, SpeedBuilder game) + { + _player = player; + _game = game; + } + + public Player getPlayer() + { + return _player; + } + + public SpeedBuilder getGame() + { + return _game; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return handlers; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java index e59573a41..394d29049 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java @@ -16,7 +16,7 @@ public class DefaultKit extends Kit super(manager, "Speed Builder", KitAvailability.Free, new String[] { - "Professional build re-creator!", + "Professional build recreator!", }, new Perk[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java new file mode 100644 index 000000000..444080adb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.game.games.speedbuilder.stattrackers; + +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.event.EventHandler; + +public class DependableTracker extends StatTracker +{ + + public DependableTracker(SpeedBuilder game) + { + super(game); + } + + @EventHandler + public void onPerfectBuild(PerfectBuildEvent event) + { + addStat(event.getPlayer(), "PerfectBuild", 1, false, false); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java new file mode 100644 index 000000000..bc57488f1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.speedbuilder.stattrackers; + +import org.bukkit.event.EventHandler; + +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; +import nautilus.game.arcade.stats.StatTracker; + +public class FirstBuildTracker extends StatTracker +{ + + private boolean _first = true; + + public FirstBuildTracker(SpeedBuilder game) + { + super(game); + } + + @EventHandler + public void onPerfectBuild(PerfectBuildEvent event) + { + if (_first) + { + addStat(event.getPlayer(), "PerfectFirst", 1, false, false); + + _first = false; + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java new file mode 100644 index 000000000..fc4aec573 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java @@ -0,0 +1,50 @@ +package nautilus.game.arcade.game.games.speedbuilder.stattrackers; + +import java.util.Map.Entry; + +import mineplex.core.common.util.NautHashMap; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PerfectionistTracker extends StatTracker +{ + + private SpeedBuilder _game; + + private NautHashMap _perfectBuilds = new NautHashMap(); + + public PerfectionistTracker(SpeedBuilder game) + { + super(game); + + _game = game; + } + + @EventHandler + public void onPerfectBuild(PerfectBuildEvent event) + { + int previousPerfectBuilds = _perfectBuilds.containsKey(event.getPlayer()) ? _perfectBuilds.get(event.getPlayer()) : 0; + + _perfectBuilds.put(event.getPlayer(), previousPerfectBuilds + 1); + } + + @EventHandler + public void onEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + for (Entry entry : _perfectBuilds.entrySet()) + { + if (entry.getValue().intValue() == _game.getRoundsPlayed()) + addStat(entry.getKey(), "PerfectWins", 1, false, false); + } + } + +} From 5675aed698949ac02a5289c42f8b10eccaa54121 Mon Sep 17 00:00:00 2001 From: Cheese Date: Fri, 22 Jan 2016 11:56:52 +1100 Subject: [PATCH 50/99] velocity the drops to the player --- .../games/speedbuilder/data/RecreationData.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 11e1c3072..66b860b65 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 @@ -8,6 +8,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; @@ -29,6 +30,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; import org.bukkit.material.Door; import org.bukkit.material.Stairs; +import org.bukkit.util.Vector; public class RecreationData { @@ -246,10 +248,20 @@ public class RecreationData DroppedItems.put(item, System.currentTimeMillis()); } - + CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); clearBuildArea(false); + + //Velocity to player + for (Item item : DroppedItems.keySet()) + { + item.setPickupDelay(0); + + double mult = 0.5 + (0.6 * (UtilMath.offset(Player.getLocation(), item.getLocation())/16d)); + + item.setVelocity(Player.getLocation().toVector().subtract(item.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); + } } public boolean isEmptyBuild(BuildData buildData) From 636da8f4fad8eb2822e0626334595f6e0249fe0f Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 21 Jan 2016 20:13:32 -0500 Subject: [PATCH 51/99] Mob destroying. Removed a debug change that only selected builds with mobs in them. --- .../game/games/speedbuilder/SpeedBuilder.java | 32 +++++++++++--- .../speedbuilder/data/DemolitionData.java | 43 ++++++++++++++++++- .../speedbuilder/data/RecreationData.java | 24 ++++++++++- 3 files changed, 89 insertions(+), 10 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 0371d20b1..a2fcbff22 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 @@ -69,6 +69,7 @@ import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -431,13 +432,7 @@ public class SpeedBuilder extends SoloGame return; } - //_currentBuild = UtilAlg.Random(_buildData);; - - do - { - _currentBuild = UtilAlg.Random(_buildData); - } - while (_currentBuild.Mobs.isEmpty()); + _currentBuild = UtilAlg.Random(_buildData);; HashSet usedBuildLocs = new HashSet(); @@ -1011,6 +1006,29 @@ public class SpeedBuilder extends SoloGame _buildRecreations.get(event.getPlayer()).addToDemolition(event.getClickedBlock()); } + @EventHandler + public void markMobForDemolition(EntityDamageByEntityEvent event) + { + if (!(event.getDamager() instanceof Player)) + return; + + Player player = (Player) event.getDamager(); + + if (_state != SpeedBuilderState.BUILDING) + return; + + if (!_buildRecreations.containsKey(player)) + return; + + if (_perfectBuild.containsKey(player)) + return; + + if (!_buildRecreations.get(player).inBuildArea(event.getEntity().getLocation())) + return; + + _buildRecreations.get(player).addToDemolition(event.getEntity()); + } + @EventHandler public void updateDemolitionBlocks(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 83e913cc8..223ea2bb7 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 @@ -4,15 +4,19 @@ import java.util.ArrayList; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; import org.bukkit.Effect; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; +import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; @@ -24,6 +28,7 @@ public class DemolitionData public RecreationData Parent; public NautHashMap Blocks; + public ArrayList Mobs; public long Start; @@ -32,11 +37,12 @@ public class DemolitionData private boolean _flickerAir = true; private long _lastFlicker = System.currentTimeMillis(); - public DemolitionData(RecreationData parent, ArrayList blocks) + public DemolitionData(RecreationData parent, ArrayList blocks, ArrayList mobs) { Parent = parent; Blocks = new NautHashMap(); + Mobs = mobs; for (Block block : blocks) { @@ -50,7 +56,14 @@ public class DemolitionData public void spawnHologram() { - _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5), "3"); + Location loc = Parent.getMidpoint(); + + if (!Blocks.isEmpty()) + loc = Blocks.keySet().iterator().next().getLocation().add(0.5, 0.5, 0.5); + else if (!Mobs.isEmpty()) + loc = UtilAlg.Random(Mobs).getLocation().add(0, 1, 0); + + _hologram = new Hologram(Parent.Game.Manager.getHologramManager(), loc, "3"); _hologram.start(); } @@ -83,6 +96,14 @@ public class DemolitionData Blocks.get(block).update(true, false); } + for (Entity entity : Mobs) + { + if (_flickerAir) + UtilEnt.ghost(entity, true, true); + else + UtilEnt.ghost(entity, true, false); + } + _flickerAir = !_flickerAir; } @@ -98,6 +119,11 @@ public class DemolitionData { Blocks.get(block).update(true, false); } + + for (Entity entity : Mobs) + { + UtilEnt.ghost(entity, true, false); + } Parent.BlocksForDemolition.remove(this); } @@ -164,6 +190,19 @@ public class DemolitionData MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); } + for (Entity entity : Mobs) + { + ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId()); + + Item item = entity.getWorld().dropItem(entity.getLocation().add(0, 1, 0), spawnEgg); + + Parent.DroppedItems.put(item, System.currentTimeMillis()); + + entity.remove(); + + Parent.Mobs.remove(entity); + } + Parent.BlocksForDemolition.remove(this); Parent.Game.checkPerfectBuild(Parent.Player); 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 11e1c3072..8d23450f2 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 @@ -355,6 +355,17 @@ public class RecreationData return false; } + public boolean isQueuedForDemolition(Entity entity) + { + for (DemolitionData demolition : BlocksForDemolition) + { + if (demolition.Mobs.contains(entity)) + return true; + } + + return false; + } + public void addToDemolition(Block block) { if (isQueuedForDemolition(block)) @@ -390,7 +401,18 @@ public class RecreationData blocks.add(block.getRelative(BlockFace.UP)); } - BlocksForDemolition.add(new DemolitionData(this, blocks)); + BlocksForDemolition.add(new DemolitionData(this, blocks, new ArrayList())); + } + + public void addToDemolition(Entity entity) + { + if (isQueuedForDemolition(entity)) + return; + + ArrayList mobs = new ArrayList(); + mobs.add(entity); + + BlocksForDemolition.add(new DemolitionData(this, new ArrayList(), mobs)); } } From d37b8b40fc70df76be1dcc54aa3b8dfa0d0f4ee0 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 21 Jan 2016 20:41:28 -0500 Subject: [PATCH 52/99] Disable item merge to (hopefully) fix phantom rails. --- .../arcade/game/games/speedbuilder/SpeedBuilder.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 a2fcbff22..ccc066c65 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 @@ -70,6 +70,7 @@ import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.ItemMergeEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -432,7 +433,7 @@ public class SpeedBuilder extends SoloGame return; } - _currentBuild = UtilAlg.Random(_buildData);; + _currentBuild = UtilAlg.Random(_buildData); HashSet usedBuildLocs = new HashSet(); @@ -611,6 +612,12 @@ public class SpeedBuilder extends SoloGame event.setCancelled(true); } + @EventHandler + public void stopItemMerge(ItemMergeEvent event) + { + event.setCancelled(true); + } + @EventHandler public void stopMoveOffArea(UpdateEvent event) { From 24e97176ccf30778f964a3b175aa8014950ac7fd Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 21 Jan 2016 22:05:30 -0500 Subject: [PATCH 53/99] Call clear build area method on eliminate. --- .../game/arcade/game/games/speedbuilder/SpeedBuilder.java | 2 ++ 1 file changed, 2 insertions(+) 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 ccc066c65..fe7a7ed7d 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 @@ -889,6 +889,8 @@ public class SpeedBuilder extends SoloGame Manager.GetExplosion().BlockExplosion(blocks, eliminating.getMidpoint(), false, true); + eliminating.clearBuildArea(false); + judgeTargetLocation(null); _toEliminate.remove(eliminating); From c38596a09f949931ad35089d67179ec910baec67 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 21 Jan 2016 22:42:25 -0500 Subject: [PATCH 54/99] Name the guardian, 10 seconds to view builds --- .../game/games/speedbuilder/SpeedBuilder.java | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 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 ccc066c65..a9626d64a 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 @@ -46,6 +46,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Effect; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -84,6 +85,8 @@ import org.bukkit.util.Vector; public class SpeedBuilder extends SoloGame { + private static final String GUARDIAN_NAME = "Gwen the Guardian"; + //Build Size and some other values used commonly public int BuildSize = 7; public int BuildSizeDiv2 = BuildSize / 2; @@ -120,6 +123,8 @@ public class SpeedBuilder extends SoloGame private ArrayList _toEliminate = new ArrayList(); private long _lastElimination; private boolean _eliminating; + // Track the time we switch to review so we can give players 8 seconds to look around + private long _reviewStartTime; private NautHashMap _perfectBuild = new NautHashMap(); @@ -305,8 +310,10 @@ public class SpeedBuilder extends SoloGame _judgeEntity.setSmall(true); _judgeDisguise = new DisguiseGuardian(_judgeEntity); - + _judgeDisguise.setElder(true); + _judgeDisguise.setCustomNameVisible(true); + _judgeDisguise.setName(GUARDIAN_NAME); Manager.GetDisguise().disguise(_judgeDisguise); } @@ -642,13 +649,13 @@ public class SpeedBuilder extends SoloGame double distFromOther = UtilMath.offsetSquared(player.getLocation(), loc.clone().add(0.5, 0, 0.5)); - if (dist > distFromOther || player.getLocation().getY() < recreation.OriginalBuildLocation.getY() - 2) + if (player.getGameMode() != GameMode.SPECTATOR && (dist > distFromOther || player.getLocation().getY() < recreation.OriginalBuildLocation.getY() - 2)) { player.teleport(recreation.PlayerSpawn); - + UtilPlayer.message(player, F.main("Build", "You cannot leave your area!")); UtilTextMiddle.display("", C.cRed + "You cannot leave your area!", 0, 30, 10, player); - + break; } } @@ -734,6 +741,15 @@ public class SpeedBuilder extends SoloGame //Sometimes doesn't show in the update method UtilTextMiddle.display("", C.cRed + "TIME'S UP!", 0, 30, 10); + + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is judging", 0, 30, 10); + } + }, 40L); for (Player player : UtilServer.getPlayers()) { @@ -776,10 +792,18 @@ public class SpeedBuilder extends SoloGame _toEliminate.add(lowest); _lastElimination = System.currentTimeMillis(); + _reviewStartTime = System.currentTimeMillis(); pasteBuildInCenter(_currentBuild); setSpeedBuilderState(SpeedBuilderState.REVIEWING); + + for (Player player : GetTeamList().get(0).GetPlayers(true)) + { + player.setGameMode(GameMode.SPECTATOR); +// player.setAllowFlight(true); +// player.setFlying(true); + } } } else if (_state == SpeedBuilderState.REVIEWING) @@ -792,6 +816,13 @@ public class SpeedBuilder extends SoloGame clearCenterArea(true); _currentBuild = UtilAlg.Random(_buildData); + + for (Player player : GetTeamList().get(0).GetPlayers(true)) + { + player.setGameMode(GameMode.SURVIVAL); +// player.setAllowFlight(false); +// player.setFlying(false); + } for (RecreationData recreation : _buildRecreations.values()) { @@ -856,7 +887,7 @@ public class SpeedBuilder extends SoloGame } else { - if (UtilTime.elapsed(_lastElimination, 2000)) + if (UtilTime.elapsed(_reviewStartTime, 10000) && UtilTime.elapsed(_lastElimination, 2000)) { //Eliminate in order This also means that the empty builds are eliminated first final RecreationData eliminating = _toEliminate.get(0); From a38319147a346cd6e26527549f67ecce48b64650 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 21 Jan 2016 23:49:49 -0500 Subject: [PATCH 55/99] Stopped physics which fixed the torch bug. --- .../game/games/speedbuilder/SpeedBuilder.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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 c440cac87..fa47f50b2 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 @@ -65,6 +65,7 @@ import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.block.BlockFormEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; @@ -440,7 +441,13 @@ public class SpeedBuilder extends SoloGame return; } - _currentBuild = UtilAlg.Random(_buildData); + //_currentBuild = UtilAlg.Random(_buildData); + + do + { + _currentBuild = UtilAlg.Random(_buildData); + } + while (!hasRails(_currentBuild)); HashSet usedBuildLocs = new HashSet(); @@ -478,6 +485,23 @@ public class SpeedBuilder extends SoloGame setSpeedBuilderState(SpeedBuilderState.VIEWING); } + public boolean hasRails(BuildData buildData) + { + for (int x = 0; x < BuildSize; x++) + { + for (int y = 0; y < BuildSize; y++) + { + for (int z = 0; z < BuildSize; z++) + { + if (buildData.Build[x][y][z].getType() == Material.RAILS) + return true; + } + } + } + + return false; + } + @EventHandler public void onEnd(GameStateChangeEvent event) { @@ -1277,6 +1301,12 @@ public class SpeedBuilder extends SoloGame } } + @EventHandler + public void stopPhysics(BlockPhysicsEvent event) + { + event.setCancelled(true); + } + @EventHandler public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { From 0da921f3d2d29040332eb67a82161d45f515c52d Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 21 Jan 2016 23:52:59 -0500 Subject: [PATCH 56/99] Removed debug thing. --- .../game/games/speedbuilder/SpeedBuilder.java | 25 +------------------ 1 file changed, 1 insertion(+), 24 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 fa47f50b2..0aee0ae69 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 @@ -441,13 +441,7 @@ public class SpeedBuilder extends SoloGame return; } - //_currentBuild = UtilAlg.Random(_buildData); - - do - { - _currentBuild = UtilAlg.Random(_buildData); - } - while (!hasRails(_currentBuild)); + _currentBuild = UtilAlg.Random(_buildData); HashSet usedBuildLocs = new HashSet(); @@ -485,23 +479,6 @@ public class SpeedBuilder extends SoloGame setSpeedBuilderState(SpeedBuilderState.VIEWING); } - public boolean hasRails(BuildData buildData) - { - for (int x = 0; x < BuildSize; x++) - { - for (int y = 0; y < BuildSize; y++) - { - for (int z = 0; z < BuildSize; z++) - { - if (buildData.Build[x][y][z].getType() == Material.RAILS) - return true; - } - } - } - - return false; - } - @EventHandler public void onEnd(GameStateChangeEvent event) { From 5c83f5c1e5e9631f686a7d5dd04ead6e14f63049 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Fri, 22 Jan 2016 00:20:58 -0500 Subject: [PATCH 57/99] Renamed to Speed Builders from Speed Builder. --- .../core/achievement/Achievement.java | 24 ++--- .../core/achievement/AchievementCategory.java | 2 +- .../src/mineplex/core/game/GameDisplay.java | 2 +- .../src/nautilus/game/arcade/GameType.java | 4 +- .../games/speedbuilder/SpeedBuilderState.java | 10 -- .../stattrackers/DependableTracker.java | 8 +- .../stattrackers/FirstBuildTracker.java | 8 +- .../stattrackers/PerfectionistTracker.java | 10 +- .../SpeedBuilders.java} | 94 ++++++++++++------- .../speedbuilders/SpeedBuildersState.java | 10 ++ .../data/BuildData.java | 8 +- .../data/DemolitionData.java | 2 +- .../data/MobData.java | 2 +- .../data/RecreationData.java | 13 ++- .../events/PerfectBuildEvent.java | 10 +- .../kits/DefaultKit.java | 2 +- 16 files changed, 118 insertions(+), 91 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder/SpeedBuilder.java => speedbuilders/SpeedBuilders.java} (94%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/data/BuildData.java (92%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/data/DemolitionData.java (98%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/data/MobData.java (82%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/data/RecreationData.java (97%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/events/PerfectBuildEvent.java (66%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/kits/DefaultKit.java (90%) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 489393721..eee405349 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -856,29 +856,29 @@ public enum Achievement new int[]{30}, AchievementCategory.TYPE_WARS), - SPEED_BUILDER_SPEED_MASTER("Speed Master", 800, - new String[]{"Speed Builder.Wins"}, + SPEED_BUILDERS_SPEED_MASTER("Speed Master", 800, + new String[]{"Speed Builders.Wins"}, new String[]{"Win 10 Games of Speed Builder"}, new int[]{10}, - AchievementCategory.SPEED_BUILDER), + AchievementCategory.SPEED_BUILDERS), - SPEED_BUILDER_DEPENDABLE("Dependable", 1200, - new String[]{"Speed Builder.PerfectBuild"}, + SPEED_BUILDERS_DEPENDABLE("Dependable", 1200, + new String[]{"Speed Builders.PerfectBuild"}, new String[]{"Complete 10 Perfect Builds"}, new int[]{10}, - AchievementCategory.SPEED_BUILDER), + AchievementCategory.SPEED_BUILDERS), - SPEED_BUILDER_FIRST_BUILD("First Build!", 1800, - new String[]{"Speed Builder.PerfectFirst"}, + SPEED_BUILDERS_FIRST_BUILD("First Build!", 1800, + new String[]{"Speed Builders.PerfectFirst"}, new String[]{"Be the first person to complete a build in the game 10 times"}, new int[]{10}, - AchievementCategory.SPEED_BUILDER), + AchievementCategory.SPEED_BUILDERS), - SPEED_BUILDER_PERFECTIONIST("Perfectionist", 2200, - new String[]{"Speed Builder.PerfectWins"}, + SPEED_BUILDERS_PERFECTIONIST("Perfectionist", 2200, + new String[]{"Speed Builders.PerfectWins"}, new String[]{"Win a game of Speed Builder with a perfect build every round"}, new int[]{1}, - AchievementCategory.SPEED_BUILDER); + AchievementCategory.SPEED_BUILDERS); private String _name; private String[] _desc; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 3dc276aed..3d7bdd4a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -159,7 +159,7 @@ public enum AchievementCategory new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED}, Material.NAME_TAG, 0, GameCategory.CLASSICS, null), - SPEED_BUILDER("Speed Builder", null, + SPEED_BUILDERS("Speed Builders", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, Material.QUARTZ_BLOCK, 0, GameCategory.ARCADE, null); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 8b6d73523..31b1aaef0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -68,7 +68,7 @@ public enum GameDisplay Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), - SpeedBuilder("Speed Builder", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.ARCADE, 60), + SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.ARCADE, 60), ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 19b316d2e..58fe9a3a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -52,7 +52,7 @@ import nautilus.game.arcade.game.games.smash.TeamSuperSmash; import nautilus.game.arcade.game.games.snake.Snake; import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins; import nautilus.game.arcade.game.games.snowfight.SnowFight; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.games.spleef.Spleef; import nautilus.game.arcade.game.games.spleef.SpleefTeams; import nautilus.game.arcade.game.games.squidshooter.SquidShooter; @@ -114,7 +114,7 @@ public enum GameType Snake(Snake.class, GameDisplay.Snake), SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins), SnowFight(SnowFight.class, GameDisplay.SnowFight), - SpeedBuilder(SpeedBuilder.class, GameDisplay.SpeedBuilder), + SpeedBuilders(SpeedBuilders.class, GameDisplay.SpeedBuilders), Spleef(Spleef.class, GameDisplay.Spleef), SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams), SquidShooter(SquidShooter.class, GameDisplay.SquidShooter), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java deleted file mode 100644 index 67b86616a..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilderState.java +++ /dev/null @@ -1,10 +0,0 @@ -package nautilus.game.arcade.game.games.speedbuilder; - -public enum SpeedBuilderState -{ - - VIEWING, - BUILDING, - REVIEWING; - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java index 444080adb..abc6056f3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java @@ -1,15 +1,15 @@ package nautilus.game.arcade.game.games.speedbuilder.stattrackers; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; -import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; +import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; import nautilus.game.arcade.stats.StatTracker; import org.bukkit.event.EventHandler; -public class DependableTracker extends StatTracker +public class DependableTracker extends StatTracker { - public DependableTracker(SpeedBuilder game) + public DependableTracker(SpeedBuilders game) { super(game); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java index bc57488f1..da81b578a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java @@ -2,16 +2,16 @@ package nautilus.game.arcade.game.games.speedbuilder.stattrackers; import org.bukkit.event.EventHandler; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; -import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; +import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; import nautilus.game.arcade.stats.StatTracker; -public class FirstBuildTracker extends StatTracker +public class FirstBuildTracker extends StatTracker { private boolean _first = true; - public FirstBuildTracker(SpeedBuilder game) + public FirstBuildTracker(SpeedBuilders game) { super(game); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java index fc4aec573..76e4ca997 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java @@ -5,21 +5,21 @@ import java.util.Map.Entry; import mineplex.core.common.util.NautHashMap; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; -import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; +import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; import nautilus.game.arcade.stats.StatTracker; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -public class PerfectionistTracker extends StatTracker +public class PerfectionistTracker extends StatTracker { - private SpeedBuilder _game; + private SpeedBuilders _game; private NautHashMap _perfectBuilds = new NautHashMap(); - public PerfectionistTracker(SpeedBuilder game) + public PerfectionistTracker(SpeedBuilders game) { super(game); 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/speedbuilders/SpeedBuilders.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/SpeedBuilder.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 0aee0ae69..ba19bd630 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/speedbuilders/SpeedBuilders.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder; +package nautilus.game.arcade.game.games.speedbuilders; import java.util.ArrayList; import java.util.HashSet; @@ -31,15 +31,15 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.speedbuilder.data.BuildData; -import nautilus.game.arcade.game.games.speedbuilder.data.DemolitionData; -import nautilus.game.arcade.game.games.speedbuilder.data.MobData; -import nautilus.game.arcade.game.games.speedbuilder.data.RecreationData; -import nautilus.game.arcade.game.games.speedbuilder.events.PerfectBuildEvent; -import nautilus.game.arcade.game.games.speedbuilder.kits.DefaultKit; import nautilus.game.arcade.game.games.speedbuilder.stattrackers.DependableTracker; import nautilus.game.arcade.game.games.speedbuilder.stattrackers.FirstBuildTracker; import nautilus.game.arcade.game.games.speedbuilder.stattrackers.PerfectionistTracker; +import nautilus.game.arcade.game.games.speedbuilders.data.BuildData; +import nautilus.game.arcade.game.games.speedbuilders.data.DemolitionData; +import nautilus.game.arcade.game.games.speedbuilders.data.MobData; +import nautilus.game.arcade.game.games.speedbuilders.data.RecreationData; +import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; +import nautilus.game.arcade.game.games.speedbuilders.kits.DefaultKit; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; @@ -84,7 +84,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; -public class SpeedBuilder extends SoloGame +public class SpeedBuilders extends SoloGame { private static final String GUARDIAN_NAME = "Gwen the Guardian"; @@ -94,7 +94,7 @@ public class SpeedBuilder extends SoloGame public int BuildSizeMin1 = BuildSize - 1; public int BuildSizePow3 = BuildSize * BuildSize * BuildSize; - private SpeedBuilderState _state = SpeedBuilderState.VIEWING; + private SpeedBuildersState _state = SpeedBuildersState.VIEWING; private long _stateTime = System.currentTimeMillis(); private int _roundsPlayed; @@ -137,9 +137,9 @@ public class SpeedBuilder extends SoloGame private double _standMoveProgress; private Location _standStart; - public SpeedBuilder(ArcadeManager manager) + public SpeedBuilders(ArcadeManager manager) { - super(manager, GameType.SpeedBuilder, + super(manager, GameType.SpeedBuilders, new Kit[] { new DefaultKit(manager) @@ -204,13 +204,13 @@ public class SpeedBuilder extends SoloGame } } - public void setSpeedBuilderState(SpeedBuilderState state) + public void setSpeedBuilderState(SpeedBuildersState state) { _state = state; _stateTime = System.currentTimeMillis(); } - public SpeedBuilderState getSpeedBuilderState() + public SpeedBuildersState getSpeedBuilderState() { return _state; } @@ -476,7 +476,7 @@ public class SpeedBuilder extends SoloGame _roundsPlayed++; - setSpeedBuilderState(SpeedBuilderState.VIEWING); + setSpeedBuilderState(SpeedBuildersState.VIEWING); } @EventHandler @@ -508,7 +508,7 @@ public class SpeedBuilder extends SoloGame @EventHandler public void onBlockPlace(BlockPlaceEvent event) { - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -578,7 +578,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(player)) @@ -589,7 +589,7 @@ public class SpeedBuilder extends SoloGame if (_buildRecreations.get(player).calculateScoreFromBuild(_currentBuild) == _currentBuild.getPerfectScore()) { - PerfectBuildEvent perfectBuildEvent = new PerfectBuildEvent(player, SpeedBuilder.this); + PerfectBuildEvent perfectBuildEvent = new PerfectBuildEvent(player, SpeedBuilders.this); Bukkit.getServer().getPluginManager().callEvent(perfectBuildEvent); @@ -608,7 +608,7 @@ public class SpeedBuilder extends SoloGame @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerPickupItem(PlayerPickupItemEvent event) { - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -696,7 +696,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state == SpeedBuilderState.VIEWING) + if (_state == SpeedBuildersState.VIEWING) { if (UtilTime.elapsed(_stateTime, _viewTime * 1000)) { @@ -718,10 +718,10 @@ public class SpeedBuilder extends SoloGame UtilPlayer.message(player, F.main("Build", "Recreate the build shown.")); } - setSpeedBuilderState(SpeedBuilderState.BUILDING); + setSpeedBuilderState(SpeedBuildersState.BUILDING); } } - else if (_state == SpeedBuilderState.BUILDING) + else if (_state == SpeedBuildersState.BUILDING) { if (UtilTime.elapsed(_stateTime, _buildTime * 1000)) { @@ -797,7 +797,7 @@ public class SpeedBuilder extends SoloGame pasteBuildInCenter(_currentBuild); - setSpeedBuilderState(SpeedBuilderState.REVIEWING); + setSpeedBuilderState(SpeedBuildersState.REVIEWING); for (Player player : GetTeamList().get(0).GetPlayers(true)) { @@ -807,7 +807,7 @@ public class SpeedBuilder extends SoloGame } } } - else if (_state == SpeedBuilderState.REVIEWING) + else if (_state == SpeedBuildersState.REVIEWING) { if (_toEliminate.isEmpty()) { @@ -884,7 +884,7 @@ public class SpeedBuilder extends SoloGame UtilTextMiddle.display("", C.cGold + _currentBuild.BuildText, 0, 80, 10); - setSpeedBuilderState(SpeedBuilderState.VIEWING); + setSpeedBuilderState(SpeedBuildersState.VIEWING); } else { @@ -958,7 +958,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime); @@ -978,7 +978,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (UtilTime.elapsed(_stateTime, 1000 * _buildCountStage)) @@ -1009,7 +1009,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.VIEWING) + if (_state != SpeedBuildersState.VIEWING) return; if (UtilTime.elapsed(_stateTime, _viewCountStage * 1000)) @@ -1026,7 +1026,7 @@ public class SpeedBuilder extends SoloGame @EventHandler public void markBlockForDemolition(PlayerInteractEvent event) { - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -1055,7 +1055,7 @@ public class SpeedBuilder extends SoloGame Player player = (Player) event.getDamager(); - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(player)) @@ -1082,7 +1082,7 @@ public class SpeedBuilder extends SoloGame for (DemolitionData demolition : blocksForDemolition) { - if (_state != SpeedBuilderState.BUILDING || _perfectBuild.containsKey(demolition.Parent.Player)) + if (_state != SpeedBuildersState.BUILDING || _perfectBuild.containsKey(demolition.Parent.Player)) demolition.cancelBreak(); else demolition.update(); @@ -1111,7 +1111,7 @@ public class SpeedBuilder extends SoloGame if (!InProgress()) return; - if (_state != SpeedBuilderState.BUILDING && _state != SpeedBuilderState.VIEWING) + if (_state != SpeedBuildersState.BUILDING && _state != SpeedBuildersState.VIEWING) return; if (_buildRecreations.isEmpty()) @@ -1235,36 +1235,54 @@ public class SpeedBuilder extends SoloGame @EventHandler public void stopEntityChangeBlock(EntityChangeBlockEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @EventHandler public void stopBlockFade(BlockFadeEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @EventHandler public void stopBlockBurn(BlockBurnEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @EventHandler public void stopLeavesDecay(LeavesDecayEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @EventHandler public void stopBlockForm(BlockFormEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @EventHandler public void stopBlockSpread(BlockSpreadEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @@ -1281,6 +1299,9 @@ public class SpeedBuilder extends SoloGame @EventHandler public void stopPhysics(BlockPhysicsEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @@ -1290,7 +1311,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -1312,7 +1333,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!_buildRecreations.containsKey(event.getPlayer())) @@ -1334,7 +1355,7 @@ public class SpeedBuilder extends SoloGame if (!IsLive()) return; - if (_state != SpeedBuilderState.BUILDING) + if (_state != SpeedBuildersState.BUILDING) return; if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) @@ -1373,6 +1394,9 @@ public class SpeedBuilder extends SoloGame @EventHandler public void stopCombust(EntityCombustEvent event) { + if (!IsLive()) + return; + event.setCancelled(true); } @@ -1444,7 +1468,7 @@ public class SpeedBuilder extends SoloGame Scoreboard.WriteBlank(); - if (_state == SpeedBuilderState.BUILDING) + if (_state == SpeedBuildersState.BUILDING) { long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java new file mode 100644 index 000000000..4457fc3cb --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java @@ -0,0 +1,10 @@ +package nautilus.game.arcade.game.games.speedbuilders; + +public enum SpeedBuildersState +{ + + VIEWING, + BUILDING, + REVIEWING; + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java similarity index 92% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java index c9a8299e0..94cdbc2a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java @@ -1,9 +1,9 @@ -package nautilus.game.arcade.game.games.speedbuilder.data; +package nautilus.game.arcade.game.games.speedbuilders.data; import java.util.ArrayList; import mineplex.core.common.util.MapUtil; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape; @@ -22,7 +22,7 @@ import org.bukkit.material.Stairs; public class BuildData { - public SpeedBuilder Game; + public SpeedBuilders Game; public Location BuildMin; @@ -36,7 +36,7 @@ public class BuildData public ArrayList Mobs = new ArrayList(); - public BuildData(Location loc, String buildText, SpeedBuilder game) + public BuildData(Location loc, String buildText, SpeedBuilders game) { Build = new BlockState[game.BuildSize][game.BuildSize][game.BuildSize]; Ground = new BlockState[game.BuildSize][game.BuildSize]; 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/speedbuilders/data/DemolitionData.java similarity index 98% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/DemolitionData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java index 223ea2bb7..0c8193cee 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/speedbuilders/data/DemolitionData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.data; +package nautilus.game.arcade.game.games.speedbuilders.data; import java.util.ArrayList; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java similarity index 82% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java index ac07eb0be..51598b529 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/MobData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.data; +package nautilus.game.arcade.game.games.speedbuilders.data; import org.bukkit.entity.EntityType; 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/speedbuilders/data/RecreationData.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/data/RecreationData.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index c69606078..345e756c8 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/speedbuilders/data/RecreationData.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.data; +package nautilus.game.arcade.game.games.speedbuilders.data; import java.util.ArrayList; import java.util.List; @@ -9,7 +9,7 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; import net.minecraft.server.v1_8_R3.BlockStairs.EnumStairShape; @@ -35,7 +35,7 @@ import org.bukkit.util.Vector; public class RecreationData { - public SpeedBuilder Game; + public SpeedBuilders Game; public Player Player; @@ -54,7 +54,7 @@ public class RecreationData public ArrayList Mobs = new ArrayList(); - public RecreationData(SpeedBuilder game, Player player, Location loc, Location playerSpawn) + public RecreationData(SpeedBuilders game, Player player, Location loc, Location playerSpawn) { Game = game; @@ -272,7 +272,10 @@ public class RecreationData return false; } - return !buildData.Mobs.isEmpty() && Mobs.isEmpty(); + if (!buildData.Mobs.isEmpty()) + return Mobs.isEmpty(); + + return true; } public int calculateScoreFromBuild(BuildData buildData) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java similarity index 66% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java index ada7d8b8d..3608c9e23 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/events/PerfectBuildEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java @@ -1,6 +1,6 @@ -package nautilus.game.arcade.game.games.speedbuilder.events; +package nautilus.game.arcade.game.games.speedbuilders.events; -import nautilus.game.arcade.game.games.speedbuilder.SpeedBuilder; +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import org.bukkit.entity.Player; import org.bukkit.event.Event; @@ -12,9 +12,9 @@ public class PerfectBuildEvent extends Event private static final HandlerList handlers = new HandlerList(); private Player _player; - private SpeedBuilder _game; + private SpeedBuilders _game; - public PerfectBuildEvent(Player player, SpeedBuilder game) + public PerfectBuildEvent(Player player, SpeedBuilders game) { _player = player; _game = game; @@ -25,7 +25,7 @@ public class PerfectBuildEvent extends Event return _player; } - public SpeedBuilder getGame() + public SpeedBuilders getGame() { return _game; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java similarity index 90% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java index 394d29049..98516b510 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/kits/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.kits; +package nautilus.game.arcade.game.games.speedbuilders.kits; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; From c66f37817e2583a5ea21b9f5a3fa1ed35882f0ff Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Fri, 22 Jan 2016 01:22:31 -0500 Subject: [PATCH 58/99] Fixed invis bug. --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index ba19bd630..cda48f644 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -388,6 +388,8 @@ public class SpeedBuilders extends SoloGame Manager.GetDisguise().disguise(disguise); + player.setGameMode(GameMode.SURVIVAL); + player.setAllowFlight(true); player.setFlying(true); From 6bb60ddebd10490bc2554c9553841843cd847de4 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 22 Jan 2016 01:27:29 -0500 Subject: [PATCH 59/99] Ignore empty builds (untested!) --- .../games/speedbuilders/SpeedBuilders.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index ba19bd630..97b90731c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -190,7 +190,22 @@ public class SpeedBuilders extends SoloGame for (Entry> entry : WorldData.GetAllCustomLocs().entrySet()) { - _buildData.add(new BuildData(entry.getValue().get(0).clone().subtract(0.5, 0, 0.5), ChatColor.translateAlternateColorCodes('&', entry.getKey()), this)); + BuildData buildData = new BuildData(entry.getValue().get(0).clone().subtract(0.5, 0, 0.5), ChatColor.translateAlternateColorCodes('&', entry.getKey()), this); + boolean add = false; + for (int x = 0; x < BuildSize && !add; x++) + { + for (int y = 0; y < BuildSize && !add; y++) + { + for (int z = 0; z < BuildSize && !add; z++) + { + if (buildData.Build[x][y][z] != null && buildData.Build[x][y][z].getType() != Material.AIR) + add = true; + } + } + } + + if (add) + _buildData.add(new BuildData(entry.getValue().get(0).clone().subtract(0.5, 0, 0.5), ChatColor.translateAlternateColorCodes('&', entry.getKey()), this)); } for (Location loc : WorldData.GetDataLocs("YELLOW")) @@ -748,7 +763,7 @@ public class SpeedBuilders extends SoloGame @Override public void run() { - UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is judging", 0, 30, 10); + UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Judging", 0, 30, 10); } }, 40L); From 4bbd956e14d7476e2ab0244e944696cb45588e75 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 22 Jan 2016 01:37:47 -0500 Subject: [PATCH 60/99] Don't use the same build twice (untested!) --- .../src/mineplex/core/common/util/UtilAlg.java | 15 +++++++++++++++ .../game/games/speedbuilders/SpeedBuilders.java | 7 +++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index a1136d211..d01556e40 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -152,6 +152,21 @@ public class UtilAlg return list.get(UtilMath.r(list.size())); } + public static T Random(List list, List exclude) + { + int attempts = 0; + T element; + + do + { + element = Random(list); + attempts++; + } + while (element != null && exclude.contains(element) && attempts < 15); + + return element; + } + public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB) { if (loc.getX() <= Math.min(cornerA.getX(), cornerB.getX())) return false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index de69625ec..dc54d8dbb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -108,6 +108,7 @@ public class SpeedBuilders extends SoloGame private Location _buildMiddle; private ArrayList _buildData = new ArrayList(); + private ArrayList _usedBuilds = new ArrayList<>(); private BuildData _currentBuild; private BlockState[][] _defaultMiddleGround = new BlockState[BuildSize][BuildSize]; @@ -458,7 +459,8 @@ public class SpeedBuilders extends SoloGame return; } - _currentBuild = UtilAlg.Random(_buildData); + _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); + _usedBuilds.add(_currentBuild); HashSet usedBuildLocs = new HashSet(); @@ -833,7 +835,8 @@ public class SpeedBuilders extends SoloGame clearCenterArea(true); - _currentBuild = UtilAlg.Random(_buildData); + _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); + _usedBuilds.add(_currentBuild); for (Player player : GetTeamList().get(0).GetPlayers(true)) { From 3f715ab4dd7bbc5d75bc5f11862de76d00d5bada Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Fri, 22 Jan 2016 02:23:58 -0500 Subject: [PATCH 61/99] Enable inventory click. --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index dc54d8dbb..9c1a2de1a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -165,6 +165,8 @@ public class SpeedBuilders extends SoloGame AllowParticles = false; + InventoryClick = true; + registerStatTrackers( new DependableTracker(this), new FirstBuildTracker(this), From d0e5be9c935c55d1d8c75ba4280cc773c9e7138f Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 22 Jan 2016 18:35:18 -0500 Subject: [PATCH 62/99] Guardian is impressed (untested!) --- .../games/speedbuilders/SpeedBuilders.java | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 9c1a2de1a..cdf414f3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -129,6 +129,7 @@ public class SpeedBuilders extends SoloGame private long _reviewStartTime; private NautHashMap _perfectBuild = new NautHashMap(); + private boolean _allPerfect; private Location _lookTarget; private ArmorStand _lookStand; @@ -616,11 +617,20 @@ public class SpeedBuilders extends SoloGame player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, player); - Announce(F.main("Build", F.name(player.getName()) + " got a perfect build!")); _perfectBuild.put(player, System.currentTimeMillis()); + + if (_perfectBuild.size() == GetTeamList().get(0).GetPlayers(false).size()) + { + // Everyone has a perfect build + _allPerfect = true; + } + else + { + // Don't display middle text if everyone now has a perfect build + UtilTextMiddle.display("", C.cGreen + "Perfect Match", 0, 30, 10, player); + } } } }, 1L); @@ -744,7 +754,7 @@ public class SpeedBuilders extends SoloGame } else if (_state == SpeedBuildersState.BUILDING) { - if (UtilTime.elapsed(_stateTime, _buildTime * 1000)) + if (UtilTime.elapsed(_stateTime, _buildTime * 1000) || _allPerfect) { for (RecreationData recreation : _buildRecreations.values()) { @@ -760,18 +770,26 @@ public class SpeedBuilders extends SoloGame //Sometimes it stops on 0.1 and has one bar green UtilTextBottom.displayProgress("Time Left:", 0, UtilTime.MakeStr(0), UtilServer.getPlayers()); - - //Sometimes doesn't show in the update method - UtilTextMiddle.display("", C.cRed + "TIME'S UP!", 0, 30, 10); - Manager.runSyncLater(new Runnable() + if (_allPerfect) { - @Override - public void run() + UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Impressed!", 0, 30, 10); + _allPerfect = false; + } + else + { + //Sometimes doesn't show in the update method + UtilTextMiddle.display("", C.cRed + "TIME'S UP!", 0, 30, 10); + + Manager.runSyncLater(new Runnable() { - UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Judging", 0, 30, 10); - } - }, 40L); + @Override + public void run() + { + UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Judging", 0, 30, 10); + } + }, 40L); + } for (Player player : UtilServer.getPlayers()) { From ddc86f089738072270e963758e4f6e0f7ed6db0d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 22 Jan 2016 19:13:23 -0500 Subject: [PATCH 63/99] Add Speediest Builderizer achievement --- .../core/achievement/Achievement.java | 6 +++++ .../games/speedbuilders/SpeedBuilders.java | 9 ++++---- .../events/PerfectBuildEvent.java | 10 ++++++-- .../stattrackers/DependableTracker.java | 2 +- .../stattrackers/FirstBuildTracker.java | 2 +- .../stattrackers/PerfectionistTracker.java | 2 +- .../SpeediestBuilderizerTracker.java | 23 +++++++++++++++++++ 7 files changed, 45 insertions(+), 9 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/stattrackers/DependableTracker.java (88%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/stattrackers/FirstBuildTracker.java (89%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/{speedbuilder => speedbuilders}/stattrackers/PerfectionistTracker.java (95%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/SpeediestBuilderizerTracker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index eee405349..48ddcd897 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -878,6 +878,12 @@ public enum Achievement new String[]{"Speed Builders.PerfectWins"}, new String[]{"Win a game of Speed Builder with a perfect build every round"}, new int[]{1}, + AchievementCategory.SPEED_BUILDERS), + + SPEED_BUILDERS_SPEEDIEST("Speediest Builderizer", 2000, + new String[]{"Speed Builders.SpeediestBuilderizer"}, + new String[]{"Perfect a build in less than 10 seconds"}, + new int[]{1}, AchievementCategory.SPEED_BUILDERS); private String _name; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index cdf414f3a..ce39524a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -31,9 +31,9 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.speedbuilder.stattrackers.DependableTracker; -import nautilus.game.arcade.game.games.speedbuilder.stattrackers.FirstBuildTracker; -import nautilus.game.arcade.game.games.speedbuilder.stattrackers.PerfectionistTracker; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.DependableTracker; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTracker; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker; import nautilus.game.arcade.game.games.speedbuilders.data.BuildData; import nautilus.game.arcade.game.games.speedbuilders.data.DemolitionData; import nautilus.game.arcade.game.games.speedbuilders.data.MobData; @@ -611,7 +611,8 @@ public class SpeedBuilders extends SoloGame if (_buildRecreations.get(player).calculateScoreFromBuild(_currentBuild) == _currentBuild.getPerfectScore()) { - PerfectBuildEvent perfectBuildEvent = new PerfectBuildEvent(player, SpeedBuilders.this); + long timeElapsed = System.currentTimeMillis() - _stateTime; + PerfectBuildEvent perfectBuildEvent = new PerfectBuildEvent(player, timeElapsed, SpeedBuilders.this); Bukkit.getServer().getPluginManager().callEvent(perfectBuildEvent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java index 3608c9e23..a2fcc31e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/events/PerfectBuildEvent.java @@ -8,15 +8,16 @@ import org.bukkit.event.HandlerList; public class PerfectBuildEvent extends Event { - private static final HandlerList handlers = new HandlerList(); private Player _player; private SpeedBuilders _game; + private long _timeElapsed; // Build time elapsed in ms - public PerfectBuildEvent(Player player, SpeedBuilders game) + public PerfectBuildEvent(Player player, long timeElapsed, SpeedBuilders game) { _player = player; + _timeElapsed = timeElapsed; _game = game; } @@ -25,6 +26,11 @@ public class PerfectBuildEvent extends Event return _player; } + public long getTimeElapsed() + { + return _timeElapsed; + } + public SpeedBuilders getGame() { return _game; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/DependableTracker.java similarity index 88% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/DependableTracker.java index abc6056f3..2996d9db2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/DependableTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/DependableTracker.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.stattrackers; +package nautilus.game.arcade.game.games.speedbuilders.stattrackers; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/FirstBuildTracker.java similarity index 89% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/FirstBuildTracker.java index da81b578a..c79c55e41 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/FirstBuildTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/FirstBuildTracker.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.stattrackers; +package nautilus.game.arcade.game.games.speedbuilders.stattrackers; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java similarity index 95% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java index 76e4ca997..1dbca3847 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilder/stattrackers/PerfectionistTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.game.games.speedbuilder.stattrackers; +package nautilus.game.arcade.game.games.speedbuilders.stattrackers; import java.util.Map.Entry; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/SpeediestBuilderizerTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/SpeediestBuilderizerTracker.java new file mode 100644 index 000000000..800277a22 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/SpeediestBuilderizerTracker.java @@ -0,0 +1,23 @@ +package nautilus.game.arcade.game.games.speedbuilders.stattrackers; + +import org.bukkit.event.EventHandler; + +import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; +import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; +import nautilus.game.arcade.stats.StatTracker; + +public class SpeediestBuilderizerTracker extends StatTracker +{ + public SpeediestBuilderizerTracker(SpeedBuilders game) + { + super(game); + } + + @EventHandler + public void onPerfectBuild(PerfectBuildEvent event) + { + if (event.getTimeElapsed() < 10000) // 10 Seconds + addStat(event.getPlayer(), "SpeediestBuilderizer", 1, true, false); + } + +} From 02b45bd302be94e5a3a7801f7449860746a4aa49 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 22 Jan 2016 19:14:25 -0500 Subject: [PATCH 64/99] Forgot to register stat tracker --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index ce39524a9..6361c182d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -40,6 +40,7 @@ import nautilus.game.arcade.game.games.speedbuilders.data.MobData; import nautilus.game.arcade.game.games.speedbuilders.data.RecreationData; import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; import nautilus.game.arcade.game.games.speedbuilders.kits.DefaultKit; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; @@ -171,7 +172,8 @@ public class SpeedBuilders extends SoloGame registerStatTrackers( new DependableTracker(this), new FirstBuildTracker(this), - new PerfectionistTracker(this) + new PerfectionistTracker(this), + new SpeediestBuilderizerTracker(this) ); } From b2e4dff9e592025c908200145b4a63fd91a7081e Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 22 Jan 2016 19:18:23 -0500 Subject: [PATCH 65/99] Add time to perfect build message --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 6361c182d..e551481cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -619,8 +619,9 @@ public class SpeedBuilders extends SoloGame Bukkit.getServer().getPluginManager().callEvent(perfectBuildEvent); player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 10F, 1F); - - Announce(F.main("Build", F.name(player.getName()) + " got a perfect build!")); + + String time = UtilTime.convertString(timeElapsed, 1, UtilTime.TimeUnit.SECONDS); + Announce(F.main("Build", F.name(player.getName()) + " got a perfect build in " + F.time(time) + "!")); _perfectBuild.put(player, System.currentTimeMillis()); From 245cc1ed93040141639e7a59b7d81545f5c8a082 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Fri, 22 Jan 2016 22:18:29 -0500 Subject: [PATCH 66/99] Limit Perfectionist achievement to 1. --- .../games/speedbuilders/stattrackers/PerfectionistTracker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java index 1dbca3847..02de00fc5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/stattrackers/PerfectionistTracker.java @@ -43,7 +43,7 @@ public class PerfectionistTracker extends StatTracker for (Entry entry : _perfectBuilds.entrySet()) { if (entry.getValue().intValue() == _game.getRoundsPlayed()) - addStat(entry.getKey(), "PerfectWins", 1, false, false); + addStat(entry.getKey(), "PerfectWins", 1, true, false); } } From 5dc773032bd24b588638ce4ad95dad2d846a4631 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 23 Jan 2016 02:10:11 -0500 Subject: [PATCH 67/99] Add joining players to guardians team instead of spectator. --- .../games/speedbuilders/SpeedBuilders.java | 53 ++++++++++++++++--- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index e551481cf..6dd555789 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -31,15 +31,15 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.speedbuilders.stattrackers.DependableTracker; -import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTracker; -import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker; import nautilus.game.arcade.game.games.speedbuilders.data.BuildData; import nautilus.game.arcade.game.games.speedbuilders.data.DemolitionData; import nautilus.game.arcade.game.games.speedbuilders.data.MobData; import nautilus.game.arcade.game.games.speedbuilders.data.RecreationData; import nautilus.game.arcade.game.games.speedbuilders.events.PerfectBuildEvent; import nautilus.game.arcade.game.games.speedbuilders.kits.DefaultKit; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.DependableTracker; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTracker; +import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker; import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker; import nautilus.game.arcade.kit.Kit; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; @@ -77,6 +77,7 @@ import org.bukkit.event.entity.ItemMergeEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.world.StructureGrowEvent; @@ -396,10 +397,13 @@ public class SpeedBuilders extends SoloGame } } - public void moveToGuardians(Player player) + public void moveToGuardians(Player player, boolean elimination) { - GetTeamList().get(0).SetPlacement(player, PlayerState.OUT); - GetTeamList().get(0).RemovePlayer(player); + if (elimination) + { + GetTeamList().get(0).SetPlacement(player, PlayerState.OUT); + GetTeamList().get(0).RemovePlayer(player); + } GetTeamList().get(1).AddPlayer(player, true); @@ -423,7 +427,11 @@ public class SpeedBuilders extends SoloGame if (event.GetState() != GameState.Live) return; - GameTeam guardians = new GameTeam(this, "Guardians", ChatColor.GRAY, new ArrayList()); + //Add 1 spawn so it doesn't freak out + ArrayList spawns = new ArrayList(); + spawns.add(GetSpectatorLocation()); + + GameTeam guardians = new GameTeam(this, "Guardians", ChatColor.GRAY, spawns); AddTeam(guardians); } @@ -973,7 +981,7 @@ public class SpeedBuilders extends SoloGame _buildRecreations.remove(eliminating.Player); - moveToGuardians(eliminating.Player); + moveToGuardians(eliminating.Player, true); } }, 40L); } @@ -1444,6 +1452,34 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } + //Add to guardians before arcade manager adds to spectator to trick it into thinking the player is "alive" + @EventHandler(priority = EventPriority.LOW) + public void joinAddGuardian(PlayerJoinEvent event) + { + if (!InProgress()) + return; + + moveToGuardians(event.getPlayer(), false); + event.getPlayer().teleport(GetSpectatorLocation()); + + //We need to disguise a tick after + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + DisguiseGuardian disguise = new DisguiseGuardian(event.getPlayer()); + disguise.setName(C.cGray + event.getPlayer().getName()); + disguise.setCustomNameVisible(true); + + Manager.GetDisguise().disguise(disguise); + + event.getPlayer().setAllowFlight(true); + event.getPlayer().setFlying(true); + } + }, 1); + } + @Override public void EndCheck() { @@ -1489,6 +1525,7 @@ public class SpeedBuilders extends SoloGame List losers = GetTeamList().get(1).GetPlayers(false); losers.removeAll(winners); + losers.retainAll(GetTeamList().get(0).GetPlacements(true)); return losers; } From f82a408f30d8df4913af22cfedd47b763b0d5f46 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 23 Jan 2016 02:43:41 -0500 Subject: [PATCH 68/99] Build time modifiers --- .../games/speedbuilders/SpeedBuilders.java | 13 ++-- .../games/speedbuilders/data/BuildData.java | 78 +++++++++++++++++-- 2 files changed, 81 insertions(+), 10 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 6dd555789..285467016 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -103,7 +103,8 @@ public class SpeedBuilders extends SoloGame private int _buildCountStage; private int _viewCountStage; - + + private int _buildTimeTracker = 40; private int _buildTime = 40; private int _viewTime = 8; @@ -112,7 +113,7 @@ public class SpeedBuilders extends SoloGame private ArrayList _buildData = new ArrayList(); private ArrayList _usedBuilds = new ArrayList<>(); private BuildData _currentBuild; - + private BlockState[][] _defaultMiddleGround = new BlockState[BuildSize][BuildSize]; private ArrayList _middleMobs = new ArrayList(); @@ -474,6 +475,7 @@ public class SpeedBuilders extends SoloGame _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); _usedBuilds.add(_currentBuild); + _buildTime = _currentBuild.getBuildTime(_buildTimeTracker); HashSet usedBuildLocs = new HashSet(); @@ -869,6 +871,7 @@ public class SpeedBuilders extends SoloGame _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); _usedBuilds.add(_currentBuild); + _buildTime = _currentBuild.getBuildTime(_buildTimeTracker); for (Player player : GetTeamList().get(0).GetPlayers(true)) { @@ -923,9 +926,9 @@ public class SpeedBuilders extends SoloGame // } _roundsPlayed++; - - if (_buildTime > 1) - _buildTime--; + + if (_buildTimeTracker > 1) + _buildTimeTracker--; _viewCountStage = 0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java index 94cdbc2a0..1741d7fc4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java @@ -21,7 +21,6 @@ import org.bukkit.material.Stairs; public class BuildData { - public SpeedBuilders Game; public Location BuildMin; @@ -35,7 +34,12 @@ public class BuildData public String BuildText; public ArrayList Mobs = new ArrayList(); - + + private int _timeAdd = 0; + private int _timeSubtract = 0; + private int _timeEqual = -1; + private double _timeMultiplier = 1.0; + public BuildData(Location loc, String buildText, SpeedBuilders game) { Build = new BlockState[game.BuildSize][game.BuildSize][game.BuildSize]; @@ -43,8 +47,6 @@ public class BuildData StairShapes = new EnumStairShape[game.BuildSize][game.BuildSize][game.BuildSize]; - BuildText = buildText; - Game = game; Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, -3, game.BuildSizeDiv2); @@ -56,7 +58,9 @@ public class BuildData Ground[x][z] = groundMin.clone().add(x, 0, z).getBlock().getState(); } } - + + parseText(buildText); + Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, -4, game.BuildSizeDiv2); BuildMin = buildMin; @@ -108,6 +112,70 @@ public class BuildData } } + private void parseText(String buildText) + { + StringBuilder sb = new StringBuilder(); + for (String part : buildText.split(" ")) + { + if (part.matches("^time[\\Q+-=\\E][0-9]+$")) + { + // + - = add subtract or set seconds + try + { + int num = Integer.parseInt(part.substring(5)); + switch (part.charAt(4)) + { + case '-': + _timeSubtract = num; + break; + case '=': + _timeEqual = num; + break; + default: + _timeAdd = num; + } + } + catch (NumberFormatException e) + { + System.out.println("Failed parsing data for customloc: " + buildText); + e.printStackTrace(); + } + } + else if (part.matches("^time\\*[0-9]*\\.?[0-9]+$")) + { + // * multiply by a number + try + { + double num = Double.parseDouble(part.substring(5)); + _timeMultiplier = num; + } + catch (NumberFormatException e) + { + System.out.println("Failed parsing data for customloc: " + buildText); + e.printStackTrace(); + } + } + else + { + sb.append(part + " "); + } + } + + BuildText = sb.toString().trim(); + } + + public int getBuildTime(int unmodified) + { + int newTime = unmodified; + newTime += _timeAdd; + newTime -= _timeSubtract; + newTime = (int) (_timeMultiplier * newTime); + if (_timeEqual != -1) newTime = _timeEqual; + + // limit to range of 5-60 seconds + return Math.min(Math.max(newTime, 5), 60); + } + public int getPerfectScore() { return Game.BuildSizePow3 + Mobs.size(); From 650d586e0f3a9aa511175d93442083d4492b5b30 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sat, 23 Jan 2016 02:49:08 -0500 Subject: [PATCH 69/99] Add perfect build count to stats --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 3d7bdd4a2..b09f6eda3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -160,7 +160,7 @@ public enum AchievementCategory Material.NAME_TAG, 0, GameCategory.CLASSICS, null), SPEED_BUILDERS("Speed Builders", null, - new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")}, Material.QUARTZ_BLOCK, 0, GameCategory.ARCADE, null); From a75770b0a61e975cee7a25e6cd7351c57cf04876 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 23 Jan 2016 03:15:41 -0500 Subject: [PATCH 70/99] Change build to load from top instead of bottom. --- .../game/arcade/game/games/speedbuilders/data/BuildData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java index 1741d7fc4..71fa9664f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java @@ -49,7 +49,7 @@ public class BuildData Game = game; - Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, -3, game.BuildSizeDiv2); + Location groundMin = loc.clone().subtract(game.BuildSizeDiv2, 11, game.BuildSizeDiv2); for (int x = 0; x < game.BuildSize; x++) { @@ -61,7 +61,7 @@ public class BuildData parseText(buildText); - Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, -4, game.BuildSizeDiv2); + Location buildMin = loc.clone().subtract(game.BuildSizeDiv2, 10, game.BuildSizeDiv2); BuildMin = buildMin; From c1ff7f4fc22a4ba62e28740fb897c9ab1c9933a7 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 23 Jan 2016 19:32:23 +1100 Subject: [PATCH 71/99] all players equal, no one loses --- .../src/mineplex/mapparser/Parse.java | 13 ++++++++++++- .../game/games/speedbuilders/SpeedBuilders.java | 11 +++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java index a4702cc64..79d74e141 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java @@ -128,8 +128,19 @@ public class Parse String name = ""; try - { + { name = s.getLine(0); + + if (s.getLine(1) != null && s.getLine(1).length() > 0) + name += " " + s.getLine(1); + + if (s.getLine(2) != null && s.getLine(2).length() > 0) + name += " " + s.getLine(2); + + if (s.getLine(3) != null && s.getLine(3).length() > 0) + name += " " + s.getLine(3); + + System.out.println("Custom Location: " + name); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 285467016..e841e259b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -823,18 +823,25 @@ public class SpeedBuilders extends SoloGame RecreationData lowest = null; int lowestScore = -1; + boolean allPerfectMatch = !_buildRecreations.isEmpty(); + boolean allPlayersEqual = true; for (RecreationData recreation : _buildRecreations.values()) { int score = recreation.calculateScoreFromBuild(_currentBuild); + + if (lowest != null && lowestScore != score) + { + allPlayersEqual = false; + } if (lowest == null || lowestScore > score) { lowest = recreation; lowestScore = score; } - + if (score != _currentBuild.getPerfectScore()) allPerfectMatch = false; @@ -842,7 +849,7 @@ public class SpeedBuilders extends SoloGame _toEliminate.add(recreation); } - if (!allPerfectMatch && lowest != null && !_toEliminate.contains(lowest)) + if (!allPerfectMatch && !allPlayersEqual && lowest != null && !_toEliminate.contains(lowest)) _toEliminate.add(lowest); _lastElimination = System.currentTimeMillis(); From 1e732b08e744ef17aaa1ba431dc73e946e53ecfd Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 23 Jan 2016 03:42:36 -0500 Subject: [PATCH 72/99] TICK TICK TICK TICK. --- .../game/games/speedbuilders/SpeedBuilders.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 285467016..3b89dd4c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -1051,6 +1051,14 @@ public class SpeedBuilders extends SoloGame else if (_buildCountStage >= _buildTime - 5) UtilTextMiddle.display("", C.cGreen + (_buildTime - _buildCountStage), 0, 30, 10, players.toArray(new Player[players.size()])); + if (_buildCountStage >= _buildTime - 5) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - (float) (0.1 * (_buildTime - _buildCountStage))); + } + } + _buildCountStage++; } } @@ -1074,6 +1082,14 @@ public class SpeedBuilders extends SoloGame else if (_viewCountStage > 3) UtilTextMiddle.display("", C.cGreen + (_viewTime - _viewCountStage), 0, 30, 10); + if (_viewCountStage > 3) + { + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - (float) (0.1 * (_viewTime - _viewCountStage))); + } + } + _viewCountStage++; } } From a747426fa078c41dac227757ef6a58c29f7723e1 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sat, 23 Jan 2016 05:00:14 -0500 Subject: [PATCH 73/99] Fixed mobs. --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index bb65a978c..9943e6a49 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -213,7 +213,7 @@ public class SpeedBuilders extends SoloGame } if (add) - _buildData.add(new BuildData(entry.getValue().get(0).clone().subtract(0.5, 0, 0.5), ChatColor.translateAlternateColorCodes('&', entry.getKey()), this)); + _buildData.add(buildData); } for (Location loc : WorldData.GetDataLocs("YELLOW")) From 00f01e09afdf046c6254464c1c7476fd8656da6d Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 24 Jan 2016 20:00:05 +0100 Subject: [PATCH 74/99] adding entity spectating by right clicking and right clicking head in compass menu. --- .../src/nautilus/game/arcade/game/Game.java | 2 + .../spectatorMenu/button/SpectatorButton.java | 23 +++- .../arcade/managers/GameSpectatorManager.java | 101 ++++++++++++++++++ 3 files changed, 125 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 6eec52eb7..85eddd887 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -311,6 +311,8 @@ public abstract class Game implements Listener public boolean EnableTutorials = false; public boolean FixSpawnFacing = true; + + public boolean AllowEntitySpectate = true; private IPacketHandler _useEntityPacketHandler; private int _deadBodyCount; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java index fa5b7e111..06fbcdd56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java @@ -1,10 +1,13 @@ package nautilus.game.arcade.gui.spectatorMenu.button; +import org.bukkit.GameMode; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.shop.item.IButton; import nautilus.game.arcade.ArcadeManager; @@ -33,7 +36,25 @@ public class SpectatorButton implements IButton if (_arcadeManager.IsAlive(_target)) { - _player.teleport(_target.getLocation().add(0, 1, 0)); + if(clickType == ClickType.RIGHT) + { + _player.closeInventory(); + _player.teleport(_target.getLocation().add(0, 1, 0)); + _arcadeManager.runSyncLater(new Runnable() + { + @Override + public void run() + { + _player.setGameMode(GameMode.SPECTATOR); + _player.setSpectatorTarget(_target); + UtilPlayer.message(_player, F.main("Game", "Sneak to stop spectating")); + } + }, 3); + } + else + { + _player.teleport(_target.getLocation().add(0, 1, 0)); + } } else { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index f82d75403..b3e8079b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -1,14 +1,23 @@ package nautilus.game.arcade.managers; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.PlayerDisguiseManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; public class GameSpectatorManager implements Listener @@ -51,7 +60,99 @@ public class GameSpectatorManager implements Listener } if (!Manager.GetGame().IsAlive(player)) + { event.setCancelled(true); + if(Manager.GetGame().IsLive()) + { + if(Manager.GetGame().AllowEntitySpectate) + { + player.setGameMode(GameMode.SPECTATOR); + player.setSpectatorTarget(event.getRightClicked()); + UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating")); + } + } + } + } + + @EventHandler + public void updateSpecEntitys(UpdateEvent event) + { + if(event.getType() != UpdateType.FASTER) + return; + + if(Manager.GetGame() == null) + return; + + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) + { + if(Manager.GetGame().AllowEntitySpectate) + { + for(Player player : UtilServer.getPlayers()) + { + if (!Manager.GetGame().IsAlive(player)) + { + if(player.getGameMode() == GameMode.SPECTATOR) + { + if(player.getSpectatorTarget() == null) + { + player.setGameMode(GameMode.SURVIVAL); + player.setAllowFlight(true); + } + } + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void spectatedEntityDeath(PlayerDeathEvent event) + { + if(Manager.GetGame() == null) + return; + + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) + { + if(Manager.GetGame().AllowEntitySpectate) + { + for(Player player : UtilServer.getPlayers()) + { + if (!Manager.GetGame().IsAlive(player)) + { + if(player.getGameMode() == GameMode.SPECTATOR) + { + if(player.getSpectatorTarget() == event.getEntity()) + { + player.setGameMode(GameMode.SURVIVAL); + player.setAllowFlight(true); + } + } + } + } + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void dismountEntity(PlayerToggleSneakEvent event) + { + if(Manager.GetGame() == null) + return; + + if(Manager.GetGame().IsLive() || Manager.GetGame().GetState() == GameState.End) + { + if(Manager.GetGame().AllowEntitySpectate) + { + if(!Manager.GetGame().IsAlive(event.getPlayer())) + { + if(event.getPlayer().getGameMode() == GameMode.SPECTATOR) + { + event.getPlayer().setGameMode(GameMode.SURVIVAL); + event.getPlayer().setAllowFlight(true); + } + } + } + } } @EventHandler(priority = EventPriority.LOW) From 0eda813d41f02981408079b519b215927fe05e0d Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 24 Jan 2016 19:14:34 -0500 Subject: [PATCH 75/99] Fixed builds with only mobs not loading. --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 9943e6a49..66bc1652c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -211,6 +211,9 @@ public class SpeedBuilders extends SoloGame } } } + + if (!buildData.Mobs.isEmpty()) + add = true; if (add) _buildData.add(buildData); From bfe9aa7a59988025ea7da6332899035f37d862f6 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Sun, 24 Jan 2016 21:55:57 -0500 Subject: [PATCH 76/99] Remove unnecessary tabs. Make the judge guardian use it's own laser again. --- .../games/speedbuilders/SpeedBuilders.java | 155 ++++++++---------- .../speedbuilders/SpeedBuildersState.java | 2 +- .../games/speedbuilders/data/BuildData.java | 10 +- .../speedbuilders/data/DemolitionData.java | 24 +-- .../games/speedbuilders/data/MobData.java | 8 +- .../speedbuilders/data/RecreationData.java | 48 +++--- .../games/speedbuilders/kits/DefaultKit.java | 2 +- 7 files changed, 118 insertions(+), 131 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 66bc1652c..156ba6fff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -95,45 +95,44 @@ public class SpeedBuilders extends SoloGame public int BuildSizeDiv2 = BuildSize / 2; public int BuildSizeMin1 = BuildSize - 1; public int BuildSizePow3 = BuildSize * BuildSize * BuildSize; - + private SpeedBuildersState _state = SpeedBuildersState.VIEWING; private long _stateTime = System.currentTimeMillis(); - + private int _roundsPlayed; - + private int _buildCountStage; private int _viewCountStage; private int _buildTimeTracker = 40; private int _buildTime = 40; private int _viewTime = 8; - + private Location _buildMiddle; - + private ArrayList _buildData = new ArrayList(); private ArrayList _usedBuilds = new ArrayList<>(); private BuildData _currentBuild; private BlockState[][] _defaultMiddleGround = new BlockState[BuildSize][BuildSize]; private ArrayList _middleMobs = new ArrayList(); - + private NautHashMap _buildRecreations = new NautHashMap(); - + private ArmorStand _judgeEntity; private DisguiseGuardian _judgeDisguise; private Location _judgeSpawn; - private ArmorStand _judgeLaserHelper; private ArmorStand _judgeLaserTarget; - + private ArrayList _toEliminate = new ArrayList(); private long _lastElimination; private boolean _eliminating; // Track the time we switch to review so we can give players 8 seconds to look around private long _reviewStartTime; - + private NautHashMap _perfectBuild = new NautHashMap(); private boolean _allPerfect; - + private Location _lookTarget; private ArmorStand _lookStand; private long _targetReached; @@ -141,7 +140,7 @@ public class SpeedBuilders extends SoloGame private RecreationData _lastRecreationTarget; private double _standMoveProgress; private Location _standStart; - + public SpeedBuilders(ArcadeManager manager) { super(manager, GameType.SpeedBuilders, @@ -178,7 +177,7 @@ public class SpeedBuilders extends SoloGame new SpeediestBuilderizerTracker(this) ); } - + @Override public void ParseData() { @@ -229,28 +228,28 @@ public class SpeedBuilders extends SoloGame loc.setDirection(UtilAlg.getTrajectory(loc, _buildMiddle.clone().add(0.5, 0, 0.5))); } } - + public void setSpeedBuilderState(SpeedBuildersState state) { _state = state; _stateTime = System.currentTimeMillis(); } - + public SpeedBuildersState getSpeedBuilderState() { return _state; } - + public long getSpeedBuilderStateTime() { return _stateTime; } - + public int getRoundsPlayed() { return _roundsPlayed; } - + public void clearCenterArea(boolean resetGround) { Location buildMin = _buildMiddle.clone().subtract(BuildSizeDiv2, 0, BuildSizeDiv2); @@ -279,7 +278,7 @@ public class SpeedBuilders extends SoloGame } } } - + public void pasteBuildInCenter(BuildData buildData) { clearCenterArea(true); @@ -323,7 +322,7 @@ public class SpeedBuilders extends SoloGame CreatureAllowOverride = false; } - + public void spawnJudge() { CreatureAllowOverride = true; @@ -344,7 +343,7 @@ public class SpeedBuilders extends SoloGame Manager.GetDisguise().disguise(_judgeDisguise); } - + public void despawnJudge() { Manager.GetDisguise().undisguise(_judgeEntity); @@ -354,53 +353,41 @@ public class SpeedBuilders extends SoloGame _judgeDisguise = null; _judgeEntity = null; } - + public void judgeTargetLocation(Location loc) { if (loc == null) { if (_judgeLaserTarget == null) return; - - Manager.GetDisguise().undisguise(_judgeLaserHelper); - - _judgeLaserHelper.remove(); + _judgeLaserTarget.remove(); - - _judgeLaserHelper = null; + _judgeLaserTarget = null; + + _judgeDisguise.setTarget(0); + + Manager.GetDisguise().updateDisguise(_judgeDisguise); } else { if (_judgeLaserTarget != null) judgeTargetLocation(null); - CreatureAllowOverride = true; - - _judgeLaserHelper = _judgeEntity.getWorld().spawn(_judgeEntity.getLocation().subtract(_judgeEntity.getLocation().getDirection().multiply(2)), ArmorStand.class); _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); - CreatureAllowOverride = false; - - _judgeLaserHelper.setVisible(false); - _judgeLaserHelper.setGravity(false); - _judgeLaserHelper.setSmall(true); - _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); _judgeLaserTarget.setSmall(true); UtilEnt.CreatureLook(_judgeEntity, _judgeLaserTarget.getLocation()); - - DisguiseGuardian disguise = new DisguiseGuardian(_judgeLaserHelper); - disguise.setTarget(_judgeLaserTarget.getEntityId()); - disguise.setInvisible(true); + _judgeDisguise.setTarget(_judgeLaserTarget.getEntityId()); - Manager.GetDisguise().disguise(disguise); + Manager.GetDisguise().updateDisguise(_judgeDisguise); } } - + public void moveToGuardians(Player player, boolean elimination) { if (elimination) @@ -424,7 +411,7 @@ public class SpeedBuilders extends SoloGame EndCheck(); } - + @EventHandler(priority = EventPriority.MONITOR) public void teamGen(GameStateChangeEvent event) { @@ -439,7 +426,7 @@ public class SpeedBuilders extends SoloGame AddTeam(guardians); } - + @EventHandler(priority = EventPriority.LOWEST) public void onPrepare(GameStateChangeEvent event) { @@ -462,7 +449,7 @@ public class SpeedBuilders extends SoloGame Manager.getCosmeticManager().setHideParticles(true); } - + @EventHandler public void onLive(GameStateChangeEvent event) { @@ -515,7 +502,7 @@ public class SpeedBuilders extends SoloGame setSpeedBuilderState(SpeedBuildersState.VIEWING); } - + @EventHandler public void onEnd(GameStateChangeEvent event) { @@ -541,7 +528,7 @@ public class SpeedBuilders extends SoloGame _toEliminate.remove(recreation); } } - + @EventHandler public void onBlockPlace(BlockPlaceEvent event) { @@ -588,20 +575,20 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } - + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBuildFinish(final BlockPlaceEvent event) { checkPerfectBuild(event.getPlayer()); } - + //This is here because if you open a door then close it you won't be informed of a perfect build @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void interactInformSuccess(PlayerInteractEvent event) { checkPerfectBuild(event.getPlayer()); } - + public void checkPerfectBuild(Player player) { if (_perfectBuild.containsKey(player)) @@ -652,7 +639,7 @@ public class SpeedBuilders extends SoloGame } }, 1L); } - + @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerPickupItem(PlayerPickupItemEvent event) { @@ -667,13 +654,13 @@ public class SpeedBuilders extends SoloGame else event.setCancelled(true); } - + @EventHandler public void stopItemMerge(ItemMergeEvent event) { event.setCancelled(true); } - + @EventHandler public void stopMoveOffArea(UpdateEvent event) { @@ -710,7 +697,7 @@ public class SpeedBuilders extends SoloGame } } } - + @EventHandler public void stopGuardiansBuildEnter(UpdateEvent event) { @@ -734,7 +721,7 @@ public class SpeedBuilders extends SoloGame } } } - + @EventHandler public void stateUpdate(UpdateEvent event) { @@ -1013,7 +1000,7 @@ public class SpeedBuilders extends SoloGame } } } - + @EventHandler public void buildTimeProgressBar(UpdateEvent event) { @@ -1033,7 +1020,7 @@ public class SpeedBuilders extends SoloGame UtilTextBottom.displayProgress("Time Left", timeLeft / (_buildTime * 1000.0D), UtilTime.MakeStr(timeLeft), UtilServer.getPlayers()); } - + @EventHandler public void buildEndCountdown(UpdateEvent event) { @@ -1072,7 +1059,7 @@ public class SpeedBuilders extends SoloGame _buildCountStage++; } } - + @EventHandler public void viewCountdown(UpdateEvent event) { @@ -1103,7 +1090,7 @@ public class SpeedBuilders extends SoloGame _viewCountStage++; } } - + @EventHandler public void markBlockForDemolition(PlayerInteractEvent event) { @@ -1127,7 +1114,7 @@ public class SpeedBuilders extends SoloGame _buildRecreations.get(event.getPlayer()).addToDemolition(event.getClickedBlock()); } - + @EventHandler public void markMobForDemolition(EntityDamageByEntityEvent event) { @@ -1150,7 +1137,7 @@ public class SpeedBuilders extends SoloGame _buildRecreations.get(player).addToDemolition(event.getEntity()); } - + @EventHandler public void updateDemolitionBlocks(UpdateEvent event) { @@ -1170,13 +1157,13 @@ public class SpeedBuilders extends SoloGame } } } - + @EventHandler public void preventBlockGrowth(BlockGrowEvent event) { event.setCancelled(true); } - + @EventHandler public void preventStructureGrowth(StructureGrowEvent event) { @@ -1242,7 +1229,7 @@ public class SpeedBuilders extends SoloGame _standMoveProgress += 0.2; } - + private void moveEntity(Location loc, Entity entity) { double dx = loc.getX() - entity.getLocation().getX(); @@ -1251,7 +1238,7 @@ public class SpeedBuilders extends SoloGame ((CraftEntity) entity).getHandle().move(dx, dy, dz); } - + @EventHandler public void specNightVision(UpdateEvent event) { @@ -1292,7 +1279,7 @@ public class SpeedBuilders extends SoloGame // Manager.GetCondition().Factory().Cloak("Guardian POV", player, null, 999999999, false, false); // } // } - + @EventHandler public void stopGuardianSpecPickup(PlayerPickupItemEvent event) { @@ -1302,7 +1289,7 @@ public class SpeedBuilders extends SoloGame if (Manager.isSpectator(event.getPlayer()) || GetTeamList().get(1).HasPlayer(event.getPlayer())) event.setCancelled(true); } - + @EventHandler public void stopGuardianSpecPlace(BlockPlaceEvent event) { @@ -1312,7 +1299,7 @@ public class SpeedBuilders extends SoloGame if (Manager.isSpectator(event.getPlayer()) || GetTeamList().get(1).HasPlayer(event.getPlayer())) event.setCancelled(true); } - + @EventHandler public void stopEntityChangeBlock(EntityChangeBlockEvent event) { @@ -1321,7 +1308,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void stopBlockFade(BlockFadeEvent event) { @@ -1330,7 +1317,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void stopBlockBurn(BlockBurnEvent event) { @@ -1339,7 +1326,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void stopLeavesDecay(LeavesDecayEvent event) { @@ -1348,7 +1335,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void stopBlockForm(BlockFormEvent event) { @@ -1357,7 +1344,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void stopBlockSpread(BlockSpreadEvent event) { @@ -1366,7 +1353,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void stopLiquidLeaks(BlockFromToEvent event) { @@ -1376,7 +1363,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } } - + @EventHandler public void stopPhysics(BlockPhysicsEvent event) { @@ -1385,7 +1372,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + @EventHandler public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { @@ -1407,7 +1394,7 @@ public class SpeedBuilders extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } } - + @EventHandler public void onPlayerBucketFill(PlayerBucketFillEvent event) { @@ -1429,7 +1416,7 @@ public class SpeedBuilders extends SoloGame UtilPlayer.message(event.getPlayer(), F.main("Build", "Cannot build outside your area!")); } } - + @EventHandler public void addMob(PlayerInteractEvent event) { @@ -1471,7 +1458,7 @@ public class SpeedBuilders extends SoloGame UtilInv.remove(event.getPlayer(), Material.MONSTER_EGG, (byte) event.getItem().getDurability(), 1); } - + @EventHandler public void stopCombust(EntityCombustEvent event) { @@ -1480,7 +1467,7 @@ public class SpeedBuilders extends SoloGame event.setCancelled(true); } - + //Add to guardians before arcade manager adds to spectator to trick it into thinking the player is "alive" @EventHandler(priority = EventPriority.LOW) public void joinAddGuardian(PlayerJoinEvent event) @@ -1508,7 +1495,7 @@ public class SpeedBuilders extends SoloGame } }, 1); } - + @Override public void EndCheck() { @@ -1542,7 +1529,7 @@ public class SpeedBuilders extends SoloGame SetState(GameState.End); } } - + @Override public List getLosers() { @@ -1558,7 +1545,7 @@ public class SpeedBuilders extends SoloGame return losers; } - + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java index 4457fc3cb..d79445240 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuildersState.java @@ -6,5 +6,5 @@ public enum SpeedBuildersState VIEWING, BUILDING, REVIEWING; - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java index 71fa9664f..dccfd0a88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java @@ -22,17 +22,17 @@ import org.bukkit.material.Stairs; public class BuildData { public SpeedBuilders Game; - + public Location BuildMin; - + public BlockState[][][] Build; public BlockState[][] Ground; - + //Store stair shapes for stair fix public EnumStairShape[][][] StairShapes; - + public String BuildText; - + public ArrayList Mobs = new ArrayList(); private int _timeAdd = 0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java index 0c8193cee..e30b67976 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java @@ -24,19 +24,19 @@ import org.bukkit.material.Door; public class DemolitionData { - + public RecreationData Parent; - + public NautHashMap Blocks; public ArrayList Mobs; - + public long Start; - + private Hologram _hologram; - + private boolean _flickerAir = true; private long _lastFlicker = System.currentTimeMillis(); - + public DemolitionData(RecreationData parent, ArrayList blocks, ArrayList mobs) { Parent = parent; @@ -53,7 +53,7 @@ public class DemolitionData spawnHologram(); } - + public void spawnHologram() { Location loc = Parent.getMidpoint(); @@ -67,14 +67,14 @@ public class DemolitionData _hologram.start(); } - + public void despawnHologram() { _hologram.stop(); _hologram = null; } - + public void update() { int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D); @@ -110,7 +110,7 @@ public class DemolitionData if (secondsLeft == 0) breakBlocks(); } - + public void cancelBreak() { despawnHologram(); @@ -127,7 +127,7 @@ public class DemolitionData Parent.BlocksForDemolition.remove(this); } - + public void breakBlocks() { despawnHologram(); @@ -207,5 +207,5 @@ public class DemolitionData Parent.Game.checkPerfectBuild(Parent.Player); } - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java index 51598b529..51858381c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/MobData.java @@ -4,13 +4,13 @@ import org.bukkit.entity.EntityType; public class MobData { - + public EntityType EntityType; - + public int DX; public int DY; public int DZ; - + public MobData(EntityType entityType, int dx, int dy, int dz) { EntityType = entityType; @@ -19,5 +19,5 @@ public class MobData DY = dy; DZ = dz; } - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 345e756c8..c52927135 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -34,26 +34,26 @@ import org.bukkit.util.Vector; public class RecreationData { - + public SpeedBuilders Game; - + public Player Player; - + public BlockState[][] DefaultGround; - + public Location OriginalBuildLocation; - + public Location CornerA; public Location CornerB; - + public Location PlayerSpawn; - + public NautHashMap DroppedItems = new NautHashMap(); - + public ArrayList BlocksForDemolition = new ArrayList(); - + public ArrayList Mobs = new ArrayList(); - + public RecreationData(SpeedBuilders game, Player player, Location loc, Location playerSpawn) { Game = game; @@ -77,7 +77,7 @@ public class RecreationData } } } - + public boolean inBuildArea(Block block) { if (block.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX())) @@ -100,7 +100,7 @@ public class RecreationData return true; } - + public boolean inBuildArea(Location loc) { if (loc.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX())) @@ -123,7 +123,7 @@ public class RecreationData return true; } - + public void clearBuildArea(boolean resetGround) { for (Block block : getBlocks()) @@ -149,7 +149,7 @@ public class RecreationData } } } - + public void pasteBuildData(BuildData buildData) { clearBuildArea(true); @@ -189,7 +189,7 @@ public class RecreationData Game.CreatureAllowOverride = false; } - + public void breakAndDropItems() { for (Block block : getBlocks()) @@ -263,7 +263,7 @@ public class RecreationData item.setVelocity(Player.getLocation().toVector().subtract(item.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); } } - + public boolean isEmptyBuild(BuildData buildData) { for (Block block : getBlocks()) @@ -277,7 +277,7 @@ public class RecreationData return true; } - + public int calculateScoreFromBuild(BuildData buildData) { int score = 0; @@ -348,17 +348,17 @@ public class RecreationData return score; } - + public Location getMidpoint() { return UtilAlg.getMidpoint(CornerA, CornerB.clone().add(1, 1, 1)); } - + public List getBlocks() { return UtilBlock.getInBoundingBox(CornerA, CornerB); } - + public boolean isQueuedForDemolition(Block block) { for (DemolitionData demolition : BlocksForDemolition) @@ -369,7 +369,7 @@ public class RecreationData return false; } - + public boolean isQueuedForDemolition(Entity entity) { for (DemolitionData demolition : BlocksForDemolition) @@ -380,7 +380,7 @@ public class RecreationData return false; } - + public void addToDemolition(Block block) { if (isQueuedForDemolition(block)) @@ -418,7 +418,7 @@ public class RecreationData BlocksForDemolition.add(new DemolitionData(this, blocks, new ArrayList())); } - + public void addToDemolition(Entity entity) { if (isQueuedForDemolition(entity)) @@ -429,5 +429,5 @@ public class RecreationData BlocksForDemolition.add(new DemolitionData(this, new ArrayList(), mobs)); } - + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java index 98516b510..ff79b7fc0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/kits/DefaultKit.java @@ -20,7 +20,7 @@ public class DefaultKit extends Kit }, new Perk[] { - + }, EntityType.ZOMBIE, null); } From 9e63c9000ae06ad706141ac5f762c3ce757e3059 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 25 Jan 2016 04:30:42 +0100 Subject: [PATCH 77/99] adding spectator rotation. --- .../spectatorMenu/button/SpectatorButton.java | 3 + .../arcade/managers/GameSpectatorManager.java | 110 +++++++++++++++++- 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java index 06fbcdd56..d2f170f5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/button/SpectatorButton.java @@ -5,9 +5,11 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; +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.common.util.UtilTextBottom; import mineplex.core.shop.item.IButton; import nautilus.game.arcade.ArcadeManager; @@ -47,6 +49,7 @@ public class SpectatorButton implements IButton { _player.setGameMode(GameMode.SPECTATOR); _player.setSpectatorTarget(_target); + UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(_target.getName()), player); UtilPlayer.message(_player, F.main("Game", "Sneak to stop spectating")); } }, 3); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index b3e8079b5..26dc0ab4d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -1,24 +1,33 @@ package nautilus.game.arcade.managers; +import java.util.List; + +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.common.util.UtilRadar; import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.PlayerDisguiseManager; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; +import org.bukkit.inventory.ItemStack; public class GameSpectatorManager implements Listener { @@ -31,7 +40,7 @@ public class GameSpectatorManager implements Listener Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void interactCancel(PlayerInteractEvent event) { if (Manager.GetGame() == null) @@ -41,6 +50,46 @@ public class GameSpectatorManager implements Listener if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); + + if(!Manager.GetGame().AllowEntitySpectate) + return; + + if(!Manager.GetGame().IsLive()) + return; + + if(player.getGameMode() != GameMode.SPECTATOR) + return; + + if(player.getSpectatorTarget() == null) + return; + + if(!(player.getSpectatorTarget() instanceof Player)) + return; + + List players = Manager.GetGame().GetPlayers(true); + int currentPlayer = 0; + for(Player otherPlayer : players) + { + currentPlayer++; + if(((Player) player.getSpectatorTarget()) == otherPlayer) + break; + } + + if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + currentPlayer = currentPlayer - 2; + + if(currentPlayer < 0) + currentPlayer = players.size() - 1; + + if(currentPlayer >= players.size()) + currentPlayer = 0; + + if(players.get(currentPlayer) == null) + return; + + Player specPlayer = players.get(currentPlayer); + + setSpectating(player, specPlayer); } @EventHandler(priority = EventPriority.LOW) @@ -66,9 +115,14 @@ public class GameSpectatorManager implements Listener { if(Manager.GetGame().AllowEntitySpectate) { - player.setGameMode(GameMode.SPECTATOR); - player.setSpectatorTarget(event.getRightClicked()); - UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating")); + setSpectating(player, event.getRightClicked()); +// player.setGameMode(GameMode.SPECTATOR); +// player.setSpectatorTarget(event.getRightClicked()); +// UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating")); +// if(event.getRightClicked() instanceof Player) +// { +// UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(((Player) event.getRightClicked()).getName()), player); +// } } } } @@ -97,6 +151,10 @@ public class GameSpectatorManager implements Listener { player.setGameMode(GameMode.SURVIVAL); player.setAllowFlight(true); + for(int i = 1; i <= 7; i++) + { + player.getInventory().setItem(i, null); + } } } } @@ -123,8 +181,17 @@ public class GameSpectatorManager implements Listener { if(player.getSpectatorTarget() == event.getEntity()) { + if(Manager.GetGame().GetPlayers(true).size() >= 1) + { + setSpectating(player, Manager.GetGame().GetPlayers(true).get(UtilMath.r(Manager.GetGame().GetPlayers(true).size()))); + return; + } player.setGameMode(GameMode.SURVIVAL); player.setAllowFlight(true); + for(int i = 1; i <= 7; i++) + { + player.getInventory().setItem(i, null); + } } } } @@ -149,12 +216,45 @@ public class GameSpectatorManager implements Listener { event.getPlayer().setGameMode(GameMode.SURVIVAL); event.getPlayer().setAllowFlight(true); + for(int i = 1; i <= 7; i++) + { + event.getPlayer().getInventory().setItem(i, null); + } } } } } } + private void setSpectating(Player player, Entity target) + { + player.setGameMode(GameMode.SURVIVAL); + player.teleport(target.getLocation().add(0, 1, 0)); + player.getInventory().setHeldItemSlot(5); + for(int i = 1; i <= 7; i++) + { + player.getInventory().setItem(i, new ItemStack(Material.STONE)); + } + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + if(target instanceof Player) + { + if(!Manager.GetGame().IsAlive(target)) + return; + } + player.setGameMode(GameMode.SPECTATOR); + player.setSpectatorTarget(target); + if(target instanceof Player) + UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(((Player) target).getName()), player); + + UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating")); + } + }, 3); + } + @EventHandler(priority = EventPriority.LOW) public void vehicleDamage(VehicleDamageEvent event) { From f722831e6a836f1ae3a3849b50237abc3904a3d7 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 25 Jan 2016 05:44:06 +0100 Subject: [PATCH 78/99] removing switching players until spigot patch is on. --- .../arcade/managers/GameSpectatorManager.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index 26dc0ab4d..bb0b87bae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -14,6 +14,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -22,6 +23,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -42,7 +44,7 @@ public class GameSpectatorManager implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void interactCancel(PlayerInteractEvent event) - { + { if (Manager.GetGame() == null) return; @@ -51,6 +53,14 @@ public class GameSpectatorManager implements Listener if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); + //processClick(player, event.getAction()); + } + + /*public void processClick(Player player, Action action) + { + if (Manager.GetGame() == null) + return; + if(!Manager.GetGame().AllowEntitySpectate) return; @@ -75,7 +85,7 @@ public class GameSpectatorManager implements Listener break; } - if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) currentPlayer = currentPlayer - 2; if(currentPlayer < 0) @@ -90,7 +100,7 @@ public class GameSpectatorManager implements Listener Player specPlayer = players.get(currentPlayer); setSpectating(player, specPlayer); - } + }*/ @EventHandler(priority = EventPriority.LOW) public void interactEntityCancel(PlayerInteractEntityEvent event) From 31ef7ffe19d745f902332ca7d92fd1e0cee06fa1 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 25 Jan 2016 07:45:38 +0100 Subject: [PATCH 79/99] Removing right clicking. --- .../arcade/managers/GameSpectatorManager.java | 34 ++++--------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java index bb0b87bae..0082fc1ce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -6,7 +6,6 @@ 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.common.util.UtilRadar; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.updater.UpdateType; @@ -23,10 +22,10 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.inventory.ItemStack; @@ -53,10 +52,10 @@ public class GameSpectatorManager implements Listener if (!Manager.GetGame().IsAlive(player)) event.setCancelled(true); - //processClick(player, event.getAction()); + processClick(player, event.getAction()); } - /*public void processClick(Player player, Action action) + public void processClick(Player player, Action action) { if (Manager.GetGame() == null) return; @@ -87,6 +86,8 @@ public class GameSpectatorManager implements Listener if(action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) currentPlayer = currentPlayer - 2; + else + return; if(currentPlayer < 0) currentPlayer = players.size() - 1; @@ -100,7 +101,7 @@ public class GameSpectatorManager implements Listener Player specPlayer = players.get(currentPlayer); setSpectating(player, specPlayer); - }*/ + } @EventHandler(priority = EventPriority.LOW) public void interactEntityCancel(PlayerInteractEntityEvent event) @@ -126,13 +127,6 @@ public class GameSpectatorManager implements Listener if(Manager.GetGame().AllowEntitySpectate) { setSpectating(player, event.getRightClicked()); -// player.setGameMode(GameMode.SPECTATOR); -// player.setSpectatorTarget(event.getRightClicked()); -// UtilPlayer.message(player, F.main("Game", "Sneak to stop spectating")); -// if(event.getRightClicked() instanceof Player) -// { -// UtilTextBottom.display(C.cYellow + "You are spectating " + F.game(((Player) event.getRightClicked()).getName()), player); -// } } } } @@ -161,10 +155,6 @@ public class GameSpectatorManager implements Listener { player.setGameMode(GameMode.SURVIVAL); player.setAllowFlight(true); - for(int i = 1; i <= 7; i++) - { - player.getInventory().setItem(i, null); - } } } } @@ -198,10 +188,6 @@ public class GameSpectatorManager implements Listener } player.setGameMode(GameMode.SURVIVAL); player.setAllowFlight(true); - for(int i = 1; i <= 7; i++) - { - player.getInventory().setItem(i, null); - } } } } @@ -226,10 +212,6 @@ public class GameSpectatorManager implements Listener { event.getPlayer().setGameMode(GameMode.SURVIVAL); event.getPlayer().setAllowFlight(true); - for(int i = 1; i <= 7; i++) - { - event.getPlayer().getInventory().setItem(i, null); - } } } } @@ -241,10 +223,6 @@ public class GameSpectatorManager implements Listener player.setGameMode(GameMode.SURVIVAL); player.teleport(target.getLocation().add(0, 1, 0)); player.getInventory().setHeldItemSlot(5); - for(int i = 1; i <= 7; i++) - { - player.getInventory().setItem(i, new ItemStack(Material.STONE)); - } Manager.runSyncLater(new Runnable() { @Override From 219b86ae5585f7eaa3095e8013d337afca299c41 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 25 Jan 2016 03:01:54 -0500 Subject: [PATCH 80/99] Chiss' checklist. --- .../mineplex/core/common/util/UtilBlock.java | 3 + .../nautilus/game/arcade/ArcadeManager.java | 4 + .../games/speedbuilders/SpeedBuilders.java | 163 ++++++++++++++---- .../games/speedbuilders/data/BuildData.java | 16 +- .../speedbuilders/data/DemolitionData.java | 16 ++ .../speedbuilders/data/RecreationData.java | 26 +-- 6 files changed, 178 insertions(+), 50 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index c0a7f5f3b..3acb09f70 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -1405,6 +1405,9 @@ public class UtilBlock itemStack.setType(Material.DARK_OAK_DOOR_ITEM); itemStack.setDurability((short) 0); break; + case ANVIL: + itemStack.setDurability((short) (itemStack.getDurability() / 4)); + break; } return itemStacks; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index ab789b8c1..aa2219bfa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1164,6 +1164,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (event.GetState() == GameState.Recruit) { getCosmeticManager().setActive(true); + getCosmeticManager().setHideParticles(false); } else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead) { @@ -1175,6 +1176,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation getCosmeticManager().disableItemsForGame(); } } + + if (!event.GetGame().AllowParticles) + getCosmeticManager().setHideParticles(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 156ba6fff..8a0e46d19 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -5,6 +5,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map.Entry; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; @@ -76,6 +77,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.ItemMergeEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -96,6 +98,8 @@ public class SpeedBuilders extends SoloGame public int BuildSizeMin1 = BuildSize - 1; public int BuildSizePow3 = BuildSize * BuildSize * BuildSize; + public boolean InstaBreak = true; + private SpeedBuildersState _state = SpeedBuildersState.VIEWING; private long _stateTime = System.currentTimeMillis(); @@ -106,7 +110,7 @@ public class SpeedBuilders extends SoloGame private int _buildTimeTracker = 40; private int _buildTime = 40; - private int _viewTime = 8; + private int _viewTime = 10; private Location _buildMiddle; @@ -140,6 +144,8 @@ public class SpeedBuilders extends SoloGame private RecreationData _lastRecreationTarget; private double _standMoveProgress; private Location _standStart; + + private BuildData _nextBuild; public SpeedBuilders(ArcadeManager manager) { @@ -374,8 +380,12 @@ public class SpeedBuilders extends SoloGame if (_judgeLaserTarget != null) judgeTargetLocation(null); + CreatureAllowOverride = true; + _judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class); + CreatureAllowOverride = false; + _judgeLaserTarget.setVisible(false); _judgeLaserTarget.setGravity(false); _judgeLaserTarget.setSmall(true); @@ -446,8 +456,6 @@ public class SpeedBuilders extends SoloGame GetTeamList().get(0).RemovePlayer(players.get(i)); } } - - Manager.getCosmeticManager().setHideParticles(true); } @EventHandler @@ -463,7 +471,12 @@ public class SpeedBuilders extends SoloGame return; } - _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); + if (_nextBuild != null) + _currentBuild = _nextBuild; + else + _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); + + _nextBuild = null; _usedBuilds.add(_currentBuild); _buildTime = _currentBuild.getBuildTime(_buildTimeTracker); @@ -503,15 +516,6 @@ public class SpeedBuilders extends SoloGame setSpeedBuilderState(SpeedBuildersState.VIEWING); } - @EventHandler - public void onEnd(GameStateChangeEvent event) - { - if (event.GetState() != GameState.End && event.GetState() != GameState.Dead) - return; - - Manager.getCosmeticManager().setHideParticles(false); - } - @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { @@ -522,7 +526,14 @@ public class SpeedBuilders extends SoloGame if (recreation != null) { - recreation.clearBuildArea(true); + HashSet blocks = UtilBlock.findConnectedBlocks(recreation.OriginalBuildLocation.getBlock(), recreation.OriginalBuildLocation.getBlock(), null, 2000, 8); + + //Sets should remove duplicates + blocks.addAll(recreation.getBlocks()); + + Manager.GetExplosion().BlockExplosion(blocks, recreation.getMidpoint(), false, true); + + recreation.clearBuildArea(false); if (_toEliminate.contains(recreation)) _toEliminate.remove(recreation); @@ -777,7 +788,7 @@ public class SpeedBuilders extends SoloGame if (_allPerfect) { - UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Impressed!", 0, 30, 10); + UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Impressed!", 0, 100, 10); _allPerfect = false; } else @@ -842,6 +853,26 @@ public class SpeedBuilders extends SoloGame if (!allPerfectMatch && !allPlayersEqual && lowest != null && !_toEliminate.contains(lowest)) _toEliminate.add(lowest); + if (!_toEliminate.isEmpty()) + { + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + for (Player player : GetTeamList().get(0).GetPlayers(true)) + { + if (!_buildRecreations.containsKey(player)) + return; + + double percent = ((double) _buildRecreations.get(player).calculateScoreFromBuild(_currentBuild) / _currentBuild.getPerfectScore()) * 100d; + + UtilTextMiddle.display("", C.cGold + "You scored " + C.cYellow + UtilMath.trim(1, percent) + " Percent", 0, 30, 10, player); + } + } + }, 80L); + } + _lastElimination = System.currentTimeMillis(); _reviewStartTime = System.currentTimeMillis(); @@ -866,7 +897,12 @@ public class SpeedBuilders extends SoloGame clearCenterArea(true); - _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); + if (_nextBuild != null) + _currentBuild = _nextBuild; + else + _currentBuild = UtilAlg.Random(_buildData, _usedBuilds); + + _nextBuild = null; _usedBuilds.add(_currentBuild); _buildTime = _currentBuild.getBuildTime(_buildTimeTracker); @@ -964,8 +1000,12 @@ public class SpeedBuilders extends SoloGame return; WorldData.World.playEffect(eliminating.getMidpoint(), Effect.EXPLOSION_HUGE, 0); - WorldData.World.playSound(eliminating.getMidpoint(), Sound.EXPLODE, 10F, 1F); + for (Player player : UtilServer.getPlayers()) + { + player.playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 1F, 1F); + } + HashSet blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), eliminating.OriginalBuildLocation.getBlock(), null, 2000, 8); //Sets should remove duplicates @@ -983,7 +1023,7 @@ public class SpeedBuilders extends SoloGame moveToGuardians(eliminating.Player, true); } - }, 40L); + }, 100L); } else if (!_eliminating) { @@ -1228,6 +1268,9 @@ public class SpeedBuilders extends SoloGame UtilEnt.CreatureLook(_judgeEntity, _lookStand); _standMoveProgress += 0.2; + + if (_standMoveProgress > 1) + _targetReached = System.currentTimeMillis(); } private void moveEntity(Location loc, Entity entity) @@ -1496,6 +1539,48 @@ public class SpeedBuilders extends SoloGame }, 1); } + @EventHandler + public void setNextBuild(PlayerCommandPreprocessEvent event) + { + if (!event.getMessage().startsWith("/setnext ")) + return; + + event.setCancelled(true); + + if (!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.MAPDEV, true)) + return; + + if (!Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + { + UtilPlayer.message(event.getPlayer(), F.main("Build", C.cYellow + "You can only use this on testing servers!")); + + return; + } + + String buildName = event.getMessage().substring(9); + + BuildData build = null; + + for (BuildData buildData : _buildData) + { + if (buildData.BuildText.toUpperCase().startsWith(buildName.toUpperCase())) + { + build = buildData; + + break; + } + } + + if (build == null) + UtilPlayer.message(event.getPlayer(), F.main("Build", "That build does not exist!")); + else + { + _nextBuild = build; + + UtilPlayer.message(event.getPlayer(), F.main("Build", "Set next build to " + F.elem(build.BuildText))); + } + } + @Override public void EndCheck() { @@ -1537,6 +1622,9 @@ public class SpeedBuilders extends SoloGame if (winners == null) return null; + + if (GetTeamList().size() < 2) + return new ArrayList(); List losers = GetTeamList().get(1).GetPlayers(false); @@ -1560,22 +1648,37 @@ public class SpeedBuilders extends SoloGame Scoreboard.WriteBlank(); - Scoreboard.Write(C.cGreenB + "Players Left:"); - Scoreboard.Write("" + GetTeamList().get(0).GetPlayers(true).size()); + Scoreboard.Write(C.cYellowB + "Build"); + + if (_currentBuild == null) + Scoreboard.Write("(None)"); + else + Scoreboard.Write(C.cWhite + _currentBuild.BuildText); Scoreboard.WriteBlank(); - if (_state == SpeedBuildersState.BUILDING) + Scoreboard.Write(C.cYellowB + "Round"); + Scoreboard.Write("" + _roundsPlayed); + + Scoreboard.WriteBlank(); + + List playersAlive = GetTeamList().get(0).GetPlayers(true); + + List playersDead = new ArrayList(); + + if (GetTeamList().size() > 1) + playersDead.addAll(GetTeamList().get(1).GetPlayers(false)); + + Scoreboard.Write(C.cYellowB + "Players"); + + for (Player player : playersAlive) { - long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime); - - if (timeLeft < 0) - timeLeft = 0; - - Scoreboard.Write(C.cRedB + "Round Time:"); - Scoreboard.Write(UtilTime.MakeStr(timeLeft)); - - Scoreboard.WriteBlank(); + Scoreboard.Write(player.getName()); + } + + for (Player player : playersDead) + { + Scoreboard.Write(C.cGray + player.getName()); } Scoreboard.Draw(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java index dccfd0a88..1f56c816d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/BuildData.java @@ -178,7 +178,21 @@ public class BuildData public int getPerfectScore() { - return Game.BuildSizePow3 + Mobs.size(); + int nonAirBlocks = 0; + + for (int x = 0; x < Game.BuildSize; x++) + { + for (int y = 0; y < Game.BuildSize; y++) + { + for (int z = 0; z < Game.BuildSize; z++) + { + if (Build[x][y][z].getType() != Material.AIR) + nonAirBlocks++; + } + } + } + + return nonAirBlocks + Mobs.size(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java index e30b67976..f53f653c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/DemolitionData.java @@ -56,6 +56,9 @@ public class DemolitionData public void spawnHologram() { + if (Parent.Game.InstaBreak) + return; + Location loc = Parent.getMidpoint(); if (!Blocks.isEmpty()) @@ -70,6 +73,9 @@ public class DemolitionData public void despawnHologram() { + if (_hologram == null) + return; + _hologram.stop(); _hologram = null; @@ -77,6 +83,16 @@ public class DemolitionData public void update() { + if (Parent.Game.InstaBreak) + { + breakBlocks(); + + return; + } + + if (_hologram == null) + spawnHologram(); + int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D); if (secondsLeft < 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index c52927135..b45916e3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -8,7 +8,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilInv; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; @@ -30,7 +30,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; import org.bukkit.material.Door; import org.bukkit.material.Stairs; -import org.bukkit.util.Vector; public class RecreationData { @@ -206,9 +205,7 @@ public class RecreationData for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block)) { - Item item = block.getWorld().dropItem(getMidpoint(), itemStack); - - DroppedItems.put(item, System.currentTimeMillis()); + UtilInv.insert(Player, itemStack); } //Destroy the other part @@ -243,25 +240,13 @@ public class RecreationData for (Entity entity : Mobs) { ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId()); - - Item item = entity.getWorld().dropItem(getMidpoint(), spawnEgg); - - DroppedItems.put(item, System.currentTimeMillis()); + + UtilInv.insert(Player, spawnEgg); } CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); clearBuildArea(false); - - //Velocity to player - for (Item item : DroppedItems.keySet()) - { - item.setPickupDelay(0); - - double mult = 0.5 + (0.6 * (UtilMath.offset(Player.getLocation(), item.getLocation())/16d)); - - item.setVelocity(Player.getLocation().toVector().subtract(item.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); - } } public boolean isEmptyBuild(BuildData buildData) @@ -291,6 +276,9 @@ public class RecreationData Block currentBlock = CornerA.clone().add(x, y, z).getBlock(); BlockState expectedState = buildData.Build[x][y][z]; + if (expectedState.getType() == Material.AIR) + continue; + if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData()) { score++; From 181cce47748bd8d692560cead58d093b911299d2 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 03:08:56 -0600 Subject: [PATCH 81/99] Holograms maybe? --- .../game/games/speedbuilders/SpeedBuilders.java | 4 ++++ .../games/speedbuilders/data/RecreationData.java | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 8a0e46d19..9f192bd67 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -1684,4 +1684,8 @@ public class SpeedBuilders extends SoloGame Scoreboard.Draw(); } + public Location getJudgeSpawn() + { + return _judgeSpawn; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index b45916e3c..8408e9a14 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -3,12 +3,14 @@ package nautilus.game.arcade.game.games.speedbuilders.data; import java.util.ArrayList; import java.util.List; +import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; +import mineplex.core.hologram.Hologram; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.BlockStairs; @@ -30,6 +32,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.Bed; import org.bukkit.material.Door; import org.bukkit.material.Stairs; +import org.bukkit.util.Vector; public class RecreationData { @@ -53,6 +56,8 @@ public class RecreationData public ArrayList Mobs = new ArrayList(); + private Hologram _hologram; + public RecreationData(SpeedBuilders game, Player player, Location loc, Location playerSpawn) { Game = game; @@ -75,6 +80,11 @@ public class RecreationData DefaultGround[x][z] = CornerA.clone().add(x, -1, z).getBlock().getState(); } } + + Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); + Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); + _hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cGreen + player.getName()); + _hologram.start(); } public boolean inBuildArea(Block block) @@ -247,6 +257,8 @@ public class RecreationData CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); clearBuildArea(false); + + _hologram.stop(); } public boolean isEmptyBuild(BuildData buildData) From 61f1a58b1c66530030c814a504abbabbd4fd54a7 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 03:29:53 -0600 Subject: [PATCH 82/99] hologram changes --- .../game/games/speedbuilders/SpeedBuilders.java | 1 + .../games/speedbuilders/data/RecreationData.java | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 9f192bd67..db0a18716 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -1014,6 +1014,7 @@ public class SpeedBuilders extends SoloGame Manager.GetExplosion().BlockExplosion(blocks, eliminating.getMidpoint(), false, true); eliminating.clearBuildArea(false); + eliminating.removeHologram(); judgeTargetLocation(null); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 8408e9a14..3f6238313 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -81,9 +81,9 @@ public class RecreationData } } - Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); - Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); - _hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cGreen + player.getName()); +// Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); +// Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); + _hologram = new Hologram(game.getArcadeManager().getHologramManager(), loc.clone().add(0, game.BuildSize + 0.5, 0), C.cYellow + player.getName()); _hologram.start(); } @@ -257,8 +257,6 @@ public class RecreationData CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId()); clearBuildArea(false); - - _hologram.stop(); } public boolean isEmptyBuild(BuildData buildData) @@ -430,4 +428,9 @@ public class RecreationData BlocksForDemolition.add(new DemolitionData(this, new ArrayList(), mobs)); } + public void removeHologram() + { + _hologram.stop(); + } + } From 2dcc356aab47c0f65be0fd808d1720174c56f630 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 25 Jan 2016 04:33:25 -0500 Subject: [PATCH 83/99] Make achievement category classics --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index b09f6eda3..ca55d520f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -161,7 +161,7 @@ public enum AchievementCategory SPEED_BUILDERS("Speed Builders", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED, null, new StatDisplay("Perfect Builds", "PerfectBuild")}, - Material.QUARTZ_BLOCK, 0, GameCategory.ARCADE, null); + Material.QUARTZ_BLOCK, 0, GameCategory.CLASSICS, null); private String _name; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 31b1aaef0..5d90a1b98 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -68,7 +68,7 @@ public enum GameDisplay Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), - SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.ARCADE, 60), + SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60), ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), From bc8f6e511c5b02e9328f8fdf7ab26cd94b58b9aa Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 03:44:22 -0600 Subject: [PATCH 84/99] Center hologram --- .../arcade/game/games/speedbuilders/data/RecreationData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 3f6238313..e1c8ac8bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -83,7 +83,7 @@ public class RecreationData // Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); // Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); - _hologram = new Hologram(game.getArcadeManager().getHologramManager(), loc.clone().add(0, game.BuildSize + 0.5, 0), C.cYellow + player.getName()); + _hologram = new Hologram(game.getArcadeManager().getHologramManager(), loc.clone().add(0.5, game.BuildSize + 0.5, 0.5), C.cYellow + player.getName()); _hologram.start(); } From 616be8aea7b543f1cf344a0fd4b9dfac4185ecd9 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 03:59:37 -0600 Subject: [PATCH 85/99] Fix messages, fix /stats --- .../ui/page/AchievementMainPage.java | 2 +- .../games/speedbuilders/SpeedBuilders.java | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) 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 40ec84525..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 @@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase= 75) + return C.cAqua; + else if (percent >= 50) + return C.cGreen; + else if (percent >= 25) + return C.cYellow; + else + return C.cRed; + } + @EventHandler public void buildTimeProgressBar(UpdateEvent event) { From 6ff7c83d3e6cd3137ee41b34027fb369eeafd925 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 04:17:58 -0600 Subject: [PATCH 86/99] Trying different hologram location --- .../game/games/speedbuilders/data/RecreationData.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index e1c8ac8bf..942cbf36d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -81,9 +81,10 @@ public class RecreationData } } -// Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); -// Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); - _hologram = new Hologram(game.getArcadeManager().getHologramManager(), loc.clone().add(0.5, game.BuildSize + 0.5, 0.5), C.cYellow + player.getName()); + Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); + Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); + Location above = loc.clone().add(0.5, game.BuildSize + 0.5, 0.5); + _hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cYellow + player.getName()); _hologram.start(); } From b143ec7c19f243f7e2f4039a73c7a4c6c669def1 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 04:42:09 -0600 Subject: [PATCH 87/99] negative! --- .../arcade/game/games/speedbuilders/data/RecreationData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 942cbf36d..7dd740981 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -81,7 +81,7 @@ public class RecreationData } } - Vector mid = loc.toVector().subtract(game.getJudgeSpawn().toVector()).multiply(0.5); + Vector mid = game.getJudgeSpawn().toVector().subtract(loc.toVector()).multiply(0.5); Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); Location above = loc.clone().add(0.5, game.BuildSize + 0.5, 0.5); _hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cYellow + player.getName()); From 4314f35f80f2e7ec5b6cc987d0c7327220e6feca Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 25 Jan 2016 04:46:47 -0600 Subject: [PATCH 88/99] Multiply by less --- .../arcade/game/games/speedbuilders/data/RecreationData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 7dd740981..85ecdef51 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -81,8 +81,8 @@ public class RecreationData } } - Vector mid = game.getJudgeSpawn().toVector().subtract(loc.toVector()).multiply(0.5); - Location hologramLocation = loc.clone().add(mid).add(0, 2, 0); + Vector mid = game.getJudgeSpawn().toVector().subtract(loc.toVector()).multiply(0.4); + Location hologramLocation = loc.clone().add(mid).add(0, 1, 0); Location above = loc.clone().add(0.5, game.BuildSize + 0.5, 0.5); _hologram = new Hologram(game.getArcadeManager().getHologramManager(), hologramLocation, C.cYellow + player.getName()); _hologram.start(); From 91b6ae8b09040f129ca4ae629986295828c415fd Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 25 Jan 2016 12:14:56 +0100 Subject: [PATCH 89/99] fixing spec item in menu --- .../game/arcade/gui/spectatorMenu/page/SpectatorPage.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index 1b687bb71..05b46cc4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -228,7 +228,8 @@ public class SpectatorPage extends lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + UtilMath.trim(1, heightDifference)); lore.add(" "); - lore.add(ChatColor.RESET + C.Line + "Click to Spectate"); + lore.add(ChatColor.RESET + C.Line + "Left click to Teleport"); + lore.add(ChatColor.RESET + C.Line + "Right click to Spectate"); SkullMeta skullMeta = ((SkullMeta) item.getItemMeta()); skullMeta.setOwner(other.getName()); skullMeta.setDisplayName(team.GetColor() + other.getName()); From c7733bb0681efbb3b90956deacf5cdaa7db813e1 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 25 Jan 2016 12:27:19 +0100 Subject: [PATCH 90/99] Updateting spectator Menu layout. --- .../game/arcade/gui/spectatorMenu/page/SpectatorPage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index 05b46cc4e..8626573ec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -228,8 +228,8 @@ public class SpectatorPage extends lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + UtilMath.trim(1, heightDifference)); lore.add(" "); - lore.add(ChatColor.RESET + C.Line + "Left click to Teleport"); - lore.add(ChatColor.RESET + C.Line + "Right click to Spectate"); + lore.add(ChatColor.YELLOW + "Left Click" + ChatColor.RESET + " Teleport"); + lore.add(ChatColor.YELLOW + "Right CLick" + ChatColor.RESET + " Spectate"); SkullMeta skullMeta = ((SkullMeta) item.getItemMeta()); skullMeta.setOwner(other.getName()); skullMeta.setDisplayName(team.GetColor() + other.getName()); From 53132a248f9d899e2b4b275a31cfd69376533688 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 25 Jan 2016 12:28:21 +0100 Subject: [PATCH 91/99] the L --- .../game/arcade/gui/spectatorMenu/page/SpectatorPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index 8626573ec..5a2a4fe36 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -229,7 +229,7 @@ public class SpectatorPage extends + UtilMath.trim(1, heightDifference)); lore.add(" "); lore.add(ChatColor.YELLOW + "Left Click" + ChatColor.RESET + " Teleport"); - lore.add(ChatColor.YELLOW + "Right CLick" + ChatColor.RESET + " Spectate"); + lore.add(ChatColor.YELLOW + "Right Click" + ChatColor.RESET + " Spectate"); SkullMeta skullMeta = ((SkullMeta) item.getItemMeta()); skullMeta.setOwner(other.getName()); skullMeta.setDisplayName(team.GetColor() + other.getName()); From a1eec79b3b94f28c0a9c511fa89906dafe85958e Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 25 Jan 2016 16:43:43 -0500 Subject: [PATCH 92/99] Make dependable require 50 perfect builds instead of 10. --- .../src/mineplex/core/achievement/Achievement.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 48ddcd897..ab07c5147 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -864,8 +864,8 @@ public enum Achievement SPEED_BUILDERS_DEPENDABLE("Dependable", 1200, new String[]{"Speed Builders.PerfectBuild"}, - new String[]{"Complete 10 Perfect Builds"}, - new int[]{10}, + new String[]{"Complete 50 Perfect Builds"}, + new int[]{50}, AchievementCategory.SPEED_BUILDERS), SPEED_BUILDERS_FIRST_BUILD("First Build!", 1800, From c5dfddd710b65544f58566d34423bf66891597fa Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 25 Jan 2016 20:54:01 -0500 Subject: [PATCH 93/99] Fix dupe scoreboard entries. Make it so perfect builders can't fill or empty bucket. --- .../game/games/speedbuilders/SpeedBuilders.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index a711d6d69..459d1cb0b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -519,6 +519,9 @@ public class SpeedBuilders extends SoloGame @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { + if (GetTeamList().size() > 1 && GetTeamList().get(1).HasPlayer(event.getPlayer())) + GetTeamList().get(1).RemovePlayer(event.getPlayer()); + RecreationData recreation = null; if (_buildRecreations.containsKey(event.getPlayer())) @@ -1441,6 +1444,12 @@ public class SpeedBuilders extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; + if (_perfectBuild.containsKey(event.getPlayer())) + { + event.setCancelled(true); + return; + } + Block liquid = event.getBlockClicked().getRelative(event.getBlockFace()); if (!_buildRecreations.get(event.getPlayer()).inBuildArea(liquid)) @@ -1463,6 +1472,12 @@ public class SpeedBuilders extends SoloGame if (!_buildRecreations.containsKey(event.getPlayer())) return; + if (_perfectBuild.containsKey(event.getPlayer())) + { + event.setCancelled(true); + return; + } + Block liquid = event.getBlockClicked().getRelative(event.getBlockFace()); if (!_buildRecreations.get(event.getPlayer()).inBuildArea(liquid)) From 2f4146c243d6afc4702b6051517140ba81ea03fb Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Mon, 25 Jan 2016 21:12:28 -0500 Subject: [PATCH 94/99] Leaves fix. --- .../game/games/speedbuilders/data/RecreationData.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java index 85ecdef51..11aaac85a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/data/RecreationData.java @@ -310,6 +310,13 @@ public class RecreationData score++; } + //Fix for leaves decay flags + if ((expectedState.getType() == Material.LEAVES && currentBlock.getType() == Material.LEAVES) || ((expectedState.getType() == Material.LEAVES_2 && currentBlock.getType() == Material.LEAVES_2))) + { + if (currentBlock.getData() % 4 == expectedState.getRawData() % 4) + score++; + } + //Fix for corner stair shape if (currentBlock.getState().getData() instanceof Stairs && expectedState.getData() instanceof Stairs) { From 40113f99d38488135419b8cc7f70ffcc5b082d1c Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Tue, 26 Jan 2016 17:14:21 -0500 Subject: [PATCH 95/99] Borders for spec are fixed. --- .../games/speedbuilders/SpeedBuilders.java | 20 +++++++ .../game/arcade/managers/GameFlagManager.java | 56 +++++++++---------- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index 459d1cb0b..aa2d27611 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -43,6 +43,7 @@ import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTrac import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker; import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.managers.GameFlagManager; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; import org.bukkit.Bukkit; @@ -736,6 +737,25 @@ public class SpeedBuilders extends SoloGame } } + @EventHandler + public void border(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!InProgress()) + return; + + Location specLocation = GetSpectatorLocation(); + + //This can be done like this cause nobody should be outside + for (Player player : UtilServer.getPlayers()) + { + if (!isInsideMap(player)) + player.teleport(specLocation); + } + } + @EventHandler public void stateUpdate(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index f0533de91..ff47122fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -888,7 +888,7 @@ public class GameFlagManager implements Listener for (Player player : UtilServer.getPlayers()) { if (!game.isInsideMap(player) && game.IsAlive(player)) - { + { //Riding a Projectile, edgecase if (player.getVehicle() != null && player.getVehicle() instanceof Projectile) { @@ -897,38 +897,36 @@ public class GameFlagManager implements Listener ((CraftPlayer)player).getHandle().spectating = false; } - if (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating) + if (!game.WorldBoundaryKill) { - player.teleport(game.GetSpectatorLocation()); + UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!"); + + if (game.GetType() != GameType.Gravity) + { + if (player.getLocation().getY() > game.WorldData.MaxY) + UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0, 0, 10, true); + else + UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0.4, 0, 10, true); + } + + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.VOID, 4, false, false, false, + "Border", "Border Damage"); + + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); } else { - if (!game.WorldBoundaryKill) - { - UtilPlayer.message(player, C.cRed + C.Bold + "WARNING: " + C.cWhite + C.Bold + "RETURN TO PLAYABLE AREA!"); - - if (game.GetType() != GameType.Gravity) - { - if (player.getLocation().getY() > game.WorldData.MaxY) - UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0, 0, 10, true); - else - UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), game.GetSpectatorLocation()), 1, true, 0.4, 0, 10, true); - } - - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.VOID, 4, false, false, false, - "Border", "Border Damage"); - - player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); - player.getWorld().playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 1f); - } - else - { - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.VOID, 9001, false, false, false, - "Border", "Border Damage"); - } - } + Manager.GetDamage().NewDamageEvent(player, null, null, + DamageCause.VOID, 9001, false, false, false, + "Border", "Border Damage"); + } + } + + if (!game.isInsideMap(player) && (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating)) + { + player.teleport(game.GetSpectatorLocation()); } } } From d44d4c22788aee4c03f45bee1f3d871b810b927b Mon Sep 17 00:00:00 2001 From: William Burns Date: Thu, 28 Jan 2016 19:21:42 +0000 Subject: [PATCH 96/99] Un-register the hotbar page listener on disable. --- .../game/games/gladiators/hotbar/HotbarEditor.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java index e12ee785e..99eca1939 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java @@ -9,6 +9,8 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -37,6 +39,7 @@ public class HotbarEditor extends MiniPlugin { private Gladiators _host; private ItemStack _item; + private Listener _pageListener; public HotbarEditor(JavaPlugin plugin, Gladiators gladiators) { @@ -46,7 +49,14 @@ public class HotbarEditor extends MiniPlugin _item = new ItemBuilder(Material.NAME_TAG).setTitle(C.cGold + "Hotbar Editor") .addLore(C.cGray + "Right click to edit your Gladiators hotbar").build(); - getPluginManager().registerEvents(new HotbarPageListener(this), getPlugin()); + _pageListener = new HotbarPageListener(this); + getPluginManager().registerEvents(_pageListener, getPlugin()); + } + + @Override + public void disable() + { + HandlerList.unregisterAll(_pageListener); } @EventHandler From 04544c2b8dd02911e4728ad04a8b86bcb8f701f6 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 28 Jan 2016 14:28:47 -0500 Subject: [PATCH 97/99] Fix flickering judge laser. --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index aa2d27611..d9cfc2058 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -43,7 +43,6 @@ import nautilus.game.arcade.game.games.speedbuilders.stattrackers.FirstBuildTrac import nautilus.game.arcade.game.games.speedbuilders.stattrackers.PerfectionistTracker; import nautilus.game.arcade.game.games.speedbuilders.stattrackers.SpeediestBuilderizerTracker; import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.managers.GameFlagManager; import net.minecraft.server.v1_8_R3.PacketPlayOutGameStateChange; import org.bukkit.Bukkit; @@ -378,6 +377,8 @@ public class SpeedBuilders extends SoloGame } else { + Announce("Judge target method called"); + if (_judgeLaserTarget != null) judgeTargetLocation(null); @@ -999,7 +1000,7 @@ public class SpeedBuilders extends SoloGame } else { - if (UtilTime.elapsed(_reviewStartTime, 10000) && UtilTime.elapsed(_lastElimination, 2000)) + if (UtilTime.elapsed(_reviewStartTime, 10000) && UtilTime.elapsed(_lastElimination, 2000) && !_eliminating) { //Eliminate in order This also means that the empty builds are eliminated first final RecreationData eliminating = _toEliminate.get(0); From 75629055d851265e91eb7d0679a40a1357552e17 Mon Sep 17 00:00:00 2001 From: William Burns Date: Thu, 28 Jan 2016 20:43:58 +0000 Subject: [PATCH 98/99] Un-register HotbarEditor MiniPlugin and fix /spec bug. --- .../src/nautilus/game/arcade/game/Game.java | 2 ++ .../game/arcade/game/games/gladiators/Gladiators.java | 7 +++++++ .../arcade/game/games/gladiators/hotbar/HotbarEditor.java | 3 +++ .../nautilus/game/arcade/managers/GameCreationManager.java | 1 + 4 files changed, 13 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 6eec52eb7..3ebcc46ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1751,4 +1751,6 @@ public abstract class Game implements Listener } public void addTutorials(){} + + public void disable(){} } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index 66701b54a..caff47df6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -1095,4 +1095,11 @@ public class Gladiators extends SoloGame Scoreboard.Draw(); } + + @Override + public void disable() + { + _hotbarEditor.deregisterSelf(); // De-register as listener + _hotbarEditor.onDisable(); // Fully disable + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java index 99eca1939..da6897997 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/hotbar/HotbarEditor.java @@ -91,6 +91,9 @@ public class HotbarEditor extends MiniPlugin { if (event.getMessage().equalsIgnoreCase("/spec")) { + if (_host == null) + return; + if (!_host.IsAlive(event.getPlayer()) && !UtilInv.contains(event.getPlayer(), _item.getType(), (byte) 0, 1)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 1e51b1d42..ef31b741b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -97,6 +97,7 @@ public class GameCreationManager implements Listener { Game game = gameIterator.next(); + game.disable(); HandlerList.unregisterAll(game); From b6db99806ab171774ffd9c9db11cf361ad76dc94 Mon Sep 17 00:00:00 2001 From: Virizion <9b717b9d4e5f09e89fa3@gmail.com> Date: Thu, 28 Jan 2016 18:28:43 -0500 Subject: [PATCH 99/99] Remove debug message. --- .../game/arcade/game/games/speedbuilders/SpeedBuilders.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java index d9cfc2058..aa7606f8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/speedbuilders/SpeedBuilders.java @@ -377,8 +377,6 @@ public class SpeedBuilders extends SoloGame } else { - Announce("Judge target method called"); - if (_judgeLaserTarget != null) judgeTargetLocation(null);