From 50c1b757be7ea429658c161302404bec2e185bf8 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:50:44 +1030 Subject: [PATCH] Enforce new() constraint on ConfigFile --- TShockAPI/Configuration/ConfigFile.cs | 4 ++-- TShockAPI/Configuration/ServerSideConfig.cs | 5 ----- TShockAPI/Configuration/TShockConfig.cs | 5 ----- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/TShockAPI/Configuration/ConfigFile.cs b/TShockAPI/Configuration/ConfigFile.cs index 4a72a4ee..de0da0fe 100644 --- a/TShockAPI/Configuration/ConfigFile.cs +++ b/TShockAPI/Configuration/ConfigFile.cs @@ -8,12 +8,12 @@ namespace TShockAPI.Configuration /// Implements to provide a generic config file containing some settings /// /// - public class ConfigFile : IConfigFile + public class ConfigFile : IConfigFile where TSettings : new() { /// /// Settings managed by this config file /// - public virtual TSettings Settings { get; set; } + public virtual TSettings Settings { get; set; } = new TSettings(); /// /// Action invoked when the config file is read diff --git a/TShockAPI/Configuration/ServerSideConfig.cs b/TShockAPI/Configuration/ServerSideConfig.cs index cea8721e..d80e4bac 100644 --- a/TShockAPI/Configuration/ServerSideConfig.cs +++ b/TShockAPI/Configuration/ServerSideConfig.cs @@ -73,11 +73,6 @@ namespace TShockAPI.Configuration /// public class ServerSideConfig : ConfigFile { - /// - /// Settings managed by this configuration object - /// - public override SscSettings Settings { get; set; } = new SscSettings(); - /// /// Dumps all configuration options to a text file in Markdown format /// diff --git a/TShockAPI/Configuration/TShockConfig.cs b/TShockAPI/Configuration/TShockConfig.cs index 751873d0..332b58ba 100644 --- a/TShockAPI/Configuration/TShockConfig.cs +++ b/TShockAPI/Configuration/TShockConfig.cs @@ -592,11 +592,6 @@ namespace TShockAPI.Configuration /// public class TShockConfig : ConfigFile { - /// - /// TShock settings managed by this configuration object - /// - public override TShockSettings Settings { get; set; } = new TShockSettings(); - /// /// Upgrades the configuration file from the old format if required, then reads and returns the currently configured ///