using System;
using StardewModdingAPI.Events;
namespace StardewModdingAPI.Framework.Events
{
/// Events raised for multiplayer messages and connections.
internal class ModMultiplayerEvents : ModEventsBase, IMultiplayerEvents
{
/*********
** Accessors
*********/
/// Raised after the mod context for a peer is received. This happens before the game approves the connection (), so the player doesn't yet exist in the game. This is the earliest point where messages can be sent to the peer via SMAPI.
public event EventHandler PeerContextReceived
{
add => this.EventManager.PeerContextReceived.Add(value);
remove => this.EventManager.PeerContextReceived.Remove(value);
}
/// Raised after a peer connection is approved by the game.
public event EventHandler PeerConnected
{
add => this.EventManager.PeerConnected.Add(value);
remove => this.EventManager.PeerConnected.Remove(value);
}
/// Raised after a mod message is received over the network.
public event EventHandler ModMessageReceived
{
add => this.EventManager.ModMessageReceived.Add(value);
remove => this.EventManager.ModMessageReceived.Remove(value);
}
/// Raised after the connection with a peer is severed.
public event EventHandler PeerDisconnected
{
add => this.EventManager.PeerDisconnected.Add(value);
remove => this.EventManager.PeerDisconnected.Remove(value);
}
/*********
** Public methods
*********/
/// Construct an instance.
/// The mod which uses this instance.
/// The underlying event manager.
internal ModMultiplayerEvents(IModMetadata mod, EventManager eventManager)
: base(mod, eventManager) { }
}
}