Add NoSnapService, undo application on plugin unload

This commit is contained in:
Loporrit
2025-07-24 16:32:45 +00:00
parent c455eb0009
commit 10366695f2
5 changed files with 80 additions and 5 deletions

View File

@@ -29,7 +29,6 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
private readonly FileCacheManager _fileDbManager;
private readonly GameObjectHandlerFactory _gameObjectHandlerFactory;
private readonly IpcManager _ipcManager;
private readonly IHostApplicationLifetime _lifetime;
private readonly PlayerPerformanceService _playerPerformanceService;
private readonly ServerConfigurationManager _serverConfigManager;
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
@@ -65,7 +64,6 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
_downloadManager = transferManager;
_pluginWarningNotificationManager = pluginWarningNotificationManager;
_dalamudUtil = dalamudUtil;
_lifetime = lifetime;
_fileDbManager = fileDbManager;
_playerPerformanceService = playerPerformanceService;
_serverConfigManager = serverConfigManager;
@@ -290,8 +288,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
Mediator.Publish(new EventMessage(new Event(name, Pair.UserData, nameof(PairHandler), EventSeverity.Informational, "Disposing User")));
}
if (!_lifetime.ApplicationStopping.IsCancellationRequested)
UndoApplicationAsync(applicationId).GetAwaiter().GetResult();
UndoApplicationAsync(applicationId).GetAwaiter().GetResult();
_applicationCancellationTokenSource?.Dispose();
_applicationCancellationTokenSource = null;

View File

@@ -171,6 +171,11 @@ public class Pair : DisposableMediatorSubscriberBase
if (_serverConfigurationManager.IsUidBlacklisted(UserData.UID))
HoldApplication("Blacklist", maxValue: 1);
if (NoSnapService.AnyLoaded)
HoldApplication("NoSnap", maxValue: 1);
else
UnholdApplication("NoSnap", skipApplication: true);
CachedPlayer.ApplyCharacterData(Guid.NewGuid(), RemoveNotSyncedFiles(LastReceivedCharacterData.DeepClone())!, forced);
}