From 4054de78c2ebedb0b7a71a30e0bbd1c82e47fb7d Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 29 Mar 2016 16:32:10 +1100 Subject: [PATCH] Fix /gun not checking if you can actually place the block. --- Commands/Fun/CmdGun.cs | 7 +++---- Commands/Fun/CmdMissile.cs | 10 ++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Commands/Fun/CmdGun.cs b/Commands/Fun/CmdGun.cs index a3cebb9e6..319aa6860 100644 --- a/Commands/Fun/CmdGun.cs +++ b/Commands/Fun/CmdGun.cs @@ -29,8 +29,7 @@ namespace MCGalaxy.Commands { protected override void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { p.RevertBlock(x, y, z); - if (p.modeType != Block.air) - type = p.modeType; + if (!Block.canPlace(p, type)) { Player.SendMessage(p, "You cannot place this block."); return; } Thread gunThread = new Thread(() => DoShoot(p, type, extType)); gunThread.Name = "MCG_Gun"; @@ -75,7 +74,7 @@ namespace MCGalaxy.Commands { if (t > 12 && bp.ending != EndType.Laser) { pos = previous[0]; - p.level.Blockchange(pos.x, pos.y, pos.z, Block.air); + p.level.Blockchange(pos.x, pos.y, pos.z, Block.air, true); previous.RemoveAt(0); } @@ -90,7 +89,7 @@ namespace MCGalaxy.Commands { if (bp.ending == EndType.Laser) Thread.Sleep(400); foreach (Pos pos1 in previous) { - p.level.Blockchange(pos1.x, pos1.y, pos1.z, Block.air); + p.level.Blockchange(pos1.x, pos1.y, pos1.z, Block.air, true); if (bp.ending != EndType.Laser) Thread.Sleep(20); } } diff --git a/Commands/Fun/CmdMissile.cs b/Commands/Fun/CmdMissile.cs index a9b6a3e65..6eb514842 100644 --- a/Commands/Fun/CmdMissile.cs +++ b/Commands/Fun/CmdMissile.cs @@ -33,10 +33,8 @@ namespace MCGalaxy.Commands { p.ClearBlockchange(); p.aiming = false; } - p.RevertBlock(x, y, z); - - if (p.modeType != Block.air) - type = p.modeType; + p.RevertBlock(x, y, z); + if (!Block.canPlace(p, type)) { Player.SendMessage(p, "You cannot place this block."); return; } Thread gunThread = new Thread(() => DoShoot(p, type, extType)); gunThread.Name = "MCG_Missile"; @@ -107,7 +105,7 @@ namespace MCGalaxy.Commands { } if (previous.Count > 12) { - p.level.Blockchange(previous[0].x, previous[0].y, previous[0].z, Block.air); + p.level.Blockchange(previous[0].x, previous[0].y, previous[0].z, Block.air, true); previous.RemoveAt(0); } Thread.Sleep(100); @@ -120,7 +118,7 @@ namespace MCGalaxy.Commands { DoTeleport(p, previous[index]); } foreach (Pos pos1 in previous) { - p.level.Blockchange(pos1.x, pos1.y, pos1.z, Block.air); + p.level.Blockchange(pos1.x, pos1.y, pos1.z, Block.air, true); Thread.Sleep(100); } }