From a549d26492d7326b747c7ab4dfff75c2b97bfe25 Mon Sep 17 00:00:00 2001 From: MidoriKami Date: Sat, 13 Jul 2024 14:50:57 -0700 Subject: [PATCH] Add missing warnings --- Configuration/ConfigurationManagerWindow.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Configuration/ConfigurationManagerWindow.cs b/Configuration/ConfigurationManagerWindow.cs index adfcb56..81b57fb 100644 --- a/Configuration/ConfigurationManagerWindow.cs +++ b/Configuration/ConfigurationManagerWindow.cs @@ -23,6 +23,8 @@ public class ConfigurationManagerWindow : Window.Window, IDisposable { [PluginService] private ITextureProvider TextureProvider { get; set; } = null!; [PluginService] private INotificationManager NotificationManager { get; set; } = null!; [PluginService] private IPluginLog Log { get; set; } = null!; + [PluginService] private IClientState ClientState { get; set; } = null!; + [PluginService] private IChatGui ChatGui { get; set; } = null!; private List characters = []; @@ -169,9 +171,19 @@ private void ShowCharacterMultiSelectWindow() { MultiSelectionCallback = selectedCharacters => { destinationCharacters = selectedCharacters; - if (selectedSourceCharacter != null && destinationCharacters is not null && destinationCharacters.Contains(selectedSourceCharacter)) { - destinationCharacters.Remove(selectedSourceCharacter); - } + destinationCharacters.RemoveAll(character => { + if (character == selectedSourceCharacter) { + ChatGui.PrintError("Unable to select same source and target character.", PluginInterface.InternalName, 45); + return true; + } + + if (character.ContentId == ClientState.LocalContentId) { + ChatGui.PrintError("Unable to select currently logged in character as target.", PluginInterface.InternalName, 45); + return true; + } + + return false; + }); }, SelectionOptions = characters.ToList(), });