diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index eb1e45b2..7d04bd72 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -367,6 +367,13 @@ namespace TShockAPI args.Player.SendTileSquare(x, y); return true; } + if (tiletype == 141 && !args.Player.Group.HasPermission(Permissions.canexplosive)) + { + args.Player.SendMessage("You do not have permission to place explosives.", Color.Red); + TShock.Utils.SendLogs(string.Format("{0} tried to place explosives", args.Player.Name), Color.Red); + args.Player.SendTileSquare(x, y); + return true; + } } if (!args.Player.Group.HasPermission(Permissions.editspawn) && !TShock.Regions.CanBuild(x, y, args.Player) && TShock.Regions.InArea(x, y)) { @@ -525,6 +532,18 @@ namespace TShockAPI else return TShock.Utils.HandleExplosivesUser(args.Player, TShock.Config.ExplosiveAbuseReason); } + if (args.Player.Index != owner)//ignores projectiles whose senders aren't the same as their owners + { + TShock.Players[args.Player.Index].SendData(PacketTypes.ProjectileNew, "", ident);//update projectile on senders end so he knows it didnt get created + return true; + } + Projectile proj = new Projectile(); + proj.SetDefaults(type); + if (proj.hostile)//ignores all hostile projectiles from the client they shouldn't be sending them anyways + { + TShock.Players[args.Player.Index].SendData(PacketTypes.ProjectileNew, "", ident); + return true; + } return false; } diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 973c3385..7b5b9fe1 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -144,6 +144,9 @@ namespace TShockAPI [Description("User can change the homes of NPCs.")] public static readonly string movenpc; + [Description("Required to be able to place Explosives")] + public static readonly string canexplosive; + static Permissions() { foreach (var field in typeof(Permissions).GetFields()) diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index d9cb993b..9a60f687 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -184,7 +184,7 @@ - +