This is C#, not javascript!
This commit is contained in:
parent
966735ec2e
commit
43beb99cb7
5 changed files with 127 additions and 127 deletions
|
|
@ -28,32 +28,32 @@ namespace TShockAPI
|
|||
{
|
||||
//Add default values here and in ConfigFile.cs
|
||||
//Values written here will automatically be pulled into a config file on save.
|
||||
public static int invasionMultiplier = 1;
|
||||
public static int defaultMaxSpawns = 4;
|
||||
public static int defaultSpawnRate = 700;
|
||||
public static int serverPort = 7777;
|
||||
public static bool enableWhitelist = false;
|
||||
public static bool infiniteInvasion = false;
|
||||
public static bool permaPvp = false;
|
||||
public static int killCount;
|
||||
public static bool kickCheater = true;
|
||||
public static bool banCheater = true;
|
||||
public static bool kickGriefer = true;
|
||||
public static bool banGriefer = true;
|
||||
public static bool banTnt = true;
|
||||
public static bool kickTnt = true;
|
||||
public static bool banBoom = true;
|
||||
public static bool kickBoom = true;
|
||||
public static bool spawnProtect = true;
|
||||
public static bool rangeChecks = true;
|
||||
public static int spawnProtectRadius = 5;
|
||||
public static string distributationAgent = "facepunch";
|
||||
public static int authToken;
|
||||
public static int maxSlots = 8;
|
||||
public static bool spamChecks = false;
|
||||
public static bool disableBuild = false;
|
||||
public static float[] adminChatRGB = {255, 0, 0};
|
||||
public static string adminChatPrefix = "(Admin) ";
|
||||
public static int InvasionMultiplier = 1;
|
||||
public static int DefaultMaxSpawns = 4;
|
||||
public static int DefaultSpawnRate = 700;
|
||||
public static int ServerPort = 7777;
|
||||
public static bool EnableWhitelist = false;
|
||||
public static bool InfiniteInvasion = false;
|
||||
public static bool PermaPvp = false;
|
||||
public static int KillCount;
|
||||
public static bool KickCheater = true;
|
||||
public static bool BanCheater = true;
|
||||
public static bool KickGriefer = true;
|
||||
public static bool BanGriefer = true;
|
||||
public static bool BanTnt = true;
|
||||
public static bool KickTnt = true;
|
||||
public static bool BanBoom = true;
|
||||
public static bool KickBoom = true;
|
||||
public static bool SpawnProtect = true;
|
||||
public static bool RangeChecks = true;
|
||||
public static int SpawnProtectRadius = 5;
|
||||
public static string DistributationAgent = "facepunch";
|
||||
public static int AuthToken;
|
||||
public static int MaxSlots = 8;
|
||||
public static bool SpamChecks = false;
|
||||
public static bool DisableBuild = false;
|
||||
public static float[] AdminChatRGB = {255, 0, 0};
|
||||
public static string AdminChatPrefix = "(Admin) ";
|
||||
|
||||
public enum NPCList
|
||||
{
|
||||
|
|
@ -68,60 +68,60 @@ namespace TShockAPI
|
|||
ConfigFile cfg = JsonConvert.DeserializeObject<ConfigFile>(tr.ReadToEnd());
|
||||
tr.Close();
|
||||
|
||||
invasionMultiplier = cfg.InvasionMultiplier;
|
||||
defaultMaxSpawns = cfg.DefaultMaximumSpawns;
|
||||
defaultSpawnRate = cfg.DefaultSpawnRate;
|
||||
serverPort = cfg.ServerPort;
|
||||
enableWhitelist = cfg.EnableWhitelist;
|
||||
infiniteInvasion = cfg.InfiniteInvasion;
|
||||
permaPvp = cfg.AlwaysPvP;
|
||||
kickCheater = cfg.KickCheaters;
|
||||
banCheater = cfg.BanCheaters;
|
||||
kickGriefer = cfg.KickGriefers;
|
||||
banGriefer = cfg.BanGriefers;
|
||||
banTnt = cfg.BanKillTileAbusers;
|
||||
kickTnt = cfg.KickKillTileAbusers;
|
||||
banBoom = cfg.BanExplosives;
|
||||
kickBoom = cfg.KickExplosives;
|
||||
spawnProtect = cfg.SpawnProtection;
|
||||
spawnProtectRadius = cfg.SpawnProtectionRadius;
|
||||
distributationAgent = cfg.DistributationAgent;
|
||||
maxSlots = cfg.MaxSlots;
|
||||
rangeChecks = cfg.RangeChecks;
|
||||
spamChecks = cfg.SpamChecks;
|
||||
disableBuild = cfg.DisableBuild;
|
||||
NPC.maxSpawns = defaultMaxSpawns;
|
||||
NPC.defaultSpawnRate = defaultSpawnRate;
|
||||
adminChatRGB = cfg.AdminChatRGB;
|
||||
adminChatPrefix = cfg.AdminChatPrefix;
|
||||
InvasionMultiplier = cfg.InvasionMultiplier;
|
||||
DefaultMaxSpawns = cfg.DefaultMaximumSpawns;
|
||||
DefaultSpawnRate = cfg.DefaultSpawnRate;
|
||||
ServerPort = cfg.ServerPort;
|
||||
EnableWhitelist = cfg.EnableWhitelist;
|
||||
InfiniteInvasion = cfg.InfiniteInvasion;
|
||||
PermaPvp = cfg.AlwaysPvP;
|
||||
KickCheater = cfg.KickCheaters;
|
||||
BanCheater = cfg.BanCheaters;
|
||||
KickGriefer = cfg.KickGriefers;
|
||||
BanGriefer = cfg.BanGriefers;
|
||||
BanTnt = cfg.BanKillTileAbusers;
|
||||
KickTnt = cfg.KickKillTileAbusers;
|
||||
BanBoom = cfg.BanExplosives;
|
||||
KickBoom = cfg.KickExplosives;
|
||||
SpawnProtect = cfg.SpawnProtection;
|
||||
SpawnProtectRadius = cfg.SpawnProtectionRadius;
|
||||
DistributationAgent = cfg.DistributationAgent;
|
||||
MaxSlots = cfg.MaxSlots;
|
||||
RangeChecks = cfg.RangeChecks;
|
||||
SpamChecks = cfg.SpamChecks;
|
||||
DisableBuild = cfg.DisableBuild;
|
||||
NPC.maxSpawns = DefaultMaxSpawns;
|
||||
NPC.defaultSpawnRate = DefaultSpawnRate;
|
||||
AdminChatRGB = cfg.AdminChatRGB;
|
||||
AdminChatPrefix = cfg.AdminChatPrefix;
|
||||
}
|
||||
|
||||
public static void WriteJsonConfiguration()
|
||||
{
|
||||
ConfigFile cfg = new ConfigFile();
|
||||
cfg.InvasionMultiplier = invasionMultiplier;
|
||||
cfg.DefaultMaximumSpawns = defaultMaxSpawns;
|
||||
cfg.DefaultSpawnRate = defaultSpawnRate;
|
||||
cfg.ServerPort = serverPort;
|
||||
cfg.EnableWhitelist = enableWhitelist;
|
||||
cfg.InfiniteInvasion = infiniteInvasion;
|
||||
cfg.AlwaysPvP = permaPvp;
|
||||
cfg.KickCheaters = kickCheater;
|
||||
cfg.BanCheaters = banCheater;
|
||||
cfg.KickGriefers = kickGriefer;
|
||||
cfg.BanGriefers = banGriefer;
|
||||
cfg.BanKillTileAbusers = banGriefer;
|
||||
cfg.KickKillTileAbusers = kickGriefer;
|
||||
cfg.BanExplosives = banBoom;
|
||||
cfg.KickExplosives = kickBoom;
|
||||
cfg.SpawnProtection = spawnProtect;
|
||||
cfg.SpawnProtectionRadius = spawnProtectRadius;
|
||||
cfg.MaxSlots = maxSlots;
|
||||
cfg.RangeChecks = rangeChecks;
|
||||
cfg.SpamChecks = spamChecks;
|
||||
cfg.DisableBuild = disableBuild;
|
||||
cfg.AdminChatRGB = adminChatRGB;
|
||||
cfg.AdminChatPrefix = adminChatPrefix;
|
||||
cfg.InvasionMultiplier = InvasionMultiplier;
|
||||
cfg.DefaultMaximumSpawns = DefaultMaxSpawns;
|
||||
cfg.DefaultSpawnRate = DefaultSpawnRate;
|
||||
cfg.ServerPort = ServerPort;
|
||||
cfg.EnableWhitelist = EnableWhitelist;
|
||||
cfg.InfiniteInvasion = InfiniteInvasion;
|
||||
cfg.AlwaysPvP = PermaPvp;
|
||||
cfg.KickCheaters = KickCheater;
|
||||
cfg.BanCheaters = BanCheater;
|
||||
cfg.KickGriefers = KickGriefer;
|
||||
cfg.BanGriefers = BanGriefer;
|
||||
cfg.BanKillTileAbusers = BanGriefer;
|
||||
cfg.KickKillTileAbusers = KickGriefer;
|
||||
cfg.BanExplosives = BanBoom;
|
||||
cfg.KickExplosives = KickBoom;
|
||||
cfg.SpawnProtection = SpawnProtect;
|
||||
cfg.SpawnProtectionRadius = SpawnProtectRadius;
|
||||
cfg.MaxSlots = MaxSlots;
|
||||
cfg.RangeChecks = RangeChecks;
|
||||
cfg.SpamChecks = SpamChecks;
|
||||
cfg.DisableBuild = DisableBuild;
|
||||
cfg.AdminChatRGB = AdminChatRGB;
|
||||
cfg.AdminChatPrefix = AdminChatPrefix;
|
||||
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
||||
TextWriter tr = new StreamWriter(FileTools.ConfigPath);
|
||||
tr.Write(json);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue