Added HandlerList.cs so that we can have prioritized event handlers also so you can easily register a handler and not have to put 'if (e.Handled) return;' at the top.

This commit is contained in:
high 2011-12-30 20:32:03 -05:00
parent bf50a82cbd
commit 6437d2a977
3 changed files with 83 additions and 6 deletions

View file

@ -58,12 +58,9 @@ namespace TShockAPI
public float Type { get; set; }
public float EditType { get; set; }
}
public static event EventHandler<TileEditEventArgs> TileEdit;
public static HandlerList<TileEditEventArgs> TileEdit = new HandlerList<TileEditEventArgs>();
public static bool OnTileEdit(float x, float y, float type, float editType)
{
if (TileEdit == null)
return false;
var args = new TileEditEventArgs
{
X = x,
@ -71,7 +68,7 @@ namespace TShockAPI
Type = type,
EditType = editType
};
TileEdit(null, args);
TileEdit.Invoke(null, args);
return args.Handled;
}
#endregion