Removed all obsolete methods from TShock

This commit is contained in:
Lucas Nicodemus 2016-10-23 06:09:17 -06:00
parent a8b4bf1d95
commit a0c4864567
No known key found for this signature in database
GPG key ID: CEE668CCE1BF2C7C
9 changed files with 1 additions and 263 deletions

View file

@ -135,10 +135,6 @@ namespace TShockAPI
/// <summary>UseServerName - Whether or not to use ServerName in place of the world name.</summary>
[Description("Sends ServerName in place of the world name to clients.")]
public bool UseServerName = false;
/// <summary>MasterServer - Not implemented.</summary>
[Obsolete("Not implemented")]
[Description("Not implemented.")]
public string MasterServer = "127.0.0.1";
/// <summary>StorageType - The type of SQL database to use when storing data (either "sqlite" or "mysql").</summary>
[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";
/// <summary>EnableDNSHostResolution - Not implemented.</summary>
[Obsolete("Not implemented")]
[Description("(Not Implemented) Enables DNS resolution of incoming connections with GetGroupForIPExpensive.")]
public bool EnableDNSHostResolution;
/// <summary>EnableIPBans - Whether or not to kick players on join that match a banned IP address.</summary>
[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";
/// <summary>BufferPackets - No longer used.</summary>
[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;
/// <summary>ServerFullReason - The reason given when kicking players when the server is full.</summary>
[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;
/// <summary>EnableMaxBytesInBuffer - Not implemented.</summary>
[Obsolete("Not implemented")]
[Description("(Not implemented) Enables max packet bufferer size.")]
public bool EnableMaxBytesInBuffer = false;
/// <summary>MaxBytesInBuffer - Not implemented.</summary>
[Obsolete("Not implemented")]
[Description("(Not implemented) Number of bytes in the packet buffer before we disconnect the player.")]
public int MaxBytesInBuffer = 5242880;
/// <summary>ForceHalloween - Forces Halloween-only events to occur all year.</summary>
[Description("Forces your world to be in Halloween mode regardless of the data.")]
public bool ForceHalloween = false;

View file

@ -149,60 +149,6 @@ namespace TShockAPI.DB
throw new GroupManagerException("Failed to add group '" + name + ".'");
}
/// <summary>
/// Adds group with name and permissions if it does not exist.
/// </summary>
/// <param name="name">name of group</param>
/// <param name="parentname">parent of group</param>
/// <param name="permissions">permissions</param>
/// <param name="chatcolor">chatcolor</param>
/// <param name="exceptions">exceptions true indicates use exceptions for errors false otherwise</param>
[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);
}
/// <summary>
/// Updates a group including permissions
/// </summary>

View file

@ -331,12 +331,6 @@ namespace TShockAPI.DB
{
return Regions.Where(r => r.InArea(x, y));
}
[Obsolete("Unused")]
public static List<string> ListIDs(string MergedIDs)
{
return MergedIDs.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
}
/// <summary>
/// Changes the size of a given region

View file

@ -72,16 +72,6 @@ namespace TShockAPI.DB
return false;
}
/// <summary>
/// Ensures a table exists and that its structure is correct
/// </summary>
/// <param name="table">The table name</param>
[Obsolete("This method will be replaced by EnsureTableStructure.")]
public void EnsureExists(SqlTable table)
{
EnsureTableStructure(table);
}
public List<string> GetColumns(SqlTable table)
{
var ret = new List<string>();

View file

@ -131,16 +131,6 @@ namespace TShockAPI.DB
{
return Warps.FirstOrDefault(w => String.Equals(w.Name, warpName, StringComparison.OrdinalIgnoreCase));
}
/// <summary>
/// Finds the warp with the given name.
/// </summary>
/// <param name="warpName">The name.</param>
/// <returns>The warp, if it exists, or else null.</returns>
[Obsolete]
public Warp FindWarp(string warpName)
{
return Warps.FirstOrDefault(w => String.Equals(w.Name, warpName, StringComparison.OrdinalIgnoreCase));
}
/// <summary>
/// Sets the position of a warp.
@ -209,15 +199,6 @@ namespace TShockAPI.DB
/// Gets or sets the position.
/// </summary>
public Point Position { get; set; }
/// <summary>
/// Gets or sets the position.
/// </summary>
[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;
}
/// <summary>Creates a warp with a default coordinate of zero, an empty name, public.</summary>
public Warp()

View file

@ -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";

View file

@ -213,15 +213,6 @@ namespace TShockAPI
/// </summary>
public Vector2 LastNetPosition = Vector2.Zero;
/// <summary>
/// The player's login name.
/// </summary>
[Obsolete("Use User.Name instead")]
public string UserAccountName
{
get { return User == null ? null : User.Name; }
}
/// <summary>
/// User object associated with the player.
/// Set when the player logs in.
@ -244,15 +235,6 @@ namespace TShockAPI
/// </summary>
public bool HasSentInventory { get; set; }
/// <summary>
/// The player's user id( from the db ).
/// </summary>
[Obsolete("Use User.ID instead")]
public int UserID
{
get { return User == null ? -1 : User.ID; }
}
/// <summary>
/// Whether the player has been nagged about logging in.
/// </summary>
@ -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);
}
/// <summary>
/// Fired when the player's temporary group access expires.
/// </summary>
@ -1068,24 +1040,6 @@ namespace TShockAPI
/// </summary>
public Item ItemInHand = new Item();
/// <summary>
/// Disables the player for the given <paramref name="reason"/>.
/// </summary>
/// <param name="reason">The reason why the player was disabled.</param>
/// <param name="displayConsole">Whether or not to log this event to the console.</param>
[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);
}
}
/// <summary>
/// Disables the player for the given <paramref name="reason"/>
/// </summary>

