using System;
using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
/// Events raised when the player data changes.
public static class PlayerEvents
{
/*********
** Properties
*********/
/// The core event manager.
private static EventManager EventManager;
/*********
** Events
*********/
/// Raised after the player's inventory changes in any way (added or removed item, sorted, etc).
public static event EventHandler InventoryChanged
{
add => PlayerEvents.EventManager.Legacy_InventoryChanged.Add(value);
remove => PlayerEvents.EventManager.Legacy_InventoryChanged.Remove(value);
}
/// Raised after the player levels up a skill. This happens as soon as they level up, not when the game notifies the player after their character goes to bed.
public static event EventHandler LeveledUp
{
add => PlayerEvents.EventManager.Legacy_LeveledUp.Add(value);
remove => PlayerEvents.EventManager.Legacy_LeveledUp.Remove(value);
}
/// Raised after the player warps to a new location.
public static event EventHandler Warped
{
add => PlayerEvents.EventManager.Legacy_PlayerWarped.Add(value);
remove => PlayerEvents.EventManager.Legacy_PlayerWarped.Remove(value);
}
/*********
** Public methods
*********/
/// Initialise the events.
/// The core event manager.
internal static void Init(EventManager eventManager)
{
PlayerEvents.EventManager = eventManager;
}
}
}