Commands /region list and /warp list now work
Regions now use User ID's for /region allow (can be IP or Username/password based ID) Minor Tweaks A reset of your database is recommended
This commit is contained in:
parent
cb7033d89c
commit
243b0297b9
6 changed files with 156 additions and 28 deletions
|
|
@ -137,8 +137,45 @@ namespace TShockAPI.DB
|
|||
}
|
||||
catch (SqliteExecutionException ex)
|
||||
{
|
||||
|
||||
}
|
||||
return Tools.GetGroup("default");
|
||||
}
|
||||
|
||||
public string GetUserID(string username = "", string IP = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var com = database.CreateCommand())
|
||||
{
|
||||
if (username != "" && username != null)
|
||||
{
|
||||
com.CommandText = "SELECT * FROM Users WHERE Username=@name";
|
||||
com.AddParameter("@name", username);
|
||||
}
|
||||
else if (IP != "" && IP != null)
|
||||
{
|
||||
com.CommandText = "SELECT * FROM Users WHERE IP=@ip";
|
||||
com.AddParameter("@ip", IP);
|
||||
}
|
||||
else
|
||||
return "0";
|
||||
|
||||
using (var reader = com.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
string ID = reader.Get<string>("ID");
|
||||
return ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SqliteExecutionException ex)
|
||||
{
|
||||
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue