diff --git a/CHANGELOG.md b/CHANGELOG.md index 8373292e..21a27308 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `/v2/players/read` * `/v2/server/rawcmd` (@WhiteXZ). * Fixed `/user group` always giving an unhelpful error messaging telling you to check the console, even if we knew exactly why it failed (@nicatronTg). +* Removed _all obsolete methods in TShock marked obsolete prior to this version (all of them)_ (@nicatronTg). ## TShock 4.3.20 * Security improvement: The auth system is now automatically disabled if a superadmin exists in the database (@Enerdy). diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 2d2d26d2..ca865945 100755 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -135,10 +135,6 @@ namespace TShockAPI /// UseServerName - Whether or not to use ServerName in place of the world name. [Description("Sends ServerName in place of the world name to clients.")] public bool UseServerName = false; - /// MasterServer - Not implemented. - [Obsolete("Not implemented")] - [Description("Not implemented.")] - public string MasterServer = "127.0.0.1"; /// StorageType - The type of SQL database to use when storing data (either "sqlite" or "mysql"). [Description("Valid types are \"sqlite\" and \"mysql\".")] @@ -164,11 +160,6 @@ namespace TShockAPI [Description("The reason given when kicking a mediumcore player on death if KickOnMediumcoreDeath is set to true.")] public string MediumcoreKickReason = "Death results in a kick"; - /// EnableDNSHostResolution - Not implemented. - [Obsolete("Not implemented")] - [Description("(Not Implemented) Enables DNS resolution of incoming connections with GetGroupForIPExpensive.")] - public bool EnableDNSHostResolution; - /// EnableIPBans - Whether or not to kick players on join that match a banned IP address. [Description("Enables kicking of banned users by matching their IP Address.")] public bool EnableIPBans = true; @@ -202,11 +193,6 @@ namespace TShockAPI [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"; - /// BufferPackets - No longer used. - [Obsolete("No longer used")] - [Description("(No longer used) Buffers up the packets and sends them out at the end of each frame.")] - public bool BufferPackets = true; - /// ServerFullReason - The reason given when kicking players when the server is full. [Description("String that is used when kicking people when the server is full.")] public string ServerFullReason = "Server is full"; @@ -467,16 +453,6 @@ namespace TShockAPI [Description("Disables a player if this number of tiles is painted within 1 second.")] public int TilePaintThreshold = 15; - /// EnableMaxBytesInBuffer - Not implemented. - [Obsolete("Not implemented")] - [Description("(Not implemented) Enables max packet bufferer size.")] - public bool EnableMaxBytesInBuffer = false; - - /// MaxBytesInBuffer - Not implemented. - [Obsolete("Not implemented")] - [Description("(Not implemented) Number of bytes in the packet buffer before we disconnect the player.")] - public int MaxBytesInBuffer = 5242880; - /// ForceHalloween - Forces Halloween-only events to occur all year. [Description("Forces your world to be in Halloween mode regardless of the data.")] public bool ForceHalloween = false; diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 171d7f4a..4772904d 100755 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -149,60 +149,6 @@ namespace TShockAPI.DB throw new GroupManagerException("Failed to add group '" + name + ".'"); } - /// - /// Adds group with name and permissions if it does not exist. - /// - /// name of group - /// parent of group - /// permissions - /// chatcolor - /// exceptions true indicates use exceptions for errors false otherwise - [Obsolete("Use AddGroup(name, parentname, permissions, chatcolor) instead.")] - public String AddGroup(String name, string parentname, String permissions, String chatcolor = Group.defaultChatColor, bool exceptions = false) - { - if (GroupExists(name)) - { - if (exceptions) - throw new GroupExistsException(name); - return "Error: Group already exists; unable to add group."; - } - - var group = new Group(name, null, chatcolor); - group.Permissions = permissions; - if (!string.IsNullOrWhiteSpace(parentname)) - { - var parent = groups.FirstOrDefault(gp => gp.Name == parentname); - if (parent == null || name == parentname) - { - var error = "Invalid parent {0} for group {1}".SFormat(parentname, group.Name); - if (exceptions) - throw new GroupManagerException(error); - TShock.Log.ConsoleError(error); - return error; - } - group.Parent = parent; - } - - string query = (TShock.Config.StorageType.ToLower() == "sqlite") - ? "INSERT OR IGNORE INTO GroupList (GroupName, Parent, Commands, ChatColor) VALUES (@0, @1, @2, @3);" - : "INSERT IGNORE INTO GroupList SET GroupName=@0, Parent=@1, Commands=@2, ChatColor=@3"; - if (database.Query(query, name, parentname, permissions, chatcolor) == 1) - { - groups.Add(group); - return "Group " + name + " has been created successfully."; - } - else if (exceptions) - throw new GroupManagerException("Failed to add group '" + name + ".'"); - - return ""; - } - - [Obsolete("Use AddGroup(name, parentname, permissions, chatcolor) instead.")] - public String AddGroup(String name, String permissions) - { - return AddGroup(name, null, permissions, Group.defaultChatColor, false); - } - /// /// Updates a group including permissions /// diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index 15478600..47fb4843 100755 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -331,12 +331,6 @@ namespace TShockAPI.DB { return Regions.Where(r => r.InArea(x, y)); } - - [Obsolete("Unused")] - public static List ListIDs(string MergedIDs) - { - return MergedIDs.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList(); - } /// /// Changes the size of a given region diff --git a/TShockAPI/DB/SqlTable.cs b/TShockAPI/DB/SqlTable.cs index 856f331f..f3d27d4d 100755 --- a/TShockAPI/DB/SqlTable.cs +++ b/TShockAPI/DB/SqlTable.cs @@ -72,16 +72,6 @@ namespace TShockAPI.DB return false; } - /// - /// Ensures a table exists and that its structure is correct - /// - /// The table name - [Obsolete("This method will be replaced by EnsureTableStructure.")] - public void EnsureExists(SqlTable table) - { - EnsureTableStructure(table); - } - public List GetColumns(SqlTable table) { var ret = new List(); diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs index cb8d1d02..f06003f6 100755 --- a/TShockAPI/DB/WarpsManager.cs +++ b/TShockAPI/DB/WarpsManager.cs @@ -131,16 +131,6 @@ namespace TShockAPI.DB { return Warps.FirstOrDefault(w => String.Equals(w.Name, warpName, StringComparison.OrdinalIgnoreCase)); } - /// - /// Finds the warp with the given name. - /// - /// The name. - /// The warp, if it exists, or else null. - [Obsolete] - public Warp FindWarp(string warpName) - { - return Warps.FirstOrDefault(w => String.Equals(w.Name, warpName, StringComparison.OrdinalIgnoreCase)); - } /// /// Sets the position of a warp. @@ -209,15 +199,6 @@ namespace TShockAPI.DB /// Gets or sets the position. /// public Point Position { get; set; } - /// - /// Gets or sets the position. - /// - [Obsolete] - public Vector2 WarpPos - { - get { return new Vector2(Position.X, Position.Y); } - set { Position = new Point((int)value.X, (int)value.Y); } - } public Warp(Point position, string name, bool isPrivate = false) { @@ -225,13 +206,6 @@ namespace TShockAPI.DB Position = position; IsPrivate = isPrivate; } - [Obsolete] - public Warp(Vector2 position, string name, bool isPrivate = false) - { - Name = name; - WarpPos = position; - IsPrivate = isPrivate; - } /// Creates a warp with a default coordinate of zero, an empty name, public. public Warp() diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 7aaf6f86..2f297f5d 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -209,12 +209,6 @@ namespace TShockAPI [Description("User can clear the list of users who have completed an angler quest that day.")] public static readonly string clearangler = "tshock.npc.clearanglerquests"; - // tshock.superadmin nodes - - [Description("This permission is no longer used.")] - [Obsolete("No longer used.")] - public static readonly string authverify = "tshock.superadmin.authverify"; - [Description("Meant for super admins only.")] public static readonly string user = "tshock.superadmin.user"; diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 5addd336..ccea8c27 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -213,15 +213,6 @@ namespace TShockAPI /// public Vector2 LastNetPosition = Vector2.Zero; - /// - /// The player's login name. - /// - [Obsolete("Use User.Name instead")] - public string UserAccountName - { - get { return User == null ? null : User.Name; } - } - /// /// User object associated with the player. /// Set when the player logs in. @@ -244,15 +235,6 @@ namespace TShockAPI /// public bool HasSentInventory { get; set; } - /// - /// The player's user id( from the db ). - /// - [Obsolete("Use User.ID instead")] - public int UserID - { - get { return User == null ? -1 : User.ID; } - } - /// /// Whether the player has been nagged about logging in. /// @@ -684,16 +666,6 @@ namespace TShockAPI SendData(PacketTypes.Disconnect, reason); } - [Obsolete("This method is no longer used.")] - public virtual void Flush() - { - var client = Netplay.Clients[Index]; - if (client == null) - return; - - //TShock.PacketBuffer.Flush(client); - } - /// /// Fired when the player's temporary group access expires. /// @@ -1068,24 +1040,6 @@ namespace TShockAPI /// public Item ItemInHand = new Item(); - /// - /// Disables the player for the given . - /// - /// The reason why the player was disabled. - /// Whether or not to log this event to the console. - [Obsolete("Use Disable(string, DisableFlags)")] - public virtual void Disable(string reason = "", bool displayConsole = true) - { - if (displayConsole) - { - Disable(reason, DisableFlags.WriteToConsole); - } - else - { - Disable(reason, DisableFlags.WriteToLog); - } - } - /// /// Disables the player for the given /// diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 6af27068..7c945130 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -59,10 +59,6 @@ namespace TShockAPI /// value - the Utils instance public static Utils Instance { get { return instance; } } - /// Random - An instance of random for generating random data. - [Obsolete("Please create your own random objects; this will be removed in the next version of TShock.")] - public Random Random = new Random(); - /// /// Provides the real IP address from a RemoteEndPoint string that contains a port and an IP /// @@ -770,76 +766,6 @@ namespace TShockAPI ply.SendErrorMessage("Use \"my query\" for items with spaces"); } - /// - /// Default hashing algorithm. - /// - [Obsolete("This is no longer necessary, please use TShock.Config.HashAlgorithm instead if you really need it (but use User.VerifyPassword(password)) for verifying passwords.")] - public string HashAlgo = "sha512"; - - /// - /// A dictionary of hashing algortihms and an implementation object. - /// - [Obsolete("This is no longer necessary, after switching to User.VerifyPassword(password) instead.")] - public readonly Dictionary> HashTypes = new Dictionary> - { - {"sha512", () => new SHA512Managed()}, - {"sha256", () => new SHA256Managed()}, - {"md5", () => new MD5Cng()}, - {"sha512-xp", () => SHA512.Create()}, - {"sha256-xp", () => SHA256.Create()}, - {"md5-xp", () => MD5.Create()}, - }; - - /// - /// Returns a Sha256 string for a given string - /// - /// bytes to hash - /// string sha256 - [Obsolete("Please use User.VerifyPassword(password) instead. Warning: This will upgrade passwords to BCrypt. Already converted passwords will not hash correctly using this method.")] - public string HashPassword(byte[] bytes) - { - if (bytes == null) - throw new NullReferenceException("bytes"); - Func func; - if (!HashTypes.TryGetValue(HashAlgo.ToLower(), out func)) - throw new NotSupportedException("Hashing algorithm {0} is not supported".SFormat(HashAlgo.ToLower())); - - using (var hash = func()) - { - var ret = hash.ComputeHash(bytes); - return ret.Aggregate("", (s, b) => s + b.ToString("X2")); - } - } - - /// - /// Returns a Sha256 string for a given string - /// - /// string to hash - /// string sha256 - [Obsolete("Please use User.VerifyPassword(password) instead. Warning: This will upgrade passwords to BCrypt. Already converted passwords will not hash correctly using this method.")] - public string HashPassword(string password) - { - if (string.IsNullOrEmpty(password) || password == "non-existant password") - return "non-existant password"; - return HashPassword(Encoding.UTF8.GetBytes(password)); - } - - /// - /// Checks if the string contains any unprintable characters - /// - /// String to check - /// True if the string only contains printable characters - [Obsolete("ValidString is being removed as it serves no purpose to TShock at this time.")] - public bool ValidString(string str) - { - foreach (var c in str) - { - if (c < 0x20 || c > 0xA9) - return false; - } - return true; - } - /// /// Checks if world has hit the max number of chests /// @@ -916,23 +842,6 @@ namespace TShockAPI return 1000; } - /// - /// Sanitizes input strings - /// - /// string - /// sanitized string - [Obsolete("SanitizeString is being removed from TShock as it currently serves no purpose.")] - public string SanitizeString(string str) - { - var returnstr = str.ToCharArray(); - for (int i = 0; i < str.Length; i++) - { - if (!ValidString(str[i].ToString())) - returnstr[i] = ' '; - } - return new string(returnstr); - } - /// /// Enumerates boundary points of the given region's rectangle. ///