OnChestOpen now uses GetDataHandledEventArgs.
This commit is contained in:
parent
df9920564a
commit
1d0d4750e2
1 changed files with 4 additions and 8 deletions
|
|
@ -891,7 +891,7 @@ namespace TShockAPI
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For use with a ChestOpen event
|
/// For use with a ChestOpen event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ChestOpenEventArgs : HandledEventArgs
|
public class ChestOpenEventArgs : GetDataHandledEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// X location of said chest
|
/// X location of said chest
|
||||||
|
|
@ -901,24 +901,20 @@ namespace TShockAPI
|
||||||
/// Y location of said chest
|
/// Y location of said chest
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The player opening the chest
|
|
||||||
/// </summary>
|
|
||||||
public TSPlayer Player { get; set; }
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ChestOpen - Called when any chest is opened
|
/// ChestOpen - Called when any chest is opened
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static HandlerList<ChestOpenEventArgs> ChestOpen = new HandlerList<ChestOpenEventArgs>();
|
public static HandlerList<ChestOpenEventArgs> ChestOpen = new HandlerList<ChestOpenEventArgs>();
|
||||||
|
|
||||||
private static bool OnChestOpen(int x, int y, TSPlayer player)
|
private static bool OnChestOpen(MemoryStream data, int x, int y, TSPlayer player)
|
||||||
{
|
{
|
||||||
if (ChestOpen == null)
|
if (ChestOpen == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var args = new ChestOpenEventArgs
|
var args = new ChestOpenEventArgs
|
||||||
{
|
{
|
||||||
|
Data = data,
|
||||||
X = x,
|
X = x,
|
||||||
Y = y,
|
Y = y,
|
||||||
Player = player,
|
Player = player,
|
||||||
|
|
@ -2547,7 +2543,7 @@ namespace TShockAPI
|
||||||
var x = args.Data.ReadInt16();
|
var x = args.Data.ReadInt16();
|
||||||
var y = args.Data.ReadInt16();
|
var y = args.Data.ReadInt16();
|
||||||
|
|
||||||
if (OnChestOpen(x, y, args.Player))
|
if (OnChestOpen(args.Data, x, y, args.Player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue