Merge branch 'general-devel' of github.com:TShock/TShock into general-devel
Conflicts: TShockAPI/GetDataHandlers.cs
This commit is contained in:
commit
4100fdc8f6
3 changed files with 34 additions and 2 deletions
|
|
@ -95,7 +95,7 @@ namespace TShockAPI
|
||||||
public string MediumcoreBanReason = "Death results in a ban";
|
public string MediumcoreBanReason = "Death results in a ban";
|
||||||
public string MediumcoreKickReason = "Death results in a kick";
|
public string MediumcoreKickReason = "Death results in a kick";
|
||||||
public string ProjectileAbuseReason = "Projectile abuse";
|
public string ProjectileAbuseReason = "Projectile abuse";
|
||||||
|
public string TileAbuseReason = "Tile abuse ({0})";
|
||||||
|
|
||||||
public bool EnableDNSHostResolution;
|
public bool EnableDNSHostResolution;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,8 @@ namespace TShockAPI
|
||||||
{PacketTypes.LiquidSet, HandleLiquidSet},
|
{PacketTypes.LiquidSet, HandleLiquidSet},
|
||||||
{PacketTypes.PlayerSpawn, HandleSpawn},
|
{PacketTypes.PlayerSpawn, HandleSpawn},
|
||||||
{PacketTypes.SyncPlayers, HandleSync},
|
{PacketTypes.SyncPlayers, HandleSync},
|
||||||
|
{PacketTypes.ChestGetContents, HandleChest},
|
||||||
|
{PacketTypes.SignNew, HandleSign}
|
||||||
{PacketTypes.PlayerSlot, HandlePlayerSlot},
|
{PacketTypes.PlayerSlot, HandlePlayerSlot},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -329,6 +331,11 @@ namespace TShockAPI
|
||||||
int tileX = Math.Abs(x);
|
int tileX = Math.Abs(x);
|
||||||
int tileY = Math.Abs(y);
|
int tileY = Math.Abs(y);
|
||||||
|
|
||||||
|
if (tiletype >= ((type == 1) ? Main.maxTileSets : Main.maxWallTypes))
|
||||||
|
{
|
||||||
|
Tools.HandleGriefer(args.Player, string.Format(TShock.Config.TileAbuseReason, "Invalid tile type"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (TShock.Config.RangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
|
if (TShock.Config.RangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
|
||||||
{
|
{
|
||||||
if (!(type == 1 && ((tiletype == 0 && args.Player.TPlayer.selectedItem == 114) || (tiletype == 53 && args.Player.TPlayer.selectedItem == 266))))
|
if (!(type == 1 && ((tiletype == 0 && args.Player.TPlayer.selectedItem == 114) || (tiletype == 53 && args.Player.TPlayer.selectedItem == 266))))
|
||||||
|
|
@ -577,7 +584,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
Log.Debug(string.Format("Liquid(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Amount:{6})",
|
Log.Debug(string.Format("Liquid(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Amount:{6})",
|
||||||
plyX, plyY, tileX, tileY, Math.Abs(plyX - tileX), Math.Abs(plyY - tileY), liquid));
|
plyX, plyY, tileX, tileY, Math.Abs(plyX - tileX), Math.Abs(plyY - tileY), liquid));
|
||||||
return Tools.HandleGriefer(args.Player, TShock.Config.LiquidAbuseReason); ;
|
return Tools.HandleGriefer(args.Player, TShock.Config.LiquidAbuseReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TShock.Config.SpawnProtection)
|
if (TShock.Config.SpawnProtection)
|
||||||
|
|
@ -715,5 +722,28 @@ namespace TShockAPI
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool HandleChest(GetDataHandlerArgs args)
|
||||||
|
{
|
||||||
|
var x = args.Data.ReadInt32();
|
||||||
|
var y = args.Data.ReadInt32();
|
||||||
|
if (TShock.Config.RangeChecks && ((Math.Abs(args.Player.TileX - x) > 32) || (Math.Abs(args.Player.TileY - y) > 32)))
|
||||||
|
{
|
||||||
|
return Tools.HandleGriefer(args.Player, TShock.Config.RangeCheckBanReason);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool HandleSign(GetDataHandlerArgs args)
|
||||||
|
{
|
||||||
|
var id = args.Data.ReadInt16();
|
||||||
|
var x = args.Data.ReadInt32();
|
||||||
|
var y = args.Data.ReadInt32();
|
||||||
|
if (TShock.Config.RangeChecks && ((Math.Abs(args.Player.TileX - x) > 32) || (Math.Abs(args.Player.TileY - y) > 32)))
|
||||||
|
{
|
||||||
|
return Tools.HandleGriefer(args.Player, TShock.Config.RangeCheckBanReason);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,8 @@ namespace TShockAPI
|
||||||
//Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
|
//Try 300 if it does not work (Higher number - Longer load times - Less chance of error)
|
||||||
if (!SendTileSquare(tilex, tiley, 150))
|
if (!SendTileSquare(tilex, tiley, 150))
|
||||||
{
|
{
|
||||||
|
InitSpawn = true;
|
||||||
|
SendWorldInfo(Main.spawnTileX, Main.spawnTileY, false);
|
||||||
SendMessage("Warning, teleport failed due to being too close to the edge of the map.", Color.Red);
|
SendMessage("Warning, teleport failed due to being too close to the edge of the map.", Color.Red);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue