Checking whether a point is in a region no longer requires to region to be protected.

Renamed some methods to conform to C# conventions.
This commit is contained in:
White 2015-09-06 18:49:57 +09:30
parent 502afb4e6f
commit 2e5eaae0b3
3 changed files with 13 additions and 14 deletions

View file

@ -232,8 +232,7 @@ namespace TShockAPI.DB
foreach (Region region in Regions.ToList())
{
if (x >= region.Area.Left && x <= region.Area.Right &&
y >= region.Area.Top && y <= region.Area.Bottom &&
region.DisableBuild)
y >= region.Area.Top && y <= region.Area.Bottom)
{
return true;
}
@ -247,8 +246,7 @@ namespace TShockAPI.DB
foreach (Region region in Regions.ToList())
{
if (x >= region.Area.Left && x <= region.Area.Right &&
y >= region.Area.Top && y <= region.Area.Bottom &&
region.DisableBuild)
y >= region.Area.Top && y <= region.Area.Bottom)
{
regions.Add(region.Name);
}
@ -262,8 +260,7 @@ namespace TShockAPI.DB
foreach (Region region in Regions.ToList())
{
if (x >= region.Area.Left && x <= region.Area.Right &&
y >= region.Area.Top && y <= region.Area.Bottom &&
region.DisableBuild)
y >= region.Area.Top && y <= region.Area.Bottom)
{
regions.Add(region);
}
@ -276,7 +273,7 @@ namespace TShockAPI.DB
return MergedIDs.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
}
public bool resizeRegion(string regionName, int addAmount, int direction)
public bool ResizeRegion(string regionName, int addAmount, int direction)
{
//0 = up
//1 = right
@ -390,7 +387,7 @@ namespace TShockAPI.DB
foreach (var r in Regions)
{
if (r.Name == regionName && r.WorldID == Main.worldID.ToString())
r.setAllowedIDs(mergedIDs);
r.SetAllowedIDs(mergedIDs);
}
return q != 0;
}
@ -613,6 +610,10 @@ namespace TShockAPI.DB
public bool HasPermissionToBuildInRegion(TSPlayer ply)
{
if (!DisableBuild)
{
return true;
}
if (!ply.IsLoggedIn)
{
if (!ply.HasBeenNaggedAboutLoggingIn)
@ -622,15 +623,11 @@ namespace TShockAPI.DB
}
return false;
}
if (!DisableBuild)
{
return true;
}
return AllowedIDs.Contains(ply.User.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.User.Name;
}
public void setAllowedIDs(String ids)
public void SetAllowedIDs(String ids)
{
String[] id_arr = ids.Split(',');
List<int> id_list = new List<int>();