HUDManager/HUD Manager/Swapper.cs

34 lines
880 B
C#
Raw Normal View History

2021-03-19 01:02:50 +00:00
using System;
2021-08-24 01:21:29 +00:00
using Dalamud.Game;
2021-03-08 15:03:11 +00:00
namespace HUD_Manager {
2021-03-19 01:02:50 +00:00
public class Swapper : IDisposable {
2021-03-08 15:03:11 +00:00
private Plugin Plugin { get; }
public Swapper(Plugin plugin) {
this.Plugin = plugin;
2021-03-19 01:02:50 +00:00
2021-08-24 01:21:29 +00:00
this.Plugin.Framework.Update += this.OnFrameworkUpdate;
2021-03-19 01:02:50 +00:00
}
public void Dispose() {
2021-08-24 01:21:29 +00:00
this.Plugin.Framework.Update -= this.OnFrameworkUpdate;
2021-03-08 15:03:11 +00:00
}
2021-08-24 01:21:29 +00:00
private void OnFrameworkUpdate(Framework framework) {
2021-03-08 15:03:11 +00:00
if (!this.Plugin.Config.SwapsEnabled || !this.Plugin.Config.UnderstandsRisks) {
return;
}
2021-08-24 01:21:29 +00:00
var player = this.Plugin.ClientState.LocalPlayer;
2021-03-08 15:03:11 +00:00
if (player == null) {
return;
}
if (this.Plugin.Statuses.Update(player)) {
this.Plugin.Statuses.SetHudLayout(null);
}
}
}
}