Add checks to projectile packet to prevent client crashing.
(out of range and float NaN issue)
This commit is contained in:
parent
031721c169
commit
43b05ec3ef
2 changed files with 13 additions and 0 deletions
|
|
@ -93,6 +93,7 @@ namespace TShockAPI
|
||||||
public string TileKillAbuseReason = "Tile Kill abuse ({0})";
|
public string TileKillAbuseReason = "Tile Kill abuse ({0})";
|
||||||
public string HardcoreBanReason = "Death results in a ban";
|
public string HardcoreBanReason = "Death results in a ban";
|
||||||
public string HardcoreKickReason = "Death results in a kick";
|
public string HardcoreKickReason = "Death results in a kick";
|
||||||
|
public string ProjectileAbuseReason = "Projectile abuse";
|
||||||
|
|
||||||
public bool EnableDNSHostResolution;
|
public bool EnableDNSHostResolution;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -414,6 +414,18 @@ namespace TShockAPI
|
||||||
byte owner = args.Data.ReadInt8();
|
byte owner = args.Data.ReadInt8();
|
||||||
byte type = args.Data.ReadInt8();
|
byte type = args.Data.ReadInt8();
|
||||||
|
|
||||||
|
if (ident > Main.maxProjectiles || ident < 0)
|
||||||
|
{
|
||||||
|
Tools.HandleGriefer(args.Player, TShock.Config.ExplosiveAbuseReason);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((vely == 0f || velx == 0f) && type == 23)
|
||||||
|
{
|
||||||
|
Tools.HandleGriefer(args.Player, TShock.Config.ProjectileAbuseReason);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == 29 || type == 28 || type == 37)
|
if (type == 29 || type == 28 || type == 37)
|
||||||
{
|
{
|
||||||
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));
|
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue