From ac2c4a2129656f8c5431b42a1e62e828623dbbb8 Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 24 Jan 2025 09:51:43 +0000 Subject: [PATCH] Linted class --- Libraries/Core/Services/OpenZoneService.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Libraries/Core/Services/OpenZoneService.cs b/Libraries/Core/Services/OpenZoneService.cs index e59e245e..38ecfe24 100644 --- a/Libraries/Core/Services/OpenZoneService.cs +++ b/Libraries/Core/Services/OpenZoneService.cs @@ -11,22 +11,18 @@ public class OpenZoneService( DatabaseService _databaseService, LocalisationService _localisationService, ConfigServer _configServer - ) +) { protected LocationConfig _locationConfig = _configServer.GetConfig(); /// - /// Add open zone to specified map + /// Add open zone to specified map /// /// map location (e.g. factory4_day) /// zone to add public void AddZoneToMap(string locationId, string zoneToAdd) { - var location = _locationConfig.OpenZones[locationId]; - if (location is null) - { - _locationConfig.OpenZones[locationId] = []; - } + _locationConfig.OpenZones.TryAdd(locationId, []); if (!_locationConfig.OpenZones[locationId].Contains(zoneToAdd)) { @@ -35,12 +31,13 @@ public class OpenZoneService( } /// - /// Add open zones to all maps found in config/location.json to db + /// Add open zones to all maps found in config/location.json to db /// public void ApplyZoneChangesToAllMaps() { var dbLocations = _databaseService.GetLocations().GetDictionary(); - foreach (var mapKvP in _locationConfig.OpenZones) { + foreach (var mapKvP in _locationConfig.OpenZones) + { if (!dbLocations.ContainsKey(mapKvP.Key)) { _logger.Error(_localisationService.GetText("openzone-unable_to_find_map", mapKvP));