From 11a2a3e21b6978d1eb451817b624323da77c2a30 Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Thu, 18 Jun 2020 16:34:33 +0200 Subject: [PATCH] GetDataHandler - Code formatting. Modify order of Handler to respect PacketType value. --- TShockAPI/GetDataHandlers.cs | 67 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 4a1c90fd..d0024e51 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1870,6 +1870,39 @@ namespace TShockAPI return args.Handled; } + /// For use in an Emoji event. + /// + public class EmojiEventArgs : GetDataHandledEventArgs + { + /// + /// The player index in the packet, who sends the emoji. + /// + public byte PlayerIndex { get; set; } + /// + /// The ID of the emoji, that is being received. + /// + public byte EmojiID { get; set; } + } + /// + /// Called when a player sends an emoji. + /// + public static HandlerList Emoji = new HandlerList(); + private static bool OnEmoji(TSPlayer player, MemoryStream data, byte playerIndex, byte emojiID) + { + if (Emoji == null) + return false; + + var args = new EmojiEventArgs + { + Player = player, + Data = data, + PlayerIndex = playerIndex, + EmojiID = emojiID + }; + Emoji.Invoke(null, args); + return args.Handled; + } + /// /// For use in a SyncTilePicking event. /// @@ -1912,40 +1945,6 @@ namespace TShockAPI return args.Handled; } - - /// For use in an Emoji event. - /// - public class EmojiEventArgs : GetDataHandledEventArgs - { - /// - /// The player index in the packet, who sends the emoji. - /// - public byte PlayerIndex { get; set; } - /// - /// The ID of the emoji, that is being received. - /// - public byte EmojiID { get; set; } - } - /// - /// Called when a player sends an emoji. - /// - public static HandlerList Emoji = new HandlerList(); - private static bool OnEmoji(TSPlayer player, MemoryStream data, byte playerIndex, byte emojiID) - { - if (Emoji == null) - return false; - - var args = new EmojiEventArgs - { - Player = player, - Data = data, - PlayerIndex = playerIndex, - EmojiID = emojiID - }; - Emoji.Invoke(null, args); - return args.Handled; - } - /// /// For use in a LandBallInCup event. ///