Move OnGetSection to Bouncer
Bonus: Introduces a new GetDataHandledEventArgs for use in events that have players, data, and need to be handled. I was originally going to modify GetDataHandlerArgs, but that comes from the EventArgs class of args that isn't handled, and changing that to extend HandledEventArgs would imply we care or check to see if those are handled and we don't so we're stuck with this implementation for a teenie tiny bit.
This commit is contained in:
parent
f9a1819e26
commit
ef1486b78c
3 changed files with 74 additions and 12 deletions
|
|
@ -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(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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue