Removed all obsolete methods from TShock
This commit is contained in:
parent
a8b4bf1d95
commit
a0c4864567
9 changed files with 1 additions and 263 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>();
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue