From a27e43f758346c494974f470a893b349c69da8b8 Mon Sep 17 00:00:00 2001 From: KZ Date: Sun, 7 Jun 2020 13:22:21 -0700 Subject: [PATCH 1/7] Initial sorting, need to merge in changes from master though --- TShockAPI/ConfigFile.cs | 548 ++++++++++++++++++++-------------------- 1 file changed, 276 insertions(+), 272 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 996823b1..501a5e56 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -30,53 +30,55 @@ namespace TShockAPI /// The config file class, which contains the configuration for a server that is serialized into JSON and deserialized on load. public class ConfigFile { - /// Determines the size of invasion events. The equation for calculating invasion size = 100 + (multiplier * (number of active players > 200 hp)). - [Description("Determines the size of invasion events.\nThe equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health)).")] - public int InvasionMultiplier = 1; - /// The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave. - [Description("The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave.")] - public int DefaultMaximumSpawns = 5; - - /// The delay between waves. Lower values lead to more mobs. - [Description("The delay between waves. Lower values lead to more mobs.")] - public int DefaultSpawnRate = 600; + // Server /// The port the server runs on. [Description("The port the server runs on.")] public int ServerPort = 7777; - /// Enable or disable the whitelist based on IP addresses in the whitelist.txt file. - [Description("Enable or disable the whitelist based on IP addresses in the whitelist.txt file.")] - public bool EnableWhitelist; - - /// Enables never-ending invasion events. You still need to start the event. - [Description("Enables never ending invasion events. You still need to start the event, such as with the /invade command.")] - public bool InfiniteInvasion; - - /// Sets the PvP mode. Valid types are: "normal", "always", "disabled". - [Description("Sets the PvP mode. Valid types are: \"normal\", \"always\" and \"disabled\".")] - public string PvPMode = "normal"; - - /// Prevents tiles from being placed within SpawnProtectionRadius of the default spawn. - [Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")] - public bool SpawnProtection = true; - - /// The tile radius around the spawn tile that is protected by the SpawnProtection setting. - [Description("The tile radius around the spawn tile that is protected by the SpawnProtection setting.")] - public int SpawnProtectionRadius = 10; - /// Maximum number of clients connected at once. If lower than Terraria's setting, the server will kick excess connections. [Description("Maximum number of clients connected at once.\nIf you want people to be kicked with \"Server is full\" set this to how many players you want max and then set Terraria max players to 2 higher.")] public int MaxSlots = 8; - /// Enable or disable anti-cheat range checks based on distance between the player and their block placements. - [Description("Enable or disable anti-cheat range checks based on distance between the player and their block placements.")] - public bool RangeChecks = true; + /// The number of reserved slots past your max server slots that can be joined by reserved players. + [Description("The number of reserved slots past your max server slots that can be joined by reserved players.")] + public int ReservedSlots = 20; - /// Disables any placing, or removal of blocks. - [Description("Disables any placing, or removal of blocks.")] - public bool DisableBuild; + /// Replaces the world name during a session if UseServerName is true. + [Description("Replaces the world name during a session if UseServerName is true.")] + public string ServerName = ""; + + /// Whether or not to use ServerName in place of the world name. + [Description("Whether or not to use ServerName in place of the world name.")] + public bool UseServerName = false; + + /// The server password required to join the server. + [Description("The server password required to join the server.")] + public string ServerPassword = ""; + + /// Prevents users from being able to login before they finish connecting. + [Description("Prevents users from being able to login before they finish connecting.")] + public bool DisableLoginBeforeJoin; + + /// The path to the directory where logs should be written to. + [Description("The path to the directory where logs should be written to.")] + public string LogPath = "tshock"; + + /// Whether or not the server should output debug level messages related to system operation. + [Description("Whether or not the server should output debug level messages related to system operation.")] + public bool DebugLogs = true; + + + // Chat + + /// Disables sending logs as messages to players with the log permission. + [Description("Disables sending logs as messages to players with the log permission.")] + public bool DisableSpewLogs = true; + + /// Prevents OnSecondUpdate checks from writing to the log file. + [Description("Prevents OnSecondUpdate checks from writing to the log file.")] + public bool DisableSecondUpdateLogs = false; /// The chat color for the superadmin group. [Description("The chat color for the superadmin group.\n#.#.# = Red/Blue/Green\nMax value: 255")] @@ -90,6 +92,55 @@ namespace TShockAPI [Description("The superadmin chat suffix.")] public string SuperAdminChatSuffix = ""; + /// Whether or not to announce a player's geographic location on join, based on their IP. + [Description("Whether or not to announce a player's geographic location on join, based on their IP.")] + public bool EnableGeoIP; + + /// Displays a player's IP on join to users with the log permission. + [Description("Displays a player's IP on join to users with the log permission.")] + public bool DisplayIPToAdmins; + + /// Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message. + [Description("Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message.")] + public string ChatFormat = "{1}{2}{3}: {4}"; + + /// Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message. + [Description("Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message.")] + public string ChatAboveHeadsFormat = "{2}"; + + /// Whether or not to display chat messages above players' heads. + [Description("Whether or not to display chat messages above players' heads.")] + public bool EnableChatAboveHeads = false; + + /// The RGB values used for the color of broadcast messages. + [Description("The RGB values used for the color of broadcast messages.\n#.#.# = Red/Blue/Green\nMax value: 255")] + public int[] BroadcastRGB = { 127, 255, 212 }; + + /// Specifies which string starts a command. + /// Note: Will not function properly if the string length is bigger than 1. + [Description("Specifies which string starts a command.\nNote: Will not function properly if the string length is bigger than 1.")] + public string CommandSpecifier = "/"; + + /// Specifies which string starts a command silently. + /// Note: Will not function properly if the string length is bigger than 1. + [Description("Specifies which string starts a command silently.\nNote: Will not function properly if the string length is bigger than 1.")] + public string CommandSilentSpecifier = "."; + + + // Backup and Save + + /// Enable or disable Terraria's built-in world auto save. + [Description("Enable or disable Terraria's built-in world auto save.")] + public bool AutoSave = true; + + /// Enable or disable world save announcements. + [Description("Enable or disable world save announcements.")] + public bool AnnounceSave = true; + + /// Whether or not to show backup auto save messages. + [Description("Whether or not to show backup auto save messages.")] + public bool ShowBackupAutosaveMessages = true; + /// The interval between backups, in minutes. Backups are stored in the tshock/backups folder. [Description("The interval between backups, in minutes. Backups are stored in the tshock/backups folder.")] public int BackupInterval; @@ -98,43 +149,16 @@ namespace TShockAPI [Description("For how long backups are kept in minutes.\neg. 2880 = 2 days.")] public int BackupKeepFor = 60; - /// Remembers where a player left off, based on their IP. Does not persist through server restarts. - [Description("Remembers where a player left off, based on their IP. Does not persist through server restarts.\neg. When you try to disconnect, and reconnect to be automatically placed at spawn, you'll be at your last location.")] - public bool RememberLeavePos; + /// Whether or not to save the world if the server crashes from an unhandled exception. + [Description("Whether or not to save the world if the server crashes from an unhandled exception.")] + public bool SaveWorldOnCrash = true; - /// Prevents non-hardcore players from connecting. - [Description("Prevents non-hardcore players from connecting.")] - public bool HardcoreOnly; + /// Whether or not to save the world when the last player disconnects. + [Description("Whether or not to save the world when the last player disconnects.")] + public bool SaveWorldOnLastPlayerExit = true; - /// Prevents softcore players from connecting. - [Description("Prevents softcore players from connecting.")] - public bool MediumcoreOnly; - /// Whether or not to kick mediumcore players on death. - [Description("Whether or not to kick mediumcore players on death.")] - public bool KickOnMediumcoreDeath; - - /// Whether or not to ban mediumcore players on death. - [Description("Whether or not to ban mediumcore players on death.")] - public bool BanOnMediumcoreDeath; - - /// Enable or disable Terraria's built-in world auto save. - [Description("Enable or disable Terraria's built-in world auto save.")] - public bool AutoSave = true; - /// Enable or disable world save announcements. - [Description("Enable or disable world save announcements.")] - public bool AnnounceSave = true; - - /// Number of failed login attempts before kicking the player. - [Description("Number of failed login attempts before kicking the player.")] - public int MaximumLoginAttempts = 3; - - /// Replaces the world name during a session if UseServerName is true. - [Description("Replaces the world name during a session if UseServerName is true.")] - public string ServerName = ""; - /// Whether or not to use ServerName in place of the world name. - [Description("Whether or not to use ServerName in place of the world name.")] - public bool UseServerName = false; + // MySQL /// The type of database to use when storing data (either "sqlite" or "mysql"). [Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")] @@ -147,23 +171,121 @@ namespace TShockAPI /// The MySQL hostname and port to direct connections to. [Description("The MySQL hostname and port to direct connections to.")] public string MySqlHost = "localhost:3306"; + /// The database name to connect to when using MySQL as the database type. [Description("The database name to connect to when using MySQL as the database type.")] public string MySqlDbName = ""; + /// The username used when connecting to a MySQL database. [Description("The username used when connecting to a MySQL database.")] public string MySqlUsername = ""; + /// The password used when connecting to a MySQL database. [Description("The password used when connecting to a MySQL database.")] public string MySqlPassword = ""; + /// Whether or not to save logs to the SQL database instead of a text file. + [Description("Whether or not to save logs to the SQL database instead of a text file.\nDefault = false.")] + public bool UseSqlLogs = false; + + /// Number of times the SQL log must fail to insert logs before falling back to the text log. + [Description("Number of times the SQL log must fail to insert logs before falling back to the text log.")] + public int RevertToTextLogsOnSqlFailures = 10; + + + // REST API + + /// Whether or not to require token authentication to use the public REST API endpoints. + [Description("Whether or not to require token authentication to use the public REST API endpoints.")] + public bool EnableTokenEndpointAuthentication; + + /// Enable or disable the REST API. + [Description("Enable or disable the REST API.")] + public bool RestApiEnabled; + + /// The port used by the REST API. + [Description("The port used by the REST API.")] + public int RestApiPort = 7878; + + /// Whether or not to log REST API connections. + [Description("Whether or not to log REST API connections.")] + public bool LogRest = false; + + /// The maximum REST requests in the bucket before denying requests. Minimum value is 5. + [Description("The maximum REST requests in the bucket before denying requests. Minimum value is 5.")] + public int RESTMaximumRequestsPerInterval = 5; + + /// How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute. + [Description("How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute.")] + public int RESTRequestBucketDecreaseIntervalMinutes = 1; + + /// A dictionary of REST tokens that external applications may use to make queries to your server. + [Description("A dictionary of REST tokens that external applications may use to make queries to your server.")] + public Dictionary ApplicationRestTokens = new Dictionary(); + + // Login and Ban + + /// Number of failed login attempts before kicking the player. + [Description("Number of failed login attempts before kicking the player.")] + public int MaximumLoginAttempts = 3; + + /// Whether or not to kick mediumcore players on death. + [Description("Whether or not to kick mediumcore players on death.")] + public bool KickOnMediumcoreDeath; + + /// Whether or not to ban mediumcore players on death. + [Description("Whether or not to ban mediumcore players on death.")] + public bool BanOnMediumcoreDeath; + + /// Remembers where a player left off, based on their IP. Does not persist through server restarts. + [Description("Remembers where a player left off, based on their IP. Does not persist through server restarts.\neg. When you try to disconnect, and reconnect to be automatically placed at spawn, you'll be at your last location.")] + public bool RememberLeavePos; + + /// Enable or disable the whitelist based on IP addresses in the whitelist.txt file. + [Description("Enable or disable the whitelist based on IP addresses in the whitelist.txt file.")] + public bool EnableWhitelist; + + /// The hash algorithm used to encrypt user passwords. + /// Valid types: "sha512", "sha256" and "md5". Append with "-xp" for the xp supported algorithms. + [Description("The hash algorithm used to encrypt user passwords. Valid types: \"sha512\", \"sha256\" and \"md5\". Append with \"-xp\" for the xp supported algorithms.")] + public string HashAlgorithm = "sha512"; + + /// The reason given when kicking players that attempt to join while the server is full. + [Description("The reason given when kicking players that attempt to join while the server is full.")] + public string ServerFullReason = "Server is full"; + + /// The reason given when kicking players for not being on the whitelist. + [Description("The reason given when kicking players for not being on the whitelist.")] + public string WhitelistKickReason = "You are not on the whitelist."; + + /// The reason given when kicking players that attempt to join while the server is full with no reserved slots available. + [Description("The reason given when kicking players that attempt to join while the server is full with no reserved slots available.")] + public string ServerFullNoReservedReason = "Server is full. No reserved slots open."; + /// The reason given if banning a mediumcore player on death. [Description("The reason given if banning a mediumcore player on death.")] public string MediumcoreBanReason = "Death results in a ban"; + /// The reason given if kicking a mediumcore players on death. [Description("The reason given if kicking a mediumcore players on death.")] public string MediumcoreKickReason = "Death results in a kick"; + /// Whether or not to kick hardcore players on death. + [Description("Whether or not to kick hardcore players on death.")] + public bool KickOnHardcoreDeath; + + /// Whether or not to ban hardcore players on death. + [Description("Whether or not to ban hardcore players on death.")] + public bool BanOnHardcoreDeath; + + /// The reason given when banning hardcore players on death. + [Description("The reason given when banning hardcore players on death.")] + public string HardcoreBanReason = "Death results in a ban"; + + /// The reason given when kicking hardcore players on death. + [Description("The reason given when kicking hardcore players on death.")] + public string HardcoreKickReason = "Death results in a kick"; + /// Enables kicking banned users by matching their IP Address. [Description("Enables kicking banned users by matching their IP Address.")] public bool EnableIPBans = true; @@ -184,63 +306,85 @@ namespace TShockAPI [Description("The default group name to place unregistered players under.")] public string DefaultGuestGroupName = "guest"; - /// Disables sending logs as messages to players with the log permission. - [Description("Disables sending logs as messages to players with the log permission.")] - public bool DisableSpewLogs = true; - - /// Prevents OnSecondUpdate checks from writing to the log file. - [Description("Prevents OnSecondUpdate checks from writing to the log file.")] - public bool DisableSecondUpdateLogs = false; - - /// The hash algorithm used to encrypt user passwords. - /// Valid types: "sha512", "sha256" and "md5". Append with "-xp" for the xp supported algorithms. - [Description("The hash algorithm used to encrypt user passwords. Valid types: \"sha512\", \"sha256\" and \"md5\". Append with \"-xp\" for the xp supported algorithms.")] - public string HashAlgorithm = "sha512"; - - /// The reason given when kicking players that attempt to join while the server is full. - [Description("The reason given when kicking players that attempt to join while the server is full.")] - public string ServerFullReason = "Server is full"; - - /// The reason given when kicking players for not being on the whitelist. - [Description("The reason given when kicking players for not being on the whitelist.")] - public string WhitelistKickReason = "You are not on the whitelist."; - - /// The reason given when kicking players that attempt to join while the server is full with no reserved slots available. - [Description("The reason given when kicking players that attempt to join while the server is full with no reserved slots available.")] - public string ServerFullNoReservedReason = "Server is full. No reserved slots open."; - - /// Whether or not to save the world if the server crashes from an unhandled exception. - [Description("Whether or not to save the world if the server crashes from an unhandled exception.")] - public bool SaveWorldOnCrash = true; - - /// Whether or not to announce a player's geographic location on join, based on their IP. - [Description("Whether or not to announce a player's geographic location on join, based on their IP.")] - public bool EnableGeoIP; - - /// Whether or not to require token authentication to use the public REST API endpoints. - [Description("Whether or not to require token authentication to use the public REST API endpoints.")] - public bool EnableTokenEndpointAuthentication; - - /// Enable or disable the REST API. - [Description("Enable or disable the REST API.")] - public bool RestApiEnabled; - - /// The port used by the REST API. - [Description("The port used by the REST API.")] - public int RestApiPort = 7878; - - /// Disables tombstone dropping during death for all players. - [Description("Disables tombstone dropping during death for all players.")] - public bool DisableTombstones = true; - - /// Displays a player's IP on join to users with the log permission. - [Description("Displays a player's IP on join to users with the log permission.")] - public bool DisplayIPToAdmins; - /// If GeoIP is enabled, this will kick users identified as being under a proxy. [Description("If GeoIP is enabled, this will kick users identified as being under a proxy.")] public bool KickProxyUsers = true; + /// Require all players to register or login before being allowed to play. + [Description("Require all players to register or login before being allowed to play.")] + public bool RequireLogin; + + /// Allows users to register a username that doesn't necessarily match their character name. + [Description("Allows users to register a username that doesn't necessarily match their character name.")] + public bool AllowRegisterAnyUsername; + + /// Allows users to login to any account even if the username doesn't match their character name. + [Description("Allows users to login to any account even if the username doesn't match their character name.")] + public bool AllowLoginAnyUsername = true; + + /// Determines the BCrypt work factor to use. If increased, all passwords will be upgraded to new work-factor on verify. + /// The number of computational rounds is 2^n. Increase with caution. Range: 5-31. + [Description("Determines the BCrypt work factor to use. If increased, all passwords will be upgraded to new work-factor on verify. The number of computational rounds is 2^n. Increase with caution. Range: 5-31.")] + public int BCryptWorkFactor = 7; + + /// The minimum password length for new user accounts. Can never be lower than 4. + [Description("The minimum password length for new user accounts. Can never be lower than 4.")] + public int MinimumPasswordLength = 4; + + /// Prevents users from being able to login with their client UUID. + [Description("Prevents users from being able to login with their client UUID.")] + public bool DisableUUIDLogin; + + /// Kick clients that don't send their UUID to the server. + [Description("Kick clients that don't send their UUID to the server.")] + public bool KickEmptyUUID; + + // World + + /// Determines the size of invasion events. The equation for calculating invasion size = 100 + (multiplier * (number of active players > 200 hp)). + [Description("Determines the size of invasion events.\nThe equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health)).")] + public int InvasionMultiplier = 1; + + /// The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave. + [Description("The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave.")] + public int DefaultMaximumSpawns = 5; + + /// The delay between waves. Lower values lead to more mobs. + [Description("The delay between waves. Lower values lead to more mobs.")] + public int DefaultSpawnRate = 600; + + /// Enables never-ending invasion events. You still need to start the event. + [Description("Enables never ending invasion events. You still need to start the event, such as with the /invade command.")] + public bool InfiniteInvasion; + + /// Sets the PvP mode. Valid types are: "normal", "always", "disabled". + [Description("Sets the PvP mode. Valid types are: \"normal\", \"always\" and \"disabled\".")] + public string PvPMode = "normal"; + + /// Prevents tiles from being placed within SpawnProtectionRadius of the default spawn. + [Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")] + public bool SpawnProtection = true; + + /// The tile radius around the spawn tile that is protected by the SpawnProtection setting. + [Description("The tile radius around the spawn tile that is protected by the SpawnProtection setting.")] + public int SpawnProtectionRadius = 10; + + /// Enable or disable anti-cheat range checks based on distance between the player and their block placements. + [Description("Enable or disable anti-cheat range checks based on distance between the player and their block placements.")] + public bool RangeChecks = true; + + /// Disables any placing, or removal of blocks. + [Description("Disables any placing, or removal of blocks.")] + public bool DisableBuild; + + /// Prevents non-hardcore players from connecting. + [Description("Prevents non-hardcore players from connecting.")] + public bool HardcoreOnly; + + /// Prevents softcore players from connecting. + [Description("Prevents softcore players from connecting.")] + public bool MediumcoreOnly; + /// If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command. [Description("If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command.")] public bool DisableHardmode; @@ -257,13 +401,9 @@ namespace TShockAPI [Description("Disables snow ball projectiles from spawning.")] public bool DisableSnowBalls; - /// Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message. - [Description("Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message.")] - public string ChatFormat = "{1}{2}{3}: {4}"; - - /// Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message. - [Description("Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message.")] - public string ChatAboveHeadsFormat = "{2}"; + /// Disables tombstone dropping during death for all players. + [Description("Disables tombstone dropping during death for all players.")] + public bool DisableTombstones = true; /// Forces the world time to be normal, day, or night. [Description("Forces the world time to be normal, day, or night.")] @@ -272,51 +412,27 @@ namespace TShockAPI /// Disables a player and reverts their actions if this number of tile kills is exceeded within 1 second. [Description("Disables a player and reverts their actions if this number of tile kills is exceeded within 1 second.")] public int TileKillThreshold = 60; - - /// Whether or not to kick users when they surpass the TileKill threshold. - [Description("Whether or not to kick users when they surpass the TileKill threshold.")] - public bool KickOnTileKillThresholdBroken = false; /// Disables a player and reverts their actions if this number of tile places is exceeded within 1 second. [Description("Disables a player and reverts their actions if this number of tile places is exceeded within 1 second.")] public int TilePlaceThreshold = 32; - - /// Whether or not to kick users when they surpass the TilePlace threshold. - [Description("Whether or not to kick users when they surpass the TilePlace threshold.")] - public bool KickOnTilePlaceThresholdBroken = false; /// Disables a player if this number of liquid sets is exceeded within 1 second. [Description("Disables a player if this number of liquid sets is exceeded within 1 second.")] public int TileLiquidThreshold = 50; - - /// Whether or not to kick users when they surpass the TileLiquid threshold. - [Description("Whether or not to kick users when they surpass the TileLiquid threshold.")] - public bool KickOnTileLiquidThresholdBroken = false; /// Disable a player if this number of projectiles is created within 1 second. [Description("Disable a player if this number of projectiles is created within 1 second.")] public int ProjectileThreshold = 50; - - /// Whether or not to kick users when they surpass the Projectile threshold. - [Description("Whether or not to kick users when they surpass the Projectile threshold.")] - public bool KickOnProjectileThresholdBroken = false; /// Disables a player if this number of HealOtherPlayer packets is sent within 1 second. [Description("Disables a player if this number of HealOtherPlayer packets is sent within 1 second.")] public int HealOtherThreshold = 50; - - /// Whether or not to kick users when they surpass the HealOther threshold. - [Description("Whether or not to kick users when they surpass the HealOther threshold.")] - public bool KickOnHealOtherThresholdBroken = false; /// Whether or not to ignore shrapnel from crystal bullets for the projectile threshold count. [Description("Whether or not to ignore shrapnel from crystal bullets for the projectile threshold count.")] public bool ProjIgnoreShrapnel = true; - /// Require all players to register or login before being allowed to play. - [Description("Require all players to register or login before being allowed to play.")] - public bool RequireLogin; - /// Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients. [Description("Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients.")] public bool DisableInvisPvP; @@ -325,10 +441,6 @@ namespace TShockAPI [Description("The maximum distance, in tiles, that disabled players can move from.")] public int MaxRangeForDisabled = 10; - /// The server password required to join the server. - [Description("The server password required to join the server.")] - public string ServerPassword = ""; - /// Whether or not region protection should apply to chests. [Description("Whether or not region protection should apply to chests.")] public bool RegionProtectChests; @@ -337,26 +449,6 @@ namespace TShockAPI [Description("Whether or not region protection should apply to gem locks.")] public bool RegionProtectGemLocks = true; - /// Prevents users from being able to login before they finish connecting. - [Description("Prevents users from being able to login before they finish connecting.")] - public bool DisableLoginBeforeJoin; - - /// Prevents users from being able to login with their client UUID. - [Description("Prevents users from being able to login with their client UUID.")] - public bool DisableUUIDLogin; - - /// Kick clients that don't send their UUID to the server. - [Description("Kick clients that don't send their UUID to the server.")] - public bool KickEmptyUUID; - - /// Allows users to register a username that doesn't necessarily match their character name. - [Description("Allows users to register a username that doesn't necessarily match their character name.")] - public bool AllowRegisterAnyUsername; - - /// Allows users to login to any account even if the username doesn't match their character name. - [Description("Allows users to login to any account even if the username doesn't match their character name.")] - public bool AllowLoginAnyUsername = true; - /// The maximum damage a player/NPC can inflict. [Description("The maximum damage a player/NPC can inflict.")] public int MaxDamage = 1175; @@ -413,10 +505,6 @@ namespace TShockAPI [Description("Prevent players from interacting with the world while they are dead.")] public bool PreventDeadModification = true; - /// Whether or not to display chat messages above players' heads. - [Description("Whether or not to display chat messages above players' heads.")] - public bool EnableChatAboveHeads = false; - /// Forces Christmas-only events to occur all year. [Description("Forces Christmas-only events to occur all year.")] public bool ForceXmas = false; @@ -429,38 +517,6 @@ namespace TShockAPI [Description("Allows stacks in chests to go beyond the stack limit during world loading.")] public bool IgnoreChestStacksOnLoad = false; - /// The path to the directory where logs should be written to. - [Description("The path to the directory where logs should be written to.")] - public string LogPath = "tshock"; - - /// Whether or not to save logs to the SQL database instead of a text file. - [Description("Whether or not to save logs to the SQL database instead of a text file.\nDefault = false.")] - public bool UseSqlLogs = false; - - /// Number of times the SQL log must fail to insert logs before falling back to the text log. - [Description("Number of times the SQL log must fail to insert logs before falling back to the text log.")] - public int RevertToTextLogsOnSqlFailures = 10; - - /// Prevents players from placing tiles with an invalid style. - [Description("Prevents players from placing tiles with an invalid style.")] - public bool PreventInvalidPlaceStyle = true; - - /// The RGB values used for the color of broadcast messages. - [Description("The RGB values used for the color of broadcast messages.\n#.#.# = Red/Blue/Green\nMax value: 255")] - public int[] BroadcastRGB = { 127, 255, 212 }; - - /// A dictionary of REST tokens that external applications may use to make queries to your server. - [Description("A dictionary of REST tokens that external applications may use to make queries to your server.")] - public Dictionary ApplicationRestTokens = new Dictionary(); - - /// The number of reserved slots past your max server slots that can be joined by reserved players. - [Description("The number of reserved slots past your max server slots that can be joined by reserved players.")] - public int ReservedSlots = 20; - - /// Whether or not to log REST API connections. - [Description("Whether or not to log REST API connections.")] - public bool LogRest = false; - /// The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk. [Description("The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk.")] public int RespawnSeconds = 5; @@ -472,10 +528,6 @@ namespace TShockAPI /// Disables a player if this number of tiles is painted within 1 second. [Description("Disables a player if this number of tiles is painted within 1 second.")] public int TilePaintThreshold = 15; - - /// Whether or not to kick users when they surpass the TilePaint threshold. - [Description("Whether or not to kick users when they surpass the TilePaint threshold.")] - public bool KickOnTilePaintThresholdBroken = false; /// Forces Halloween-only events to occur all year. [Description("Forces Halloween-only events to occur all year.")] @@ -485,32 +537,6 @@ namespace TShockAPI [Description("Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build.")] public bool AllowCutTilesAndBreakables = false; - /// Specifies which string starts a command. - /// Note: Will not function properly if the string length is bigger than 1. - [Description("Specifies which string starts a command.\nNote: Will not function properly if the string length is bigger than 1.")] - public string CommandSpecifier = "/"; - - /// Specifies which string starts a command silently. - /// Note: Will not function properly if the string length is bigger than 1. - [Description("Specifies which string starts a command silently.\nNote: Will not function properly if the string length is bigger than 1.")] - public string CommandSilentSpecifier = "."; - - /// Whether or not to kick hardcore players on death. - [Description("Whether or not to kick hardcore players on death.")] - public bool KickOnHardcoreDeath; - - /// Whether or not to ban hardcore players on death. - [Description("Whether or not to ban hardcore players on death.")] - public bool BanOnHardcoreDeath; - - /// The reason given when banning hardcore players on death. - [Description("The reason given when banning hardcore players on death.")] - public string HardcoreBanReason = "Death results in a ban"; - - /// The reason given when kicking hardcore players on death. - [Description("The reason given when kicking hardcore players on death.")] - public string HardcoreKickReason = "Death results in a kick"; - /// Whether or not to announce boss spawning or invasion starts. [Description("Whether or not to announce boss spawning or invasion starts.")] public bool AnonymousBossInvasions = true; @@ -523,37 +549,15 @@ namespace TShockAPI [Description("The maximum MP a player can have, before equipment buffs.")] public int MaxMP = 200; - /// Whether or not to save the world when the last player disconnects. - [Description("Whether or not to save the world when the last player disconnects.")] - public bool SaveWorldOnLastPlayerExit = true; - - /// Determines the BCrypt work factor to use. If increased, all passwords will be upgraded to new work-factor on verify. - /// The number of computational rounds is 2^n. Increase with caution. Range: 5-31. - [Description("Determines the BCrypt work factor to use. If increased, all passwords will be upgraded to new work-factor on verify. The number of computational rounds is 2^n. Increase with caution. Range: 5-31.")] - public int BCryptWorkFactor = 7; - - /// The minimum password length for new user accounts. Can never be lower than 4. - [Description("The minimum password length for new user accounts. Can never be lower than 4.")] - public int MinimumPasswordLength = 4; - - /// The maximum REST requests in the bucket before denying requests. Minimum value is 5. - [Description("The maximum REST requests in the bucket before denying requests. Minimum value is 5.")] - public int RESTMaximumRequestsPerInterval = 5; - - /// How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute. - [Description("How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute.")] - public int RESTRequestBucketDecreaseIntervalMinutes = 1; - - /// Whether or not to show backup auto save messages. - [Description("Whether or not to show backup auto save messages.")] - public bool ShowBackupAutosaveMessages = true; - - [Description("Whether or not the server should output debug level messages related to system operation.")] - public bool DebugLogs = true; - + /// Determines the range in tiles that a bomb can affect tiles from detonation point. [Description("Determines the range in tiles that a bomb can affect tiles from detonation point.")] public int BombExplosionRadius = 5; + /// Prevents players from placing tiles with an invalid style. + [Description("Prevents players from placing tiles with an invalid style.")] + public bool PreventInvalidPlaceStyle = true; + + /// /// Reads a configuration file from a given path /// From fda0ae720b44e3322396b7fb1e6e18ec2319a36e Mon Sep 17 00:00:00 2001 From: KZ Date: Sun, 7 Jun 2020 13:58:57 -0700 Subject: [PATCH 2/7] reorganizing within categories --- TShockAPI/ConfigFile.cs | 348 +++++++++++++++++++++------------------- 1 file changed, 187 insertions(+), 161 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 501a5e56..d77a1253 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -33,6 +33,10 @@ namespace TShockAPI // Server + /// The server password required to join the server. + [Description("The server password required to join the server.")] + public string ServerPassword = ""; + /// The port the server runs on. [Description("The port the server runs on.")] public int ServerPort = 7777; @@ -51,15 +55,7 @@ namespace TShockAPI /// Whether or not to use ServerName in place of the world name. [Description("Whether or not to use ServerName in place of the world name.")] - public bool UseServerName = false; - - /// The server password required to join the server. - [Description("The server password required to join the server.")] - public string ServerPassword = ""; - - /// Prevents users from being able to login before they finish connecting. - [Description("Prevents users from being able to login before they finish connecting.")] - public bool DisableLoginBeforeJoin; + public bool UseServerName = false; /// The path to the directory where logs should be written to. [Description("The path to the directory where logs should be written to.")] @@ -69,9 +65,58 @@ namespace TShockAPI [Description("Whether or not the server should output debug level messages related to system operation.")] public bool DebugLogs = true; + /// Prevents users from being able to login before they finish connecting. + [Description("Prevents users from being able to login before they finish connecting.")] + public bool DisableLoginBeforeJoin; + + /// Allows stacks in chests to go beyond the stack limit during world loading. + [Description("Allows stacks in chests to go beyond the stack limit during world loading.")] + public bool IgnoreChestStacksOnLoad = false; + + + // Backup and Save + + /// Enable or disable Terraria's built-in world auto save. + [Description("Enable or disable Terraria's built-in world auto save.")] + public bool AutoSave = true; + + /// Enable or disable world save announcements. + [Description("Enable or disable world save announcements.")] + public bool AnnounceSave = true; + + /// Whether or not to show backup auto save messages. + [Description("Whether or not to show backup auto save messages.")] + public bool ShowBackupAutosaveMessages = true; + + /// The interval between backups, in minutes. Backups are stored in the tshock/backups folder. + [Description("The interval between backups, in minutes. Backups are stored in the tshock/backups folder.")] + public int BackupInterval; + + /// For how long backups are kept in minutes. + [Description("For how long backups are kept in minutes.\neg. 2880 = 2 days.")] + public int BackupKeepFor = 60; + + /// Whether or not to save the world if the server crashes from an unhandled exception. + [Description("Whether or not to save the world if the server crashes from an unhandled exception.")] + public bool SaveWorldOnCrash = true; + + /// Whether or not to save the world when the last player disconnects. + [Description("Whether or not to save the world when the last player disconnects.")] + public bool SaveWorldOnLastPlayerExit = true; + // Chat + /// Specifies which string starts a command. + /// Note: Will not function properly if the string length is bigger than 1. + [Description("Specifies which string starts a command.\nNote: Will not function properly if the string length is bigger than 1.")] + public string CommandSpecifier = "/"; + + /// Specifies which string starts a command silently. + /// Note: Will not function properly if the string length is bigger than 1. + [Description("Specifies which string starts a command silently.\nNote: Will not function properly if the string length is bigger than 1.")] + public string CommandSilentSpecifier = "."; + /// Disables sending logs as messages to players with the log permission. [Description("Disables sending logs as messages to players with the log permission.")] public bool DisableSpewLogs = true; @@ -116,47 +161,6 @@ namespace TShockAPI [Description("The RGB values used for the color of broadcast messages.\n#.#.# = Red/Blue/Green\nMax value: 255")] public int[] BroadcastRGB = { 127, 255, 212 }; - /// Specifies which string starts a command. - /// Note: Will not function properly if the string length is bigger than 1. - [Description("Specifies which string starts a command.\nNote: Will not function properly if the string length is bigger than 1.")] - public string CommandSpecifier = "/"; - - /// Specifies which string starts a command silently. - /// Note: Will not function properly if the string length is bigger than 1. - [Description("Specifies which string starts a command silently.\nNote: Will not function properly if the string length is bigger than 1.")] - public string CommandSilentSpecifier = "."; - - - // Backup and Save - - /// Enable or disable Terraria's built-in world auto save. - [Description("Enable or disable Terraria's built-in world auto save.")] - public bool AutoSave = true; - - /// Enable or disable world save announcements. - [Description("Enable or disable world save announcements.")] - public bool AnnounceSave = true; - - /// Whether or not to show backup auto save messages. - [Description("Whether or not to show backup auto save messages.")] - public bool ShowBackupAutosaveMessages = true; - - /// The interval between backups, in minutes. Backups are stored in the tshock/backups folder. - [Description("The interval between backups, in minutes. Backups are stored in the tshock/backups folder.")] - public int BackupInterval; - - /// For how long backups are kept in minutes. - [Description("For how long backups are kept in minutes.\neg. 2880 = 2 days.")] - public int BackupKeepFor = 60; - - /// Whether or not to save the world if the server crashes from an unhandled exception. - [Description("Whether or not to save the world if the server crashes from an unhandled exception.")] - public bool SaveWorldOnCrash = true; - - /// Whether or not to save the world when the last player disconnects. - [Description("Whether or not to save the world when the last player disconnects.")] - public bool SaveWorldOnLastPlayerExit = true; - // MySQL @@ -195,10 +199,6 @@ namespace TShockAPI // REST API - /// Whether or not to require token authentication to use the public REST API endpoints. - [Description("Whether or not to require token authentication to use the public REST API endpoints.")] - public bool EnableTokenEndpointAuthentication; - /// Enable or disable the REST API. [Description("Enable or disable the REST API.")] public bool RestApiEnabled; @@ -211,6 +211,10 @@ namespace TShockAPI [Description("Whether or not to log REST API connections.")] public bool LogRest = false; + /// Whether or not to require token authentication to use the public REST API endpoints. + [Description("Whether or not to require token authentication to use the public REST API endpoints.")] + public bool EnableTokenEndpointAuthentication; + /// The maximum REST requests in the bucket before denying requests. Minimum value is 5. [Description("The maximum REST requests in the bucket before denying requests. Minimum value is 5.")] public int RESTMaximumRequestsPerInterval = 5; @@ -223,8 +227,21 @@ namespace TShockAPI [Description("A dictionary of REST tokens that external applications may use to make queries to your server.")] public Dictionary ApplicationRestTokens = new Dictionary(); + // Login and Ban + /// The default group name to place newly registered users under. + [Description("The default group name to place newly registered users under.")] + public string DefaultRegistrationGroupName = "default"; + + /// The default group name to place unregistered players under. + [Description("The default group name to place unregistered players under.")] + public string DefaultGuestGroupName = "guest"; + + /// Remembers where a player left off, based on their IP. Does not persist through server restarts. + [Description("Remembers where a player left off, based on their IP. Does not persist through server restarts.\neg. When you try to disconnect, and reconnect to be automatically placed at spawn, you'll be at your last location.")] + public bool RememberLeavePos; + /// Number of failed login attempts before kicking the player. [Description("Number of failed login attempts before kicking the player.")] public int MaximumLoginAttempts = 3; @@ -233,47 +250,42 @@ namespace TShockAPI [Description("Whether or not to kick mediumcore players on death.")] public bool KickOnMediumcoreDeath; + /// The reason given if kicking a mediumcore players on death. + [Description("The reason given if kicking a mediumcore players on death.")] + public string MediumcoreKickReason = "Death results in a kick"; + /// Whether or not to ban mediumcore players on death. [Description("Whether or not to ban mediumcore players on death.")] public bool BanOnMediumcoreDeath; - /// Remembers where a player left off, based on their IP. Does not persist through server restarts. - [Description("Remembers where a player left off, based on their IP. Does not persist through server restarts.\neg. When you try to disconnect, and reconnect to be automatically placed at spawn, you'll be at your last location.")] - public bool RememberLeavePos; - - /// Enable or disable the whitelist based on IP addresses in the whitelist.txt file. - [Description("Enable or disable the whitelist based on IP addresses in the whitelist.txt file.")] - public bool EnableWhitelist; - - /// The hash algorithm used to encrypt user passwords. - /// Valid types: "sha512", "sha256" and "md5". Append with "-xp" for the xp supported algorithms. - [Description("The hash algorithm used to encrypt user passwords. Valid types: \"sha512\", \"sha256\" and \"md5\". Append with \"-xp\" for the xp supported algorithms.")] - public string HashAlgorithm = "sha512"; - - /// The reason given when kicking players that attempt to join while the server is full. - [Description("The reason given when kicking players that attempt to join while the server is full.")] - public string ServerFullReason = "Server is full"; - - /// The reason given when kicking players for not being on the whitelist. - [Description("The reason given when kicking players for not being on the whitelist.")] - public string WhitelistKickReason = "You are not on the whitelist."; - - /// The reason given when kicking players that attempt to join while the server is full with no reserved slots available. - [Description("The reason given when kicking players that attempt to join while the server is full with no reserved slots available.")] - public string ServerFullNoReservedReason = "Server is full. No reserved slots open."; - /// The reason given if banning a mediumcore player on death. [Description("The reason given if banning a mediumcore player on death.")] public string MediumcoreBanReason = "Death results in a ban"; - /// The reason given if kicking a mediumcore players on death. - [Description("The reason given if kicking a mediumcore players on death.")] - public string MediumcoreKickReason = "Death results in a kick"; + /// Enable or disable the whitelist based on IP addresses in the whitelist.txt file. + [Description("Enable or disable the whitelist based on IP addresses in the whitelist.txt file.")] + public bool EnableWhitelist; + + /// The reason given when kicking players for not being on the whitelist. + [Description("The reason given when kicking players for not being on the whitelist.")] + public string WhitelistKickReason = "You are not on the whitelist."; + + /// The reason given when kicking players that attempt to join while the server is full. + [Description("The reason given when kicking players that attempt to join while the server is full.")] + public string ServerFullReason = "Server is full"; + + /// The reason given when kicking players that attempt to join while the server is full with no reserved slots available. + [Description("The reason given when kicking players that attempt to join while the server is full with no reserved slots available.")] + public string ServerFullNoReservedReason = "Server is full. No reserved slots open."; /// Whether or not to kick hardcore players on death. [Description("Whether or not to kick hardcore players on death.")] public bool KickOnHardcoreDeath; + /// The reason given when kicking hardcore players on death. + [Description("The reason given when kicking hardcore players on death.")] + public string HardcoreKickReason = "Death results in a kick"; + /// Whether or not to ban hardcore players on death. [Description("Whether or not to ban hardcore players on death.")] public bool BanOnHardcoreDeath; @@ -282,10 +294,6 @@ namespace TShockAPI [Description("The reason given when banning hardcore players on death.")] public string HardcoreBanReason = "Death results in a ban"; - /// The reason given when kicking hardcore players on death. - [Description("The reason given when kicking hardcore players on death.")] - public string HardcoreKickReason = "Death results in a kick"; - /// Enables kicking banned users by matching their IP Address. [Description("Enables kicking banned users by matching their IP Address.")] public bool EnableIPBans = true; @@ -298,14 +306,6 @@ namespace TShockAPI [Description("Enables kicking banned users by matching their Character Name.")] public bool EnableBanOnUsernames; - /// The default group name to place newly registered users under. - [Description("The default group name to place newly registered users under.")] - public string DefaultRegistrationGroupName = "default"; - - /// The default group name to place unregistered players under. - [Description("The default group name to place unregistered players under.")] - public string DefaultGuestGroupName = "guest"; - /// If GeoIP is enabled, this will kick users identified as being under a proxy. [Description("If GeoIP is enabled, this will kick users identified as being under a proxy.")] public bool KickProxyUsers = true; @@ -314,23 +314,28 @@ namespace TShockAPI [Description("Require all players to register or login before being allowed to play.")] public bool RequireLogin; + /// Allows users to login to any account even if the username doesn't match their character name. + [Description("Allows users to login to any account even if the username doesn't match their character name.")] + public bool AllowLoginAnyUsername = true; + /// Allows users to register a username that doesn't necessarily match their character name. [Description("Allows users to register a username that doesn't necessarily match their character name.")] public bool AllowRegisterAnyUsername; - /// Allows users to login to any account even if the username doesn't match their character name. - [Description("Allows users to login to any account even if the username doesn't match their character name.")] - public bool AllowLoginAnyUsername = true; + /// The minimum password length for new user accounts. Can never be lower than 4. + [Description("The minimum password length for new user accounts. Can never be lower than 4.")] + public int MinimumPasswordLength = 4; + + /// The hash algorithm used to encrypt user passwords. + /// Valid types: "sha512", "sha256" and "md5". Append with "-xp" for the xp supported algorithms. + [Description("The hash algorithm used to encrypt user passwords. Valid types: \"sha512\", \"sha256\" and \"md5\". Append with \"-xp\" for the xp supported algorithms.")] + public string HashAlgorithm = "sha512"; /// Determines the BCrypt work factor to use. If increased, all passwords will be upgraded to new work-factor on verify. /// The number of computational rounds is 2^n. Increase with caution. Range: 5-31. [Description("Determines the BCrypt work factor to use. If increased, all passwords will be upgraded to new work-factor on verify. The number of computational rounds is 2^n. Increase with caution. Range: 5-31.")] public int BCryptWorkFactor = 7; - /// The minimum password length for new user accounts. Can never be lower than 4. - [Description("The minimum password length for new user accounts. Can never be lower than 4.")] - public int MinimumPasswordLength = 4; - /// Prevents users from being able to login with their client UUID. [Description("Prevents users from being able to login with their client UUID.")] public bool DisableUUIDLogin; @@ -339,6 +344,71 @@ namespace TShockAPI [Description("Kick clients that don't send their UUID to the server.")] public bool KickEmptyUUID; + /// Disables a player if this number of tiles is painted within 1 second. + [Description("Disables a player if this number of tiles is painted within 1 second.")] + public int TilePaintThreshold = 15; + + /// Whether or not to kick users when they surpass the TilePaint threshold. + [Description("Whether or not to kick users when they surpass the TilePaint threshold.")] + public bool KickOnTilePaintThresholdBroken = false; + + /// The maximum damage a player/NPC can inflict. + [Description("The maximum damage a player/NPC can inflict.")] + public int MaxDamage = 1175; + + /// The maximum damage a projectile can inflict. + [Description("The maximum damage a projectile can inflict.")] + public int MaxProjDamage = 1175; + + /// Whether or not to kick users when they surpass the MaxDamage threshold. + [Description("Whether or not to kick users when they surpass the MaxDamage threshold.")] + public bool KickOnDamageThresholdBroken = false; + + /// Disables a player and reverts their actions if this number of tile kills is exceeded within 1 second. + [Description("Disables a player and reverts their actions if this number of tile kills is exceeded within 1 second.")] + public int TileKillThreshold = 60; + + /// Whether or not to kick users when they surpass the TileKill threshold. + [Description("Whether or not to kick users when they surpass the TileKill threshold.")] + public bool KickOnTileKillThresholdBroken = false; + + /// Disables a player and reverts their actions if this number of tile places is exceeded within 1 second. + [Description("Disables a player and reverts their actions if this number of tile places is exceeded within 1 second.")] + public int TilePlaceThreshold = 32; + + /// Whether or not to kick users when they surpass the TilePlace threshold. + [Description("Whether or not to kick users when they surpass the TilePlace threshold.")] + public bool KickOnTilePlaceThresholdBroken = false; + + /// Disables a player if this number of liquid sets is exceeded within 1 second. + [Description("Disables a player if this number of liquid sets is exceeded within 1 second.")] + public int TileLiquidThreshold = 50; + + /// Whether or not to kick users when they surpass the TileLiquid threshold. + [Description("Whether or not to kick users when they surpass the TileLiquid threshold.")] + public bool KickOnTileLiquidThresholdBroken = false; + + /// Whether or not to ignore shrapnel from crystal bullets for the projectile threshold count. + [Description("Whether or not to ignore shrapnel from crystal bullets for the projectile threshold count.")] + public bool ProjIgnoreShrapnel = true; + + /// Disable a player if this number of projectiles is created within 1 second. + [Description("Disable a player if this number of projectiles is created within 1 second.")] + public int ProjectileThreshold = 50; + + /// Whether or not to kick users when they surpass the Projectile threshold. + [Description("Whether or not to kick users when they surpass the Projectile threshold.")] + public bool KickOnProjectileThresholdBroken = false; + + /// Disables a player if this number of HealOtherPlayer packets is sent within 1 second. + [Description("Disables a player if this number of HealOtherPlayer packets is sent within 1 second.")] + public int HealOtherThreshold = 50; + + /// Whether or not to kick users when they surpass the HealOther threshold. + [Description("Whether or not to kick users when they surpass the HealOther threshold.")] + public bool KickOnHealOtherThresholdBroken = false; + + // World /// Determines the size of invasion events. The equation for calculating invasion size = 100 + (multiplier * (number of active players > 200 hp)). @@ -373,10 +443,6 @@ namespace TShockAPI [Description("Enable or disable anti-cheat range checks based on distance between the player and their block placements.")] public bool RangeChecks = true; - /// Disables any placing, or removal of blocks. - [Description("Disables any placing, or removal of blocks.")] - public bool DisableBuild; - /// Prevents non-hardcore players from connecting. [Description("Prevents non-hardcore players from connecting.")] public bool HardcoreOnly; @@ -385,6 +451,10 @@ namespace TShockAPI [Description("Prevents softcore players from connecting.")] public bool MediumcoreOnly; + /// Disables any placing, or removal of blocks. + [Description("Disables any placing, or removal of blocks.")] + public bool DisableBuild; + /// If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command. [Description("If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command.")] public bool DisableHardmode; @@ -409,30 +479,6 @@ namespace TShockAPI [Description("Forces the world time to be normal, day, or night.")] public string ForceTime = "normal"; - /// Disables a player and reverts their actions if this number of tile kills is exceeded within 1 second. - [Description("Disables a player and reverts their actions if this number of tile kills is exceeded within 1 second.")] - public int TileKillThreshold = 60; - - /// Disables a player and reverts their actions if this number of tile places is exceeded within 1 second. - [Description("Disables a player and reverts their actions if this number of tile places is exceeded within 1 second.")] - public int TilePlaceThreshold = 32; - - /// Disables a player if this number of liquid sets is exceeded within 1 second. - [Description("Disables a player if this number of liquid sets is exceeded within 1 second.")] - public int TileLiquidThreshold = 50; - - /// Disable a player if this number of projectiles is created within 1 second. - [Description("Disable a player if this number of projectiles is created within 1 second.")] - public int ProjectileThreshold = 50; - - /// Disables a player if this number of HealOtherPlayer packets is sent within 1 second. - [Description("Disables a player if this number of HealOtherPlayer packets is sent within 1 second.")] - public int HealOtherThreshold = 50; - - /// Whether or not to ignore shrapnel from crystal bullets for the projectile threshold count. - [Description("Whether or not to ignore shrapnel from crystal bullets for the projectile threshold count.")] - public bool ProjIgnoreShrapnel = true; - /// Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients. [Description("Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients.")] public bool DisableInvisPvP; @@ -449,18 +495,6 @@ namespace TShockAPI [Description("Whether or not region protection should apply to gem locks.")] public bool RegionProtectGemLocks = true; - /// The maximum damage a player/NPC can inflict. - [Description("The maximum damage a player/NPC can inflict.")] - public int MaxDamage = 1175; - - /// The maximum damage a projectile can inflict. - [Description("The maximum damage a projectile can inflict.")] - public int MaxProjDamage = 1175; - - /// Whether or not to kick users when they surpass the MaxDamage threshold. - [Description("Whether or not to kick users when they surpass the MaxDamage threshold.")] - public bool KickOnDamageThresholdBroken = false; - /// Ignores checks to see if a player 'can' update a projectile. [Description("Ignores checks to see if a player 'can' update a projectile.")] public bool IgnoreProjUpdate = false; @@ -469,6 +503,10 @@ namespace TShockAPI [Description("Ignores checks to see if a player 'can' kill a projectile.")] public bool IgnoreProjKill = false; + /// Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build. + [Description("Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build.")] + public bool AllowCutTilesAndBreakables = false; + /// Allows ice placement even where a user cannot usually build. [Description("Allows ice placement even where a user cannot usually build.")] public bool AllowIce = false; @@ -505,18 +543,22 @@ namespace TShockAPI [Description("Prevent players from interacting with the world while they are dead.")] public bool PreventDeadModification = true; + /// Prevents players from placing tiles with an invalid style. + [Description("Prevents players from placing tiles with an invalid style.")] + public bool PreventInvalidPlaceStyle = true; + /// Forces Christmas-only events to occur all year. [Description("Forces Christmas-only events to occur all year.")] public bool ForceXmas = false; + /// Forces Halloween-only events to occur all year. + [Description("Forces Halloween-only events to occur all year.")] + public bool ForceHalloween = false; + /// Allows groups on the banned item allowed list to spawn banned items even if PreventBannedItemSpawn is set to true. [Description("Allows groups on the banned item allowed list to spawn banned items even if PreventBannedItemSpawn is set to true.")] public bool AllowAllowedGroupsToSpawnBannedItems = false; - /// Allows stacks in chests to go beyond the stack limit during world loading. - [Description("Allows stacks in chests to go beyond the stack limit during world loading.")] - public bool IgnoreChestStacksOnLoad = false; - /// The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk. [Description("The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk.")] public int RespawnSeconds = 5; @@ -525,18 +567,6 @@ namespace TShockAPI [Description("The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk.")] public int RespawnBossSeconds = 10; - /// Disables a player if this number of tiles is painted within 1 second. - [Description("Disables a player if this number of tiles is painted within 1 second.")] - public int TilePaintThreshold = 15; - - /// Forces Halloween-only events to occur all year. - [Description("Forces Halloween-only events to occur all year.")] - public bool ForceHalloween = false; - - /// Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build. - [Description("Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build.")] - public bool AllowCutTilesAndBreakables = false; - /// Whether or not to announce boss spawning or invasion starts. [Description("Whether or not to announce boss spawning or invasion starts.")] public bool AnonymousBossInvasions = true; @@ -553,10 +583,6 @@ namespace TShockAPI [Description("Determines the range in tiles that a bomb can affect tiles from detonation point.")] public int BombExplosionRadius = 5; - /// Prevents players from placing tiles with an invalid style. - [Description("Prevents players from placing tiles with an invalid style.")] - public bool PreventInvalidPlaceStyle = true; - /// /// Reads a configuration file from a given path From aa85a9860c1c1e2acb7a9b738bdc315e7d6a3224 Mon Sep 17 00:00:00 2001 From: KZ Date: Sun, 7 Jun 2020 14:10:16 -0700 Subject: [PATCH 3/7] Reorder sections, format section titles --- TShockAPI/ConfigFile.cs | 503 ++++++++++++++++++++-------------------- 1 file changed, 252 insertions(+), 251 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index d77a1253..27eaa9fc 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -31,7 +31,7 @@ namespace TShockAPI public class ConfigFile { - // Server + /* ~~~~~ Server ~~~~~ */ /// The server password required to join the server. [Description("The server password required to join the server.")] @@ -74,7 +74,7 @@ namespace TShockAPI public bool IgnoreChestStacksOnLoad = false; - // Backup and Save + /* ~~~~~ Backup and Save ~~~~~ */ /// Enable or disable Terraria's built-in world auto save. [Description("Enable or disable Terraria's built-in world auto save.")] @@ -105,130 +105,182 @@ namespace TShockAPI public bool SaveWorldOnLastPlayerExit = true; - // Chat + /* ~~~~~ World ~~~~~ */ - /// Specifies which string starts a command. - /// Note: Will not function properly if the string length is bigger than 1. - [Description("Specifies which string starts a command.\nNote: Will not function properly if the string length is bigger than 1.")] - public string CommandSpecifier = "/"; + /// Determines the size of invasion events. The equation for calculating invasion size = 100 + (multiplier * (number of active players > 200 hp)). + [Description("Determines the size of invasion events.\nThe equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health)).")] + public int InvasionMultiplier = 1; - /// Specifies which string starts a command silently. - /// Note: Will not function properly if the string length is bigger than 1. - [Description("Specifies which string starts a command silently.\nNote: Will not function properly if the string length is bigger than 1.")] - public string CommandSilentSpecifier = "."; + /// The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave. + [Description("The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave.")] + public int DefaultMaximumSpawns = 5; - /// Disables sending logs as messages to players with the log permission. - [Description("Disables sending logs as messages to players with the log permission.")] - public bool DisableSpewLogs = true; + /// The delay between waves. Lower values lead to more mobs. + [Description("The delay between waves. Lower values lead to more mobs.")] + public int DefaultSpawnRate = 600; - /// Prevents OnSecondUpdate checks from writing to the log file. - [Description("Prevents OnSecondUpdate checks from writing to the log file.")] - public bool DisableSecondUpdateLogs = false; + /// Enables never-ending invasion events. You still need to start the event. + [Description("Enables never ending invasion events. You still need to start the event, such as with the /invade command.")] + public bool InfiniteInvasion; - /// The chat color for the superadmin group. - [Description("The chat color for the superadmin group.\n#.#.# = Red/Blue/Green\nMax value: 255")] - public int[] SuperAdminChatRGB = { 255, 255, 255 }; + /// Sets the PvP mode. Valid types are: "normal", "always", "disabled". + [Description("Sets the PvP mode. Valid types are: \"normal\", \"always\" and \"disabled\".")] + public string PvPMode = "normal"; - /// The superadmin chat prefix. - [Description("The superadmin chat prefix.")] - public string SuperAdminChatPrefix = "(Super Admin) "; + /// Prevents tiles from being placed within SpawnProtectionRadius of the default spawn. + [Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")] + public bool SpawnProtection = true; - /// The superadmin chat suffix. - [Description("The superadmin chat suffix.")] - public string SuperAdminChatSuffix = ""; + /// The tile radius around the spawn tile that is protected by the SpawnProtection setting. + [Description("The tile radius around the spawn tile that is protected by the SpawnProtection setting.")] + public int SpawnProtectionRadius = 10; - /// Whether or not to announce a player's geographic location on join, based on their IP. - [Description("Whether or not to announce a player's geographic location on join, based on their IP.")] - public bool EnableGeoIP; + /// Enable or disable anti-cheat range checks based on distance between the player and their block placements. + [Description("Enable or disable anti-cheat range checks based on distance between the player and their block placements.")] + public bool RangeChecks = true; - /// Displays a player's IP on join to users with the log permission. - [Description("Displays a player's IP on join to users with the log permission.")] - public bool DisplayIPToAdmins; + /// Prevents non-hardcore players from connecting. + [Description("Prevents non-hardcore players from connecting.")] + public bool HardcoreOnly; - /// Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message. - [Description("Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message.")] - public string ChatFormat = "{1}{2}{3}: {4}"; + /// Prevents softcore players from connecting. + [Description("Prevents softcore players from connecting.")] + public bool MediumcoreOnly; - /// Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message. - [Description("Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message.")] - public string ChatAboveHeadsFormat = "{2}"; + /// Disables any placing, or removal of blocks. + [Description("Disables any placing, or removal of blocks.")] + public bool DisableBuild; - /// Whether or not to display chat messages above players' heads. - [Description("Whether or not to display chat messages above players' heads.")] - public bool EnableChatAboveHeads = false; + /// If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command. + [Description("If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command.")] + public bool DisableHardmode; - /// The RGB values used for the color of broadcast messages. - [Description("The RGB values used for the color of broadcast messages.\n#.#.# = Red/Blue/Green\nMax value: 255")] - public int[] BroadcastRGB = { 127, 255, 212 }; + /// Prevents the dungeon guardian from being spawned while sending players to their spawn point instead. + [Description("Prevents the dungeon guardian from being spawned while sending players to their spawn point instead.")] + public bool DisableDungeonGuardian; + + /// Disables clown bomb projectiles from spawning. + [Description("Disables clown bomb projectiles from spawning.")] + public bool DisableClownBombs; + + /// Disables snow ball projectiles from spawning. + [Description("Disables snow ball projectiles from spawning.")] + public bool DisableSnowBalls; + + /// Disables tombstone dropping during death for all players. + [Description("Disables tombstone dropping during death for all players.")] + public bool DisableTombstones = true; + + /// Forces the world time to be normal, day, or night. + [Description("Forces the world time to be normal, day, or night.")] + public string ForceTime = "normal"; + + /// Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients. + [Description("Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients.")] + public bool DisableInvisPvP; + + /// The maximum distance, in tiles, that disabled players can move from. + [Description("The maximum distance, in tiles, that disabled players can move from.")] + public int MaxRangeForDisabled = 10; + + /// Whether or not region protection should apply to chests. + [Description("Whether or not region protection should apply to chests.")] + public bool RegionProtectChests; + + /// Whether or not region protection should apply to gem locks. + [Description("Whether or not region protection should apply to gem locks.")] + public bool RegionProtectGemLocks = true; + + /// Ignores checks to see if a player 'can' update a projectile. + [Description("Ignores checks to see if a player 'can' update a projectile.")] + public bool IgnoreProjUpdate = false; + + /// Ignores checks to see if a player 'can' kill a projectile. + [Description("Ignores checks to see if a player 'can' kill a projectile.")] + public bool IgnoreProjKill = false; + + /// Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build. + [Description("Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build.")] + public bool AllowCutTilesAndBreakables = false; + + /// Allows ice placement even where a user cannot usually build. + [Description("Allows ice placement even where a user cannot usually build.")] + public bool AllowIce = false; + + /// Allows the crimson to spread when a world is in hardmode. + [Description("Allows the crimson to spread when a world is in hardmode.")] + public bool AllowCrimsonCreep = true; + + /// Allows the corruption to spread when a world is in hardmode. + [Description("Allows the corruption to spread when a world is in hardmode.")] + public bool AllowCorruptionCreep = true; + + /// Allows the hallow to spread when a world is in hardmode. + [Description("Allows the hallow to spread when a world is in hardmode.")] + public bool AllowHallowCreep = true; + + /// How many NPCs a statue can spawn within 200 pixels(?) before it stops spawning. + [Description("How many NPCs a statue can spawn within 200 pixels(?) before it stops spawning.\nDefault = 3.")] + public int StatueSpawn200 = 3; + + /// How many NPCs a statue can spawn within 600 pixels(?) before it stops spawning. + [Description("How many NPCs a statue can spawn within 600 pixels(?) before it stops spawning.\nDefault = 6.")] + public int StatueSpawn600 = 6; + + /// How many NPCs a statue can spawn before it stops spawning. + [Description("How many NPCs a statue can spawn before it stops spawning.\nDefault = 10.")] + public int StatueSpawnWorld = 10; + + /// Prevent banned items from being spawned or given with commands. + [Description("Prevent banned items from being spawned or given with commands.")] + public bool PreventBannedItemSpawn = false; + + /// Prevent players from interacting with the world while they are dead. + [Description("Prevent players from interacting with the world while they are dead.")] + public bool PreventDeadModification = true; + + /// Prevents players from placing tiles with an invalid style. + [Description("Prevents players from placing tiles with an invalid style.")] + public bool PreventInvalidPlaceStyle = true; + + /// Forces Christmas-only events to occur all year. + [Description("Forces Christmas-only events to occur all year.")] + public bool ForceXmas = false; + + /// Forces Halloween-only events to occur all year. + [Description("Forces Halloween-only events to occur all year.")] + public bool ForceHalloween = false; + + /// Allows groups on the banned item allowed list to spawn banned items even if PreventBannedItemSpawn is set to true. + [Description("Allows groups on the banned item allowed list to spawn banned items even if PreventBannedItemSpawn is set to true.")] + public bool AllowAllowedGroupsToSpawnBannedItems = false; + + /// The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk. + [Description("The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk.")] + public int RespawnSeconds = 5; + + /// The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk. + [Description("The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk.")] + public int RespawnBossSeconds = 10; + + /// Whether or not to announce boss spawning or invasion starts. + [Description("Whether or not to announce boss spawning or invasion starts.")] + public bool AnonymousBossInvasions = true; + + /// The maximum HP a player can have, before equipment buffs. + [Description("The maximum HP a player can have, before equipment buffs.")] + public int MaxHP = 500; + + /// The maximum MP a player can have, before equipment buffs. + [Description("The maximum MP a player can have, before equipment buffs.")] + public int MaxMP = 200; + + /// Determines the range in tiles that a bomb can affect tiles from detonation point. + [Description("Determines the range in tiles that a bomb can affect tiles from detonation point.")] + public int BombExplosionRadius = 5; - // MySQL - - /// The type of database to use when storing data (either "sqlite" or "mysql"). - [Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")] - public string StorageType = "sqlite"; - - /// The path of sqlite db. - [Description("The path of sqlite db.")] - public string SqliteDBPath = "tshock.sqlite"; - - /// The MySQL hostname and port to direct connections to. - [Description("The MySQL hostname and port to direct connections to.")] - public string MySqlHost = "localhost:3306"; - - /// The database name to connect to when using MySQL as the database type. - [Description("The database name to connect to when using MySQL as the database type.")] - public string MySqlDbName = ""; - - /// The username used when connecting to a MySQL database. - [Description("The username used when connecting to a MySQL database.")] - public string MySqlUsername = ""; - - /// The password used when connecting to a MySQL database. - [Description("The password used when connecting to a MySQL database.")] - public string MySqlPassword = ""; - - /// Whether or not to save logs to the SQL database instead of a text file. - [Description("Whether or not to save logs to the SQL database instead of a text file.\nDefault = false.")] - public bool UseSqlLogs = false; - - /// Number of times the SQL log must fail to insert logs before falling back to the text log. - [Description("Number of times the SQL log must fail to insert logs before falling back to the text log.")] - public int RevertToTextLogsOnSqlFailures = 10; - - - // REST API - - /// Enable or disable the REST API. - [Description("Enable or disable the REST API.")] - public bool RestApiEnabled; - - /// The port used by the REST API. - [Description("The port used by the REST API.")] - public int RestApiPort = 7878; - - /// Whether or not to log REST API connections. - [Description("Whether or not to log REST API connections.")] - public bool LogRest = false; - - /// Whether or not to require token authentication to use the public REST API endpoints. - [Description("Whether or not to require token authentication to use the public REST API endpoints.")] - public bool EnableTokenEndpointAuthentication; - - /// The maximum REST requests in the bucket before denying requests. Minimum value is 5. - [Description("The maximum REST requests in the bucket before denying requests. Minimum value is 5.")] - public int RESTMaximumRequestsPerInterval = 5; - - /// How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute. - [Description("How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute.")] - public int RESTRequestBucketDecreaseIntervalMinutes = 1; - - /// A dictionary of REST tokens that external applications may use to make queries to your server. - [Description("A dictionary of REST tokens that external applications may use to make queries to your server.")] - public Dictionary ApplicationRestTokens = new Dictionary(); - - - // Login and Ban + /* ~~~~~ Login and Ban ~~~~~ */ /// The default group name to place newly registered users under. [Description("The default group name to place newly registered users under.")] @@ -409,179 +461,128 @@ namespace TShockAPI public bool KickOnHealOtherThresholdBroken = false; - // World + /* ~~~~~ Chat ~~~~~ */ - /// Determines the size of invasion events. The equation for calculating invasion size = 100 + (multiplier * (number of active players > 200 hp)). - [Description("Determines the size of invasion events.\nThe equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health)).")] - public int InvasionMultiplier = 1; + /// Specifies which string starts a command. + /// Note: Will not function properly if the string length is bigger than 1. + [Description("Specifies which string starts a command.\nNote: Will not function properly if the string length is bigger than 1.")] + public string CommandSpecifier = "/"; - /// The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave. - [Description("The default maximum number of mobs that will spawn per wave. Higher means more mobs in that wave.")] - public int DefaultMaximumSpawns = 5; + /// Specifies which string starts a command silently. + /// Note: Will not function properly if the string length is bigger than 1. + [Description("Specifies which string starts a command silently.\nNote: Will not function properly if the string length is bigger than 1.")] + public string CommandSilentSpecifier = "."; - /// The delay between waves. Lower values lead to more mobs. - [Description("The delay between waves. Lower values lead to more mobs.")] - public int DefaultSpawnRate = 600; + /// Disables sending logs as messages to players with the log permission. + [Description("Disables sending logs as messages to players with the log permission.")] + public bool DisableSpewLogs = true; - /// Enables never-ending invasion events. You still need to start the event. - [Description("Enables never ending invasion events. You still need to start the event, such as with the /invade command.")] - public bool InfiniteInvasion; + /// Prevents OnSecondUpdate checks from writing to the log file. + [Description("Prevents OnSecondUpdate checks from writing to the log file.")] + public bool DisableSecondUpdateLogs = false; - /// Sets the PvP mode. Valid types are: "normal", "always", "disabled". - [Description("Sets the PvP mode. Valid types are: \"normal\", \"always\" and \"disabled\".")] - public string PvPMode = "normal"; + /// The chat color for the superadmin group. + [Description("The chat color for the superadmin group.\n#.#.# = Red/Blue/Green\nMax value: 255")] + public int[] SuperAdminChatRGB = { 255, 255, 255 }; - /// Prevents tiles from being placed within SpawnProtectionRadius of the default spawn. - [Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")] - public bool SpawnProtection = true; + /// The superadmin chat prefix. + [Description("The superadmin chat prefix.")] + public string SuperAdminChatPrefix = "(Super Admin) "; - /// The tile radius around the spawn tile that is protected by the SpawnProtection setting. - [Description("The tile radius around the spawn tile that is protected by the SpawnProtection setting.")] - public int SpawnProtectionRadius = 10; + /// The superadmin chat suffix. + [Description("The superadmin chat suffix.")] + public string SuperAdminChatSuffix = ""; - /// Enable or disable anti-cheat range checks based on distance between the player and their block placements. - [Description("Enable or disable anti-cheat range checks based on distance between the player and their block placements.")] - public bool RangeChecks = true; + /// Whether or not to announce a player's geographic location on join, based on their IP. + [Description("Whether or not to announce a player's geographic location on join, based on their IP.")] + public bool EnableGeoIP; - /// Prevents non-hardcore players from connecting. - [Description("Prevents non-hardcore players from connecting.")] - public bool HardcoreOnly; + /// Displays a player's IP on join to users with the log permission. + [Description("Displays a player's IP on join to users with the log permission.")] + public bool DisplayIPToAdmins; - /// Prevents softcore players from connecting. - [Description("Prevents softcore players from connecting.")] - public bool MediumcoreOnly; + /// Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message. + [Description("Changes in-game chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message.")] + public string ChatFormat = "{1}{2}{3}: {4}"; - /// Disables any placing, or removal of blocks. - [Description("Disables any placing, or removal of blocks.")] - public bool DisableBuild; + /// Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message. + [Description("Changes the player name when using chat above heads. Starts with a player name wrapped in brackets, as per Terraria's formatting.\nSame formatting as ChatFormat without the message.")] + public string ChatAboveHeadsFormat = "{2}"; - /// If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command. - [Description("If enabled, hardmode will not be activated by the Wall of Flesh or the /starthardmode command.")] - public bool DisableHardmode; + /// Whether or not to display chat messages above players' heads. + [Description("Whether or not to display chat messages above players' heads.")] + public bool EnableChatAboveHeads = false; - /// Prevents the dungeon guardian from being spawned while sending players to their spawn point instead. - [Description("Prevents the dungeon guardian from being spawned while sending players to their spawn point instead.")] - public bool DisableDungeonGuardian; + /// The RGB values used for the color of broadcast messages. + [Description("The RGB values used for the color of broadcast messages.\n#.#.# = Red/Blue/Green\nMax value: 255")] + public int[] BroadcastRGB = { 127, 255, 212 }; - /// Disables clown bomb projectiles from spawning. - [Description("Disables clown bomb projectiles from spawning.")] - public bool DisableClownBombs; - /// Disables snow ball projectiles from spawning. - [Description("Disables snow ball projectiles from spawning.")] - public bool DisableSnowBalls; + /* ~~~~~ MySQL ~~~~~ */ - /// Disables tombstone dropping during death for all players. - [Description("Disables tombstone dropping during death for all players.")] - public bool DisableTombstones = true; + /// The type of database to use when storing data (either "sqlite" or "mysql"). + [Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")] + public string StorageType = "sqlite"; - /// Forces the world time to be normal, day, or night. - [Description("Forces the world time to be normal, day, or night.")] - public string ForceTime = "normal"; + /// The path of sqlite db. + [Description("The path of sqlite db.")] + public string SqliteDBPath = "tshock.sqlite"; - /// Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients. - [Description("Disables the effect of invisibility potions while PvP is enabled by turning the player visible to the other clients.")] - public bool DisableInvisPvP; + /// The MySQL hostname and port to direct connections to. + [Description("The MySQL hostname and port to direct connections to.")] + public string MySqlHost = "localhost:3306"; - /// The maximum distance, in tiles, that disabled players can move from. - [Description("The maximum distance, in tiles, that disabled players can move from.")] - public int MaxRangeForDisabled = 10; + /// The database name to connect to when using MySQL as the database type. + [Description("The database name to connect to when using MySQL as the database type.")] + public string MySqlDbName = ""; - /// Whether or not region protection should apply to chests. - [Description("Whether or not region protection should apply to chests.")] - public bool RegionProtectChests; + /// The username used when connecting to a MySQL database. + [Description("The username used when connecting to a MySQL database.")] + public string MySqlUsername = ""; - /// Whether or not region protection should apply to gem locks. - [Description("Whether or not region protection should apply to gem locks.")] - public bool RegionProtectGemLocks = true; + /// The password used when connecting to a MySQL database. + [Description("The password used when connecting to a MySQL database.")] + public string MySqlPassword = ""; - /// Ignores checks to see if a player 'can' update a projectile. - [Description("Ignores checks to see if a player 'can' update a projectile.")] - public bool IgnoreProjUpdate = false; + /// Whether or not to save logs to the SQL database instead of a text file. + [Description("Whether or not to save logs to the SQL database instead of a text file.\nDefault = false.")] + public bool UseSqlLogs = false; - /// Ignores checks to see if a player 'can' kill a projectile. - [Description("Ignores checks to see if a player 'can' kill a projectile.")] - public bool IgnoreProjKill = false; + /// Number of times the SQL log must fail to insert logs before falling back to the text log. + [Description("Number of times the SQL log must fail to insert logs before falling back to the text log.")] + public int RevertToTextLogsOnSqlFailures = 10; - /// Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build. - [Description("Allows players to break temporary tiles (grass, pots, etc) where they cannot usually build.")] - public bool AllowCutTilesAndBreakables = false; - /// Allows ice placement even where a user cannot usually build. - [Description("Allows ice placement even where a user cannot usually build.")] - public bool AllowIce = false; + /* ~~~~~ REST API ~~~~~ */ - /// Allows the crimson to spread when a world is in hardmode. - [Description("Allows the crimson to spread when a world is in hardmode.")] - public bool AllowCrimsonCreep = true; + /// Enable or disable the REST API. + [Description("Enable or disable the REST API.")] + public bool RestApiEnabled; - /// Allows the corruption to spread when a world is in hardmode. - [Description("Allows the corruption to spread when a world is in hardmode.")] - public bool AllowCorruptionCreep = true; + /// The port used by the REST API. + [Description("The port used by the REST API.")] + public int RestApiPort = 7878; - /// Allows the hallow to spread when a world is in hardmode. - [Description("Allows the hallow to spread when a world is in hardmode.")] - public bool AllowHallowCreep = true; + /// Whether or not to log REST API connections. + [Description("Whether or not to log REST API connections.")] + public bool LogRest = false; - /// How many NPCs a statue can spawn within 200 pixels(?) before it stops spawning. - [Description("How many NPCs a statue can spawn within 200 pixels(?) before it stops spawning.\nDefault = 3.")] - public int StatueSpawn200 = 3; + /// Whether or not to require token authentication to use the public REST API endpoints. + [Description("Whether or not to require token authentication to use the public REST API endpoints.")] + public bool EnableTokenEndpointAuthentication; - /// How many NPCs a statue can spawn within 600 pixels(?) before it stops spawning. - [Description("How many NPCs a statue can spawn within 600 pixels(?) before it stops spawning.\nDefault = 6.")] - public int StatueSpawn600 = 6; + /// The maximum REST requests in the bucket before denying requests. Minimum value is 5. + [Description("The maximum REST requests in the bucket before denying requests. Minimum value is 5.")] + public int RESTMaximumRequestsPerInterval = 5; - /// How many NPCs a statue can spawn before it stops spawning. - [Description("How many NPCs a statue can spawn before it stops spawning.\nDefault = 10.")] - public int StatueSpawnWorld = 10; + /// How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute. + [Description("How often in minutes the REST requests bucket is decreased by one. Minimum value is 1 minute.")] + public int RESTRequestBucketDecreaseIntervalMinutes = 1; - /// Prevent banned items from being spawned or given with commands. - [Description("Prevent banned items from being spawned or given with commands.")] - public bool PreventBannedItemSpawn = false; + /// A dictionary of REST tokens that external applications may use to make queries to your server. + [Description("A dictionary of REST tokens that external applications may use to make queries to your server.")] + public Dictionary ApplicationRestTokens = new Dictionary(); - /// Prevent players from interacting with the world while they are dead. - [Description("Prevent players from interacting with the world while they are dead.")] - public bool PreventDeadModification = true; - - /// Prevents players from placing tiles with an invalid style. - [Description("Prevents players from placing tiles with an invalid style.")] - public bool PreventInvalidPlaceStyle = true; - - /// Forces Christmas-only events to occur all year. - [Description("Forces Christmas-only events to occur all year.")] - public bool ForceXmas = false; - - /// Forces Halloween-only events to occur all year. - [Description("Forces Halloween-only events to occur all year.")] - public bool ForceHalloween = false; - - /// Allows groups on the banned item allowed list to spawn banned items even if PreventBannedItemSpawn is set to true. - [Description("Allows groups on the banned item allowed list to spawn banned items even if PreventBannedItemSpawn is set to true.")] - public bool AllowAllowedGroupsToSpawnBannedItems = false; - - /// The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk. - [Description("The number of seconds a player must wait before being respawned. Cannot be longer than normal value now. Use at your own risk.")] - public int RespawnSeconds = 5; - - /// The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk. - [Description("The number of seconds a player must wait before being respawned if there is a boss nearby. Cannot be longer than normal value now. Use at your own risk.")] - public int RespawnBossSeconds = 10; - - /// Whether or not to announce boss spawning or invasion starts. - [Description("Whether or not to announce boss spawning or invasion starts.")] - public bool AnonymousBossInvasions = true; - - /// The maximum HP a player can have, before equipment buffs. - [Description("The maximum HP a player can have, before equipment buffs.")] - public int MaxHP = 500; - - /// The maximum MP a player can have, before equipment buffs. - [Description("The maximum MP a player can have, before equipment buffs.")] - public int MaxMP = 200; - - /// Determines the range in tiles that a bomb can affect tiles from detonation point. - [Description("Determines the range in tiles that a bomb can affect tiles from detonation point.")] - public int BombExplosionRadius = 5; /// From 42c2acafec5c6b65d021038cb6226251de501fea Mon Sep 17 00:00:00 2001 From: KZ Date: Sun, 7 Jun 2020 14:13:53 -0700 Subject: [PATCH 4/7] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9883b79..78c6dce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * Installed new sprinklers! +* Organized parameters by category and relevance in the `config.json` file. (@kubedzero) ## TShock 4.4.0 (Pre-release 11) * New permission `tshock.tp.pylon` to enable teleporting via Teleportation Pylons (@QuiCM) From a844a54763054ac3d379472091bd80983103dbcc Mon Sep 17 00:00:00 2001 From: KZ Date: Sun, 7 Jun 2020 16:35:52 -0700 Subject: [PATCH 5/7] Use Region blocks for better outlining readability https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-region --- TShockAPI/ConfigFile.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 27eaa9fc..acfeb61a 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -31,7 +31,7 @@ namespace TShockAPI public class ConfigFile { - /* ~~~~~ Server ~~~~~ */ + #region Server Settings /// The server password required to join the server. [Description("The server password required to join the server.")] @@ -73,8 +73,10 @@ namespace TShockAPI [Description("Allows stacks in chests to go beyond the stack limit during world loading.")] public bool IgnoreChestStacksOnLoad = false; + #endregion - /* ~~~~~ Backup and Save ~~~~~ */ + + #region Backup and Save Settings /// Enable or disable Terraria's built-in world auto save. [Description("Enable or disable Terraria's built-in world auto save.")] @@ -104,8 +106,10 @@ namespace TShockAPI [Description("Whether or not to save the world when the last player disconnects.")] public bool SaveWorldOnLastPlayerExit = true; + #endregion - /* ~~~~~ World ~~~~~ */ + + #region World Settings /// Determines the size of invasion events. The equation for calculating invasion size = 100 + (multiplier * (number of active players > 200 hp)). [Description("Determines the size of invasion events.\nThe equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health)).")] @@ -279,8 +283,10 @@ namespace TShockAPI [Description("Determines the range in tiles that a bomb can affect tiles from detonation point.")] public int BombExplosionRadius = 5; + #endregion - /* ~~~~~ Login and Ban ~~~~~ */ + + #region Login and Ban Settings /// The default group name to place newly registered users under. [Description("The default group name to place newly registered users under.")] @@ -460,8 +466,10 @@ namespace TShockAPI [Description("Whether or not to kick users when they surpass the HealOther threshold.")] public bool KickOnHealOtherThresholdBroken = false; + #endregion - /* ~~~~~ Chat ~~~~~ */ + + #region Chat Settings /// Specifies which string starts a command. /// Note: Will not function properly if the string length is bigger than 1. @@ -517,8 +525,10 @@ namespace TShockAPI [Description("The RGB values used for the color of broadcast messages.\n#.#.# = Red/Blue/Green\nMax value: 255")] public int[] BroadcastRGB = { 127, 255, 212 }; + #endregion - /* ~~~~~ MySQL ~~~~~ */ + + #region MySQL Settings /// The type of database to use when storing data (either "sqlite" or "mysql"). [Description("The type of database to use when storing data (either \"sqlite\" or \"mysql\").")] @@ -552,8 +562,10 @@ namespace TShockAPI [Description("Number of times the SQL log must fail to insert logs before falling back to the text log.")] public int RevertToTextLogsOnSqlFailures = 10; + #endregion - /* ~~~~~ REST API ~~~~~ */ + + #region REST API Settings /// Enable or disable the REST API. [Description("Enable or disable the REST API.")] @@ -583,6 +595,7 @@ namespace TShockAPI [Description("A dictionary of REST tokens that external applications may use to make queries to your server.")] public Dictionary ApplicationRestTokens = new Dictionary(); + #endregion /// From f5e1510f58cc12b39f73e00d4e49992cb7b25cb5 Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Fri, 12 Jun 2020 00:56:51 +0200 Subject: [PATCH 6/7] Bouncer OnTileEdit - Add new personalstorage tiles for ssc check. We do not allow piggybank and safe to be placed if SSC is enabled. The DefendersFroge and VoidVault have the same functionality as far as I know. So adding these two missing tiles. --- CHANGELOG.md | 1 + TShockAPI/Bouncer.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e699b5b7..8bf59f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Adding staff projectiles to the directionalProjectiles Dictionary to include staffs in the valid projectile creation check. * Adding GolfBallItemIDs list in Handlers.LandGolfBallInCupHandler.cs * Fixed an issue in the SendTileSquare handler that was rejecting valid tile objects (@QuiCM) +* Prevent player placing the Void Vault and Defenders Forge if the server is in SSC mode.(@Patrikkk) ## TShock 4.4.0 (Pre-release 11) * New permission `tshock.tp.pylon` to enable teleporting via Teleportation Pylons (@QuiCM) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 3d6e7521..0cad0108 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -365,7 +365,7 @@ namespace TShockAPI args.Handled = true; return; } - if (action == EditAction.PlaceTile && (editData == TileID.PiggyBank || editData == TileID.Safes) && Main.ServerSideCharacter) + if (action == EditAction.PlaceTile && personalStorageTileIDs.Contains(editData) && Main.ServerSideCharacter) { TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (sscprotect) {0} {1} {2}", args.Player.Name, action, editData); args.Player.SendErrorMessage("You cannot place this tile because server side characters are enabled."); @@ -2135,6 +2135,14 @@ namespace TShockAPI TileID.Campfire }; + private static List personalStorageTileIDs = new List() + { + TileID.PiggyBank, + TileID.Safes, + TileID.DefendersForge, + TileID.VoidVault + }; + /// /// These projectiles have been added or modified with Terraria 1.4. /// They come from normal items, but to have the directional functionality, they must be projectiles. From c03ac50f81bc35f19e6a36245bbaf586153bb81b Mon Sep 17 00:00:00 2001 From: Patrikkk Date: Fri, 12 Jun 2020 10:38:13 +0200 Subject: [PATCH 7/7] Bouncer OnTileEdit remove personal storage SSC check. We are covering/tracking these features properly now in SSC, thus they are unnedded. --- CHANGELOG.md | 2 +- TShockAPI/Bouncer.cs | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bf59f56..685a6eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Adding staff projectiles to the directionalProjectiles Dictionary to include staffs in the valid projectile creation check. * Adding GolfBallItemIDs list in Handlers.LandGolfBallInCupHandler.cs * Fixed an issue in the SendTileSquare handler that was rejecting valid tile objects (@QuiCM) -* Prevent player placing the Void Vault and Defenders Forge if the server is in SSC mode.(@Patrikkk) +* Remove checks that prevented people placing personal storage tiles in SSC as the personal storage is synced with the server.(@Patrikkk) ## TShock 4.4.0 (Pre-release 11) * New permission `tshock.tp.pylon` to enable teleporting via Teleportation Pylons (@QuiCM) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 0cad0108..a909b70a 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -365,14 +365,6 @@ namespace TShockAPI args.Handled = true; return; } - if (action == EditAction.PlaceTile && personalStorageTileIDs.Contains(editData) && Main.ServerSideCharacter) - { - TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (sscprotect) {0} {1} {2}", args.Player.Name, action, editData); - args.Player.SendErrorMessage("You cannot place this tile because server side characters are enabled."); - args.Player.SendTileSquare(tileX, tileY, 3); - args.Handled = true; - return; - } if (action == EditAction.PlaceTile && (editData == TileID.Containers || editData == TileID.Containers2)) { if (TShock.Utils.HasWorldReachedMaxChests()) @@ -2135,14 +2127,6 @@ namespace TShockAPI TileID.Campfire }; - private static List personalStorageTileIDs = new List() - { - TileID.PiggyBank, - TileID.Safes, - TileID.DefendersForge, - TileID.VoidVault - }; - /// /// These projectiles have been added or modified with Terraria 1.4. /// They come from normal items, but to have the directional functionality, they must be projectiles.