Add PlayerBuff hook
This commit is contained in:
parent
9998890ace
commit
5c9639c9c1
1 changed files with 26 additions and 0 deletions
|
|
@ -497,6 +497,29 @@ namespace TShockAPI
|
|||
return args.Handled;
|
||||
}
|
||||
|
||||
public class PlayerBuffEventArgs : HandledEventArgs
|
||||
{
|
||||
public byte ID { get; set; }
|
||||
public byte Type { get; set; }
|
||||
public short Time { get; set; }
|
||||
}
|
||||
public static HandlerList<PlayerBuffEventArgs> PlayerBuff;
|
||||
|
||||
private static bool OnPlayerBuff(byte id, byte type, short time)
|
||||
{
|
||||
if (PlayerBuff == null)
|
||||
return false;
|
||||
|
||||
var args = new PlayerBuffEventArgs
|
||||
{
|
||||
ID = id,
|
||||
Type = type,
|
||||
Time = time,
|
||||
};
|
||||
PlayerBuff.Invoke(null, args);
|
||||
return args.Handled;
|
||||
}
|
||||
|
||||
#endregion
|
||||
public static void InitGetDataHandler()
|
||||
{
|
||||
|
|
@ -1769,6 +1792,9 @@ namespace TShockAPI
|
|||
var type = args.Data.ReadInt8();
|
||||
var time = args.Data.ReadInt16();
|
||||
|
||||
if (OnPlayerBuff(id, type, time))
|
||||
return true;
|
||||
|
||||
if (TShock.CheckIgnores(args.Player))
|
||||
{
|
||||
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue