From c16e2141a70c8d924daf921cc1594622dbf94dd7 Mon Sep 17 00:00:00 2001 From: Anna Date: Sun, 4 Sep 2022 19:43:58 -0400 Subject: [PATCH] basic banning --- client/Commands.cs | 19 ++++++++++++++++++- client/Configuration.cs | 3 ++- client/Messages.cs | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/Commands.cs b/client/Commands.cs index d729571..f1300a1 100644 --- a/client/Commands.cs +++ b/client/Commands.cs @@ -18,6 +18,23 @@ internal class Commands : IDisposable { } private void OnCommand(string command, string arguments) { - this.Plugin.Ui.MainWindow.Visible ^= true; + switch (arguments) { + case "ban": + this.Plugin.Config.BannedTerritories.Add(this.Plugin.ClientState.TerritoryType); + this.Plugin.SaveConfig(); + this.Plugin.Messages.SpawnVfx(); + break; + case "unban": + this.Plugin.Config.BannedTerritories.Remove(this.Plugin.ClientState.TerritoryType); + this.Plugin.SaveConfig(); + this.Plugin.Messages.SpawnVfx(); + break; + case "refresh": + this.Plugin.Messages.SpawnVfx(); + break; + default: + this.Plugin.Ui.MainWindow.Visible ^= true; + break; + } } } diff --git a/client/Configuration.cs b/client/Configuration.cs index eead563..a04bc0d 100644 --- a/client/Configuration.cs +++ b/client/Configuration.cs @@ -1,10 +1,11 @@ using Dalamud.Configuration; -namespace OrangeGuidanceTomestone; +namespace OrangeGuidanceTomestone; [Serializable] public class Configuration : IPluginConfiguration { public int Version { get; set; } = 1; public string ApiKey { get; set; } = string.Empty; + public HashSet BannedTerritories { get; set; } = new(); } diff --git a/client/Messages.cs b/client/Messages.cs index 4b4de21..0141e0e 100644 --- a/client/Messages.cs +++ b/client/Messages.cs @@ -60,7 +60,7 @@ internal class Messages : IDisposable { internal void SpawnVfx() { var territory = this.Plugin.ClientState.TerritoryType; - if (territory == 0) { + if (territory == 0 || this.Plugin.Config.BannedTerritories.Contains(territory)) { return; }