Add checks to projectile packet to prevent client crashing.

(out of range and float NaN issue)
This commit is contained in:
Deathmax 2011-07-31 20:33:41 +08:00
parent 031721c169
commit 43b05ec3ef
2 changed files with 13 additions and 0 deletions

View file

@ -93,6 +93,7 @@ namespace TShockAPI
public string TileKillAbuseReason = "Tile Kill abuse ({0})";
public string HardcoreBanReason = "Death results in a ban";
public string HardcoreKickReason = "Death results in a kick";
public string ProjectileAbuseReason = "Projectile abuse";
public bool EnableDNSHostResolution;

View file

@ -414,6 +414,18 @@ namespace TShockAPI
byte owner = 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)
{
Log.Debug(string.Format("Explosive(PlyXY:{0}_{1}, Type:{2})", args.Player.TileX, args.Player.TileY, type));