From fde6617c6ba028bf30bf0496a1be6b698838e1e3 Mon Sep 17 00:00:00 2001 From: Thanos paravantis Date: Fri, 16 Oct 2015 20:34:50 +0300 Subject: [PATCH] Block Runner (renamed from Heavy Blocks) bug fixes. Added additional checks on the block place event. --- .../challenges/ChallengeBlockRunner.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java index 40fb878b9..71f726107 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeBlockRunner.java @@ -8,8 +8,12 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilTextMiddle; import nautilus.game.arcade.game.games.mineware.Challenge; import nautilus.game.arcade.game.games.mineware.MineWare; @@ -133,13 +137,30 @@ public class ChallengeBlockRunner extends Challenge if(bottomVoid1.isEmpty() && bottomVoid2.isEmpty() && bottomVoid3.isEmpty()) { + UtilTextMiddle.display("", C.cRed + "You can't place blocks that far from the ground.", 5, 40, 5); blockBreakEffect(block); - // Cancelling so the player doesn't block farm. event.setCancelled(true); return; } - + // Second Check + // Checking if the player is trying to trap another player. + + for (Player others : Host.GetPlayers(true)) + { + if (others.equals(player)) + continue; + + if (block.getLocation().add(0.5, 0.5, 0.5).distanceSquared(others.getLocation()) <= 1.5) + { + UtilTextMiddle.display("", C.cRed + "You can't place blocks near other players.", 5, 40, 5); + blockBreakEffect(block); + event.setCancelled(true); + return; + } + } + + // Third Check // Checking if the player is trying to make a tower up to the sky. Block bottom1 = player.getLocation().getBlock().getRelative(BlockFace.DOWN); @@ -164,6 +185,7 @@ public class ChallengeBlockRunner extends Challenge blockBreakEffect(bottom2); blockBreakEffect(bottom3); + UtilTextMiddle.display("", C.cRed + "You can't build a tower that high.", 5, 40, 5); return; } } @@ -184,6 +206,9 @@ public class ChallengeBlockRunner extends Challenge private void blockBreakEffect(Block block) { + if (block.getType() == Material.GRASS) + return; + UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(block.getType(), block.getData()), block.getLocation(), 0.0F, 0.0F, 0.0F, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());