#if !SMAPI_3_0_STRICT
using System;
using StardewModdingAPI.Framework;
using StardewModdingAPI.Framework.Events;
namespace StardewModdingAPI.Events
{
/// Events raised when the player data changes.
[Obsolete("Use " + nameof(Mod.Helper) + "." + nameof(IModHelper.Events) + " instead. See https://smapi.io/3.0 for more info.")]
public static class PlayerEvents
{
/*********
** Properties
*********/
/// The core event manager.
private static EventManager EventManager;
/// Manages deprecation warnings.
private static DeprecationManager DeprecationManager;
/*********
** Events
*********/
/// Raised after the player's inventory changes in any way (added or removed item, sorted, etc).
public static event EventHandler InventoryChanged
{
add
{
PlayerEvents.DeprecationManager.WarnForOldEvents();
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.DeprecationManager.WarnForOldEvents();
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.DeprecationManager.WarnForOldEvents();
PlayerEvents.EventManager.Legacy_PlayerWarped.Add(value);
}
remove => PlayerEvents.EventManager.Legacy_PlayerWarped.Remove(value);
}
/*********
** Public methods
*********/
/// Initialise the events.
/// The core event manager.
/// Manages deprecation warnings.
internal static void Init(EventManager eventManager, DeprecationManager deprecationManager)
{
PlayerEvents.EventManager = eventManager;
PlayerEvents.DeprecationManager = deprecationManager;
}
}
}
#endif