Move OnChestOpen to Bouncer
This commit is contained in:
parent
863fa706c2
commit
be8cffddfd
2 changed files with 26 additions and 18 deletions
|
|
@ -42,6 +42,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
// Setup hooks
|
// Setup hooks
|
||||||
|
|
||||||
|
GetDataHandlers.ChestOpen.Register(OnChestOpen);
|
||||||
GetDataHandlers.PlaceChest.Register(OnPlaceChest);
|
GetDataHandlers.PlaceChest.Register(OnPlaceChest);
|
||||||
GetDataHandlers.LiquidSet.Register(OnLiquidSet);
|
GetDataHandlers.LiquidSet.Register(OnLiquidSet);
|
||||||
GetDataHandlers.ProjectileKill.Register(OnProjectileKill);
|
GetDataHandlers.ProjectileKill.Register(OnProjectileKill);
|
||||||
|
|
@ -54,6 +55,31 @@ namespace TShockAPI
|
||||||
GetDataHandlers.TileEdit.Register(OnTileEdit);
|
GetDataHandlers.TileEdit.Register(OnTileEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void OnChestOpen(object sender, GetDataHandlers.ChestOpenEventArgs args)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (TShock.CheckIgnores(args.Player))
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TShock.CheckRangePermission(args.Player, args.X, args.Y))
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TShock.CheckTilePermission(args.Player, args.X, args.Y) && TShock.Config.RegionProtectChests)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = Chest.FindChest(args.X, args.Y);
|
||||||
|
args.Player.ActiveChest = id;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>The place chest event that Bouncer hooks to prevent accidental damage.</summary>
|
/// <summary>The place chest event that Bouncer hooks to prevent accidental damage.</summary>
|
||||||
/// <param name="sender">The object that triggered the event.</param>
|
/// <param name="sender">The object that triggered the event.</param>
|
||||||
/// <param name="args">The packet arguments that the event has.</param>
|
/// <param name="args">The packet arguments that the event has.</param>
|
||||||
|
|
|
||||||
|
|
@ -2413,24 +2413,6 @@ namespace TShockAPI
|
||||||
if (OnChestOpen(x, y, args.Player))
|
if (OnChestOpen(x, y, args.Player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (TShock.CheckIgnores(args.Player))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TShock.CheckRangePermission(args.Player, x, y))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TShock.CheckTilePermission(args.Player, x, y) && TShock.Config.RegionProtectChests)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = Chest.FindChest(x, y);
|
|
||||||
args.Player.ActiveChest = id;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue