From 82ac48db612f8d4e010dd023005701040e00e65b Mon Sep 17 00:00:00 2001 From: Goodlyay Date: Fri, 29 Mar 2024 06:07:37 -0700 Subject: [PATCH] Make default pronouns distinct from they/them This allows plugins to determine if a user has intentionally set them or not --- MCGalaxy/Commands/Chat/CmdPronouns.cs | 2 +- MCGalaxy/Player/Pronouns.cs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MCGalaxy/Commands/Chat/CmdPronouns.cs b/MCGalaxy/Commands/Chat/CmdPronouns.cs index 2fe778615..f739526b9 100644 --- a/MCGalaxy/Commands/Chat/CmdPronouns.cs +++ b/MCGalaxy/Commands/Chat/CmdPronouns.cs @@ -27,7 +27,7 @@ namespace MCGalaxy.Commands.Chatting { if (pro == null) { HelpList(p); return; } p.pronouns = pro; - p.Message("Your pronouns were changed to: &H{0}", pro.Name); + p.Message("Your pronouns were changed to: &T{0}", pro.Name); pro.SaveFor(p); } diff --git a/MCGalaxy/Player/Pronouns.cs b/MCGalaxy/Player/Pronouns.cs index 4b8ae9d41..1aaee232d 100644 --- a/MCGalaxy/Player/Pronouns.cs +++ b/MCGalaxy/Player/Pronouns.cs @@ -43,11 +43,11 @@ namespace MCGalaxy { Directory.CreateDirectory(PLAYER_PATH); } - Default = new Pronouns("they/them", "they", "their", "themselves", true); + Default = new Pronouns("default", "they", "their", "themselves", true); if (!File.Exists(CONFIG_FILE)) { - Loaded.Add(Default); + Loaded.Add(new Pronouns("they/them", "they", "their", "themselves", true)); Loaded.Add(new Pronouns("he/him", "he", "his", "himself", false)); Loaded.Add(new Pronouns("she/her", "she", "her", "herself", false)); @@ -70,6 +70,8 @@ namespace MCGalaxy { static void OnConfigUpdated() { lock (locker) { Loaded.Clear(); + Loaded.Add(Default); + try { using (StreamReader r = new StreamReader(CONFIG_FILE)) { while (!r.EndOfStream) { @@ -81,11 +83,6 @@ namespace MCGalaxy { } catch (Exception e) { Logger.LogError(e); } - - // Ensure the default is always in the loaded set (so it is visible/useable in user-side listings) - if (FindExact(Default.Name) == null) { - Loaded.Add(Default); - } } //In case any were deleted or changed @@ -104,10 +101,13 @@ namespace MCGalaxy { if (words[4].CaselessEq("singular")) { plural = false; } else if (words[4].CaselessEq("plural")) { plural = true; } else { - Logger.Log(LogType.Warning, "Failed to load the pronoun \"{0}\" because the 5th argument was not \"singular\" or \"plural\"", words[0]); + Logger.Log(LogType.Warning, "Failed to load the pronouns \"{0}\" because the 5th argument was not \"singular\" or \"plural\"", words[0]); + return; + } + if (FindExact(words[0]) != null) { + Logger.Log(LogType.Warning, "Cannot load pronouns \"{0}\" because it is already defined.", words[0]); return; } - Loaded.Add(new Pronouns(words[0], words[1], words[2], words[3], plural)); }