//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.GameLogic.PlugIns;
using System.Runtime.InteropServices;
using MUnique.OpenMU.GameLogic.Views.Party;
using MUnique.OpenMU.PlugIns;
///
/// Listens for the and automatically rejoins the player
/// to their previous party if it still exists when they enter the world.
///
[PlugIn]
[Display(
Name = nameof(PlugInResources.PartyAutoRejoinPlugIn_Name),
Description = nameof(PlugInResources.PartyAutoRejoinPlugIn_Description),
ResourceType = typeof(PlugInResources))]
[Guid("013406B3-02AD-45EF-906B-177CBEC9B2D4")]
public sealed class PartyAutoRejoinPlugIn : IPlayerStateChangedPlugIn
{
///
public async ValueTask PlayerStateChangedAsync(Player player, State previousState, State currentState)
{
if (currentState != PlayerState.EnteredWorld)
{
return;
}
await player.GameContext.PartyManager.OnMemberReconnectedAsync(player).ConfigureAwait(false);
}
}