Added /region tp [region]. Additionally to "manageregion", also requires the "tp" permission.

This commit is contained in:
CoderCow 2013-07-01 16:38:16 +02:00
parent 2789b2fec1
commit 5df31a12a1

View file

@ -2984,6 +2984,31 @@ namespace TShockAPI
args.Player.SendMessage("Invalid syntax! Proper syntax: /region resize [regionname] [u/d/l/r] [amount]1",
Color.Red);
}
break;
}
case "tp":
{
if (!args.Player.Group.HasPermission(Permissions.tp))
{
args.Player.SendErrorMessage("You don't have the necessary permission to do that.");
break;
}
if (args.Parameters.Count <= 1)
{
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /region tp [region].");
break;
}
string regionName = string.Join(" ", args.Parameters.Skip(1));
Region region = TShock.Regions.GetRegionByName(regionName);
if (region == null)
{
args.Player.SendErrorMessage("Region \"{0}\" does not exist.", regionName);
break;
}
args.Player.Teleport(region.Area.Center.X, region.Area.Center.Y + 3);
break;
}
case "help":
@ -2996,12 +3021,10 @@ namespace TShockAPI
if (!PaginationTools.TryParsePageNumber(args.Parameters, pageParamIndex, args.Player, out pageNumber))
return;
PaginationTools.SendPage(
args.Player, pageNumber, new[]
{
List<string> lines = new List<string> {
"set [1/2] - Sets the temporary region points.",
"clear - Clears the temporary region points.",
"define [name] - Defines the region.",
"define [name] - Defines the region with the given name.",
"delete [name] - Deletes the given region.",
"name - Shows the name of the region at the given point.",
"list - Lists all regions.",
@ -3013,7 +3036,12 @@ namespace TShockAPI
"info [region] - Displays several information about the given region.",
"protect [name] [true/false] - Sets whether the tiles inside the region are protected or not.",
"z [name] [#] - Sets the z-order of the region.",
},
};
if (args.Player.Group.HasPermission(Permissions.tp))
lines.Add("tp [region] - Teleports you to the given region's center.");
PaginationTools.SendPage(
args.Player, pageNumber, lines,
new PaginationTools.Settings
{
HeaderFormat = "Available Region Sub-Commands ({0}/{1}):",