OnPlaceChest now uses GetDataHandledEventArgs.

This commit is contained in:
Lucas Nicodemus 2017-12-23 14:24:12 -07:00
parent e9931e8740
commit fd7b9858df

View file

@ -375,10 +375,8 @@ namespace TShockAPI
/// <summary> /// <summary>
/// For use in a PlaceChest event /// For use in a PlaceChest event
/// </summary> /// </summary>
public class PlaceChestEventArgs : HandledEventArgs public class PlaceChestEventArgs : GetDataHandledEventArgs
{ {
/// <summary>The TSPlayer that triggered the event</summary>
public TSPlayer Player { get; set; }
/// <summary>What the packet is doing (see MP packet docs).</summary> /// <summary>What the packet is doing (see MP packet docs).</summary>
public int Flag { get; set; } public int Flag { get; set; }
/// <summary> /// <summary>
@ -395,7 +393,7 @@ namespace TShockAPI
/// </summary> /// </summary>
public static HandlerList<PlaceChestEventArgs> PlaceChest = new HandlerList<PlaceChestEventArgs>(); public static HandlerList<PlaceChestEventArgs> PlaceChest = new HandlerList<PlaceChestEventArgs>();
private static bool OnPlaceChest(TSPlayer player, int flag, int tilex, int tiley) private static bool OnPlaceChest(TSPlayer player, MemoryStream data, int flag, int tilex, int tiley)
{ {
if (PlaceChest == null) if (PlaceChest == null)
return false; return false;
@ -403,6 +401,7 @@ namespace TShockAPI
var args = new PlaceChestEventArgs var args = new PlaceChestEventArgs
{ {
Player = player, Player = player,
Data = data,
Flag = flag, Flag = flag,
TileX = tilex, TileX = tilex,
TileY = tiley, TileY = tiley,
@ -2496,7 +2495,7 @@ namespace TShockAPI
int tileY = args.Data.ReadInt16(); int tileY = args.Data.ReadInt16();
args.Data.ReadInt16(); // Ignore style args.Data.ReadInt16(); // Ignore style
if (OnPlaceChest(args.Player, flag, tileX, tileY)) if (OnPlaceChest(args.Player, args.Data, flag, tileX, tileY))
return true; return true;
return false; return false;