Fix warps
This commit is contained in:
parent
a9ef5d9b6d
commit
3405acd15b
5 changed files with 16 additions and 15 deletions
|
|
@ -27,11 +27,14 @@ namespace TShockAPI.DB
|
|||
{
|
||||
public class RegionManager
|
||||
{
|
||||
/// <summary>
|
||||
/// The list of regions.
|
||||
/// </summary>
|
||||
public List<Region> Regions = new List<Region>();
|
||||
|
||||
private IDbConnection database;
|
||||
|
||||
public RegionManager(IDbConnection db)
|
||||
internal RegionManager(IDbConnection db)
|
||||
{
|
||||
database = db;
|
||||
var table = new SqlTable("Regions",
|
||||
|
|
@ -52,11 +55,12 @@ namespace TShockAPI.DB
|
|||
? (IQueryBuilder) new SqliteQueryCreator()
|
||||
: new MysqlQueryCreator());
|
||||
creator.EnsureExists(table);
|
||||
|
||||
ReloadAllRegions();
|
||||
}
|
||||
|
||||
public void ReloadAllRegions()
|
||||
/// <summary>
|
||||
/// Reloads all regions.
|
||||
/// </summary>
|
||||
public void Reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace TShockAPI.DB
|
|||
public List<Warp> Warps = new List<Warp>();
|
||||
|
||||
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
|
||||
public WarpManager(IDbConnection db)
|
||||
internal WarpManager(IDbConnection db)
|
||||
{
|
||||
database = db;
|
||||
|
||||
|
|
@ -51,8 +51,6 @@ namespace TShockAPI.DB
|
|||
? (IQueryBuilder) new SqliteQueryCreator()
|
||||
: new MysqlQueryCreator());
|
||||
creator.EnsureExists(table);
|
||||
|
||||
ReloadWarps();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -95,7 +93,7 @@ namespace TShockAPI.DB
|
|||
Warps.Add(new Warp(
|
||||
new Point(reader.Get<int>("X"), reader.Get<int>("Y")),
|
||||
reader.Get<string>("WarpName"),
|
||||
reader.Get<string>("Private") != "0"));
|
||||
(reader.Get<string>("Private") ?? "0") != "0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,7 +162,7 @@ namespace TShockAPI.DB
|
|||
/// <param name="warpName">The warp name.</param>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <returns>Whether the operation suceeded.</returns>
|
||||
public bool HideWarp(string warpName, bool state)
|
||||
public bool Hide(string warpName, bool state)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue