Block Runner (renamed from Heavy Blocks) bug fixes. Added additional checks on the block place event.
This commit is contained in:
parent
c5dcf5d45a
commit
fde6617c6b
@ -8,8 +8,12 @@ import mineplex.core.common.util.UtilInv;
|
|||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
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.UtilServer;
|
||||||
import mineplex.core.common.util.UtilShapes;
|
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.Challenge;
|
||||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||||
|
|
||||||
@ -133,13 +137,30 @@ public class ChallengeBlockRunner extends Challenge
|
|||||||
|
|
||||||
if(bottomVoid1.isEmpty() && bottomVoid2.isEmpty() && bottomVoid3.isEmpty())
|
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);
|
blockBreakEffect(block);
|
||||||
// Cancelling so the player doesn't block farm.
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second Check
|
// 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.
|
// Checking if the player is trying to make a tower up to the sky.
|
||||||
|
|
||||||
Block bottom1 = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
Block bottom1 = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||||
@ -164,6 +185,7 @@ public class ChallengeBlockRunner extends Challenge
|
|||||||
blockBreakEffect(bottom2);
|
blockBreakEffect(bottom2);
|
||||||
blockBreakEffect(bottom3);
|
blockBreakEffect(bottom3);
|
||||||
|
|
||||||
|
UtilTextMiddle.display("", C.cRed + "You can't build a tower that high.", 5, 40, 5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,6 +206,9 @@ public class ChallengeBlockRunner extends Challenge
|
|||||||
|
|
||||||
private void blockBreakEffect(Block block)
|
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,
|
UtilParticle.PlayParticle(ParticleType.BLOCK_DUST.getParticle(block.getType(), block.getData()), block.getLocation(), 0.0F, 0.0F, 0.0F, 0,
|
||||||
10, ViewDist.NORMAL, UtilServer.getPlayers());
|
10, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||||
|
Loading…
Reference in New Issue
Block a user