Fixes #1169 on MySQL
This commit is contained in:
parent
02e317436e
commit
8bf58dedf4
1 changed files with 10 additions and 3 deletions
|
|
@ -140,11 +140,18 @@ namespace TShockAPI.DB
|
|||
"INSERT INTO Regions (X1, Y1, width, height, RegionName, WorldID, UserIds, Protected, Groups, Owner, Z) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10);",
|
||||
tx, ty, width, height, regionname, worldid, "", 1, "", owner, z);
|
||||
int id;
|
||||
using (QueryResult res = database.QueryReader("SELECT Id FROM Regions WHERE RegionName = '@0' AND WorldID = '@1'", regionname, worldid))
|
||||
using (QueryResult res = database.QueryReader("SELECT Id FROM Regions WHERE RegionName = @0 AND WorldID = @1", regionname, worldid))
|
||||
{
|
||||
id = res.Get<int>("Id");
|
||||
if (res.Read())
|
||||
{
|
||||
id = res.Get<int>("Id");
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var region = new Region(id, new Rectangle(tx, ty, width, height), regionname, owner, true, worldid, z);
|
||||
Region region = new Region(id, new Rectangle(tx, ty, width, height), regionname, owner, true, worldid, z);
|
||||
Regions.Add(region);
|
||||
Hooks.RegionHooks.OnRegionCreated(region);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue