Sign hook
This commit is contained in:
parent
9c9769fd5e
commit
addea02fb7
1 changed files with 26 additions and 0 deletions
|
|
@ -449,6 +449,29 @@ namespace TShockAPI
|
|||
return args.Handled;
|
||||
}
|
||||
|
||||
public class SignEventArgs : HandledEventArgs
|
||||
{
|
||||
public short ID { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
||||
public static HandlerList<ChestOpenEventArgs> Sign;
|
||||
|
||||
private static bool OnSignEvent(short id, int x, int y)
|
||||
{
|
||||
if (Sign == null)
|
||||
return false;
|
||||
|
||||
var args = new SignEventArgs
|
||||
{
|
||||
ID = id,
|
||||
X = x,
|
||||
Y = y,
|
||||
};
|
||||
Sign.Invoke(null, args);
|
||||
return args.Handled;
|
||||
}
|
||||
|
||||
#endregion
|
||||
public static void InitGetDataHandler()
|
||||
{
|
||||
|
|
@ -1664,6 +1687,9 @@ namespace TShockAPI
|
|||
var x = args.Data.ReadInt32();
|
||||
var y = args.Data.ReadInt32();
|
||||
|
||||
if (OnSignEvent(id, x, y))
|
||||
return true;
|
||||
|
||||
if (TShock.CheckTilePermission(args.Player, x, y))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.SignNew, "", id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue