diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index a5adc6d4..fcb05489 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -152,6 +152,7 @@ namespace TShockAPI
{ PacketTypes.PlayerHurtV2, HandlePlayerDamageV2 },
{ PacketTypes.PlayerDeathV2, HandlePlayerKillMeV2 },
{ PacketTypes.SyncRevengeMarker, HandleSyncRevengeMarker },
+ { PacketTypes.LandGolfBallInCup, HandleLandGolfBallInCup },
{ PacketTypes.FishOutNPC, HandleFishOutNPC },
{ PacketTypes.FoodPlatterTryPlacing, HandleFoodPlatterTryPlacing }
};
@@ -1866,6 +1867,56 @@ namespace TShockAPI
return args.Handled;
}
+ ///
+ /// For use in a LandGolfBallInCup event.
+ ///
+ public class LandGolfBallInCupEventArgs : GetDataHandledEventArgs
+ {
+ ///
+ /// The player index in the packet, who puts the ball in the cup.
+ ///
+ public byte PlayerIndex { get; set; }
+ ///
+ /// The X tile position of where the ball lands in a cup.
+ ///
+ public ushort TileX { get; set; }
+ ///
+ /// The Y tile position of where the ball lands in a cup.
+ ///
+ public ushort TileY { get; set; }
+ ///
+ /// The amount of hits it took for the player to land the ball in the cup.
+ ///
+ public ushort Hits { get; set; }
+ ///
+ /// The type of the projectile that was landed in the cup. A golfball in legit cases.
+ ///
+ public ushort ProjectileType { get; set; }
+ }
+
+ ///
+ /// Called when a player lands a golf ball in a cup.
+ ///
+ public static HandlerList LandGolfBallInCup = new HandlerList();
+ private static bool OnLandGolfBallInCup(TSPlayer player, MemoryStream data, byte playerIndex, ushort tileX, ushort tileY, ushort hits, ushort projectileType )
+ {
+ if (LandGolfBallInCup == null)
+ return false;
+
+ var args = new LandGolfBallInCupEventArgs
+ {
+ Player = player,
+ Data = data,
+ PlayerIndex = playerIndex,
+ TileX = tileX,
+ TileY = tileY,
+ Hits = hits,
+ ProjectileType = projectileType
+ };
+ LandGolfBallInCup.Invoke(null, args);
+ return args.Handled;
+ }
+
///
/// For use in a FishOutNPC event.
///
@@ -3686,6 +3737,20 @@ namespace TShockAPI
return false;
}
+ private static bool HandleLandGolfBallInCup(GetDataHandlerArgs args)
+ {
+ byte playerIndex = args.Data.ReadInt8();
+ ushort tileX = args.Data.ReadUInt16();
+ ushort tileY = args.Data.ReadUInt16();
+ ushort hits = args.Data.ReadUInt16();
+ ushort projectileType = args.Data.ReadUInt16();
+
+ if (OnLandGolfBallInCup(args.Player, args.Data, playerIndex, tileX, tileY, hits, projectileType))
+ return true;
+
+ return false;
+ }
+
private static bool HandleFishOutNPC(GetDataHandlerArgs args)
{
ushort tileX = args.Data.ReadUInt16();