Beginning work on adding Bukkit style event hooks.
This commit is contained in:
parent
c6abbfe4d2
commit
4864bd94b8
2 changed files with 13 additions and 4 deletions
|
|
@ -49,7 +49,17 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
private static Dictionary<PacketTypes, GetDataHandlerDelegate> GetDataHandlerDelegates;
|
private static Dictionary<PacketTypes, GetDataHandlerDelegate> GetDataHandlerDelegates;
|
||||||
public static int[] WhitelistBuffMaxTime;
|
public static int[] WhitelistBuffMaxTime;
|
||||||
|
#region Events
|
||||||
|
public static event TileEditHandler TileEdit;
|
||||||
|
public delegate void TileEditHandler(float x, float y, float type, float delete);
|
||||||
|
public static void OnTileEdit(float x, float y, float type, float editType)
|
||||||
|
{
|
||||||
|
if (TileEdit != null)
|
||||||
|
{
|
||||||
|
TileEdit(x, y, type, editType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
public static void InitGetDataHandler()
|
public static void InitGetDataHandler()
|
||||||
{
|
{
|
||||||
#region Blacklists
|
#region Blacklists
|
||||||
|
|
@ -147,7 +157,7 @@ namespace TShockAPI
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool HandlePlayerHp(GetDataHandlerArgs args)
|
public static bool HandlePlayerHp(GetDataHandlerArgs args)
|
||||||
{
|
{
|
||||||
int plr = args.Data.ReadInt8();
|
int plr = args.Data.ReadInt8();
|
||||||
int cur = args.Data.ReadInt16();
|
int cur = args.Data.ReadInt16();
|
||||||
|
|
@ -568,7 +578,7 @@ namespace TShockAPI
|
||||||
var tileX = args.Data.ReadInt32();
|
var tileX = args.Data.ReadInt32();
|
||||||
var tileY = args.Data.ReadInt32();
|
var tileY = args.Data.ReadInt32();
|
||||||
var tiletype = args.Data.ReadInt8();
|
var tiletype = args.Data.ReadInt8();
|
||||||
|
OnTileEdit(tileX, tileY, tiletype, type);
|
||||||
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
|
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -439,7 +439,6 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DateTime LastCheck = DateTime.UtcNow;
|
private DateTime LastCheck = DateTime.UtcNow;
|
||||||
private DateTime LastSave = DateTime.UtcNow;
|
private DateTime LastSave = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue