Merge commit 'e3dc989387' into general-devel

This commit is contained in:
Deathmax 2011-08-20 12:15:56 +08:00
commit fd26ed0fb1

View file

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml; using System.Xml;
@ -56,7 +57,7 @@ namespace TShockAPI.DB
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public void ImportOld() public void ImportOld()
{ {
String file = Path.Combine(TShock.SavePath, "regions.xml"); String file = Path.Combine(TShock.SavePath, "regions.xml");
@ -255,6 +256,10 @@ namespace TShockAPI.DB
public bool AddRegion(int tx, int ty, int width, int height, string regionname, string worldid) public bool AddRegion(int tx, int ty, int width, int height, string regionname, string worldid)
{ {
if (TShock.Regions.getRegion(regionname) == null)
{
return false;
}
try try
{ {
database.Query("INSERT INTO Regions (X1, Y1, width, height, RegionName, WorldID, UserIds, Protected) VALUES (@0, @1, @2, @3, @4, @5, @6, @7);", database.Query("INSERT INTO Regions (X1, Y1, width, height, RegionName, WorldID, UserIds, Protected) VALUES (@0, @1, @2, @3, @4, @5, @6, @7);",