From 54882b6deb827e3a67c493bcbcba2ab06e460a87 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sun, 1 Jan 2012 02:16:15 -0700 Subject: [PATCH] Add PlayerAnimation hook --- TShockAPI/GetDataHandlers.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index ca4b4d3a..2e4e4fdf 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -624,6 +624,21 @@ namespace TShockAPI return args.Handled; } + public class PlayerAnimationEventArgs : HandledEventArgs + { + } + public static HandlerList PlayerAnimation; + + private static bool OnPlayerAnimation() + { + if (PlayerAnimation == null) + return false; + + var args = new PlayerAnimationEventArgs {}; + PlayerAnimation.Invoke(null, args); + return args.Handled; + } + #endregion public static void InitGetDataHandler() { @@ -2103,6 +2118,10 @@ namespace TShockAPI private static bool HandlePlayerAnimation(GetDataHandlerArgs args) { + + if (OnPlayerAnimation()) + return true; + if (TShock.CheckIgnores(args.Player)) { args.Player.SendData(PacketTypes.PlayerAnimation, "", args.Player.Index);