View file

@ -59,10 +59,6 @@ namespace TShockAPI
/// <value>value - the Utils instance</value>
public static Utils Instance { get { return instance; } }
/// <summary>Random - An instance of random for generating random data.</summary>
[Obsolete("Please create your own random objects; this will be removed in the next version of TShock.")]
public Random Random = new Random();
/// <summary>
/// Provides the real IP address from a RemoteEndPoint string that contains a port and an IP
/// </summary>
@ -770,76 +766,6 @@ namespace TShockAPI
ply.SendErrorMessage("Use \"my query\" for items with spaces");
}
/// <summary>
/// Default hashing algorithm.
/// </summary>
[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";
/// <summary>
/// A dictionary of hashing algortihms and an implementation object.
/// </summary>
[Obsolete("This is no longer necessary, after switching to User.VerifyPassword(password) instead.")]
public readonly Dictionary<string, Func<HashAlgorithm>> HashTypes = new Dictionary<string, Func<HashAlgorithm>>
{
{"sha512", () => new SHA512Managed()},
{"sha256", () => new SHA256Managed()},
{"md5", () => new MD5Cng()},
{"sha512-xp", () => SHA512.Create()},
{"sha256-xp", () => SHA256.Create()},
{"md5-xp", () => MD5.Create()},
};
/// <summary>
/// Returns a Sha256 string for a given string
/// </summary>
/// <param name="bytes">bytes to hash</param>
/// <returns>string sha256</returns>
[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<HashAlgorithm> 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"));
}
}
/// <summary>
/// Returns a Sha256 string for a given string
/// </summary>
/// <param name="password">string to hash</param>
/// <returns>string sha256</returns>
[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));
}
/// <summary>
/// Checks if the string contains any unprintable characters
/// </summary>
/// <param name="str">String to check</param>
/// <returns>True if the string only contains printable characters</returns>
[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;
}
/// <summary>
/// Checks if world has hit the max number of chests
/// </summary>
@ -916,23 +842,6 @@ namespace TShockAPI
return 1000;
}
/// <summary>
/// Sanitizes input strings
/// </summary>
/// <param name="str">string</param>
/// <returns>sanitized string</returns>
[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);
}
/// <summary>
/// Enumerates boundary points of the given region's rectangle.
/// </summary>