Refactor LandGolfBallInCupHandler to use IPacketHandler<TArgs>

This commit is contained in:
Chris 2020-06-02 19:35:53 +09:30
parent f1e8fbd8ee
commit 7b316f3cd5
2 changed files with 4 additions and 3 deletions

View file

@ -55,7 +55,7 @@ namespace TShockAPI
GetDataHandlers.Emoji += EmojiHandler.OnReceive;
LandGolfBallInCupHandler = new Handlers.LandGolfBallInCupHandler();
GetDataHandlers.LandGolfBallInCup += LandGolfBallInCupHandler.OnLandGolfBallInCup;
GetDataHandlers.LandGolfBallInCup += LandGolfBallInCupHandler.OnReceive;
// Setup hooks
GetDataHandlers.GetSection += OnGetSection;

View file

@ -5,13 +5,14 @@ using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using static TShockAPI.GetDataHandlers;
namespace TShockAPI.Handlers
{
/// <summary>
/// Handles client side exploits of LandGolfBallInCup packet.
/// </summary>
public class LandGolfBallInCupHandler
public class LandGolfBallInCupHandler : IPacketHandler<LandGolfBallInCupEventArgs>
{
/// <summary>
/// List of golf ball projectile IDs.
@ -64,7 +65,7 @@ namespace TShockAPI.Handlers
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
public void OnLandGolfBallInCup(object sender, GetDataHandlers.LandGolfBallInCupEventArgs args)
public void OnReceive(object sender, LandGolfBallInCupEventArgs args)
{
if (args.PlayerIndex != args.Player.Index)
{