added config plugin
This commit is contained in:
24
ConfigPlugin/Config.cs
Normal file
24
ConfigPlugin/Config.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ConfigPlugin;
|
||||
|
||||
public class Config
|
||||
{
|
||||
public string? CustomMessage;
|
||||
public string? Player;
|
||||
|
||||
public void Write()
|
||||
{
|
||||
File.WriteAllText(ConfigPlugin.ConfigPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
}
|
||||
|
||||
public static Config? Read()
|
||||
{
|
||||
if (!File.Exists(ConfigPlugin.ConfigPath))
|
||||
{
|
||||
return new Config();
|
||||
}
|
||||
|
||||
return JsonConvert.DeserializeObject<Config>(File.ReadAllText(ConfigPlugin.ConfigPath));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user