Skip to content

Commit

Permalink
use SortedSet instead of List for settings
Browse files Browse the repository at this point in the history
To enforce unique entries and maintain a stable order inside of the `settings.json`.
  • Loading branch information
Istador authored and piplup55 committed Sep 28, 2023
1 parent 1483e48 commit ebe7906
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Server/BanLists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ private set {
}
}

private static List<string> IPs {
private static ISet<string> IPs {
get {
return Settings.Instance.BanList.IpAddresses;
}
}

private static List<Guid> Profiles {
private static ISet<Guid> Profiles {
get {
return Settings.Instance.BanList.Players;
}
Expand Down
6 changes: 3 additions & 3 deletions Server/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public class ScenarioTable {

public class BanListTable {
public bool Enabled { get; set; } = false;
public List<Guid> Players { get; set; } = new List<Guid>();
public List<string> IpAddresses { get; set; } = new List<string>();
public ISet<Guid> Players { get; set; } = new SortedSet<Guid>();
public ISet<string> IpAddresses { get; set; } = new SortedSet<string>();
}

public class FlipTable {
public bool Enabled { get; set; } = true;
public List<Guid> Players { get; set; } = new List<Guid>();
public ISet<Guid> Players { get; set; } = new SortedSet<Guid>();
public FlipOptions Pov { get; set; } = FlipOptions.Both;
}

Expand Down

0 comments on commit ebe7906

Please sign in to comment.