From e3dc9893879b75550d3e1874f1ca50c7608c44d1 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 19 Aug 2011 21:35:56 -0600 Subject: [PATCH] Fixed #86 RegionManager now returns false on GetRegionByName if the region already exists in the database. Fixed coding convention fuckup ReSharper code cleanup --- TShockAPI/DB/RegionManager.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index 07a159b4..5fb74e28 100644 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -19,6 +19,7 @@ along with this program. If not, see . using System; using System.Collections.Generic; using System.Data; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; 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() { 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) { + if (TShock.Regions.getRegion(regionname) == null) + { + return false; + } try { database.Query("INSERT INTO Regions (X1, Y1, width, height, RegionName, WorldID, UserIds, Protected) VALUES (@0, @1, @2, @3, @4, @5, @6, @7);",