Merge branch 'hackedinventory' into crp

This commit is contained in:
Lucas Nicodemus 2017-12-22 10:18:51 -07:00
commit 848d3c4778
5 changed files with 285 additions and 218 deletions

View file

@ -42,6 +42,7 @@ namespace TShockAPI
{
// Setup hooks
GetDataHandlers.GetSection += OnGetSection;
GetDataHandlers.PlaceItemFrame += OnPlaceItemFrame;
GetDataHandlers.GemLockToggle += OnGemLockToggle;
GetDataHandlers.PlaceTileEntity += OnPlaceTileEntity;
@ -64,6 +65,28 @@ namespace TShockAPI
GetDataHandlers.TileEdit += OnTileEdit;
}
internal void OnGetSection(object sender, GetDataHandlers.GetSectionEventArgs args)
{
if (args.Player.RequestedSection)
{
args.Handled = true;
return;
}
args.Player.RequestedSection = true;
if (String.IsNullOrEmpty(args.Player.Name))
{
TShock.Utils.ForceKick(args.Player, "Blank name.", true);
args.Handled = true;
return;
}
if (!args.Player.HasPermission(Permissions.ignorestackhackdetection))
{
args.Player.IsDisabledForStackDetection = args.Player.HasHackedItemStacks(shouldWarnPlayer: true);
}
}
/// <summary>Fired when an item frame is placed for anti-cheat detection.</summary>
/// <param name="sender">The object that triggered the event.</param>
/// <param name="args">The packet arguments that the event has.</param>