From 7082f28e5f18bcf99091d944a38d65d48498ce5b Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Thu, 23 Mar 2023 21:27:13 +0100 Subject: [PATCH] use SortedSet instead of List for settings To enforce unique entries and maintain a stable order inside of the `settings.json`. --- Server/BanLists.cs | 4 ++-- Server/Settings.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Server/BanLists.cs b/Server/BanLists.cs index 6ce8fba..a21f0c9 100644 --- a/Server/BanLists.cs +++ b/Server/BanLists.cs @@ -18,13 +18,13 @@ public static class BanLists { } } - private static List IPs { + private static ISet IPs { get { return Settings.Instance.BanList.IpAddresses; } } - private static List Profiles { + private static ISet Profiles { get { return Settings.Instance.BanList.Players; } diff --git a/Server/Settings.cs b/Server/Settings.cs index 0fe13fb..d1610f3 100644 --- a/Server/Settings.cs +++ b/Server/Settings.cs @@ -60,13 +60,13 @@ public class Settings { public class BanListTable { public bool Enabled { get; set; } = false; - public List Players { get; set; } = new List(); - public List IpAddresses { get; set; } = new List(); + public ISet Players { get; set; } = new SortedSet(); + public ISet IpAddresses { get; set; } = new SortedSet(); } public class FlipTable { public bool Enabled { get; set; } = true; - public List Players { get; set; } = new List(); + public ISet Players { get; set; } = new SortedSet(); public FlipOptions Pov { get; set; } = FlipOptions.Both; }