Fixed /tphere saying the wrong text

More work on region fuck
This commit is contained in:
Lucas Nicodemus 2011-07-14 03:00:19 -06:00
parent a9eee56be4
commit 9e012b3327
2 changed files with 8 additions and 32 deletions

View file

@ -978,7 +978,7 @@ namespace TShockAPI
var plr = players[0];
if (plr.Teleport(args.Player.TileX, args.Player.TileY + 3))
{
plr.SendMessage(string.Format("You were teleported to {0}.", plr.Name));
plr.SendMessage(string.Format("You were teleported to {0}.", args.Player.Name));
args.Player.SendMessage(string.Format("You brought {0} here.", plr.Name));
}

View file

@ -170,45 +170,21 @@ namespace TShockAPI.DB
public bool InProtectedArea(int X, int Y, User user) //This whole thing is dumb
{
try
Rectangle r = new Rectangle(X, Y, 0, 0);
for (int i = 0; i < RegionArray.Length; i++)
{
using (var com = database.CreateCommand())
if (RegionArray[i].RegionArea.Intersects(r))
{
com.CommandText = "SELECT * FROM Regions WHERE WorldID=@worldid";
com.AddParameter("@worldid", Main.worldID.ToString());
using (var reader = com.ExecuteReader())
for (int j = 0; j < RegionArray[i].RegionAllowedIDs.Length; j++)
{
while (reader.Read())
if (RegionArray[i].RegionAllowedIDs[j] == user.Name)
{
int X1 = reader.Get<int>("X1");
int Y1 = reader.Get<int>("Y1");
int height = reader.Get<int>("height");
int width = reader.Get<int>("width");
int Protected = reader.Get<int>("Protected");
string MergedIDs = DbExt.Get<string>(reader, "UserIds");
string[] SplitIDs = MergedIDs.Split(',');
if (X >= X1 &&
X <= height &&
Y >= Y1 &&
Y <= width &&
Protected == 1)
{
if (!SplitIDs.Contains(user.ID.ToString()))
return true;
}
return true;
}
reader.Close();
}
}
return false;
}
catch (Exception ex)
{
Log.Error(ex.ToString());
return false;
}
return false;
}
public static List<string> ListIDs(string MergedIDs)