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

@ -2986,6 +2986,31 @@ namespace TShockAPI
} }
break; 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": case "help":
default: default:
{ {
@ -2996,24 +3021,27 @@ namespace TShockAPI
if (!PaginationTools.TryParsePageNumber(args.Parameters, pageParamIndex, args.Player, out pageNumber)) if (!PaginationTools.TryParsePageNumber(args.Parameters, pageParamIndex, args.Player, out pageNumber))
return; return;
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 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.",
"resize [region] [u/d/l/r] [amount] - Resizes a region.",
"allow [user] [region] - Allows a user to a region.",
"remove [user] [region] - Removes a user from a region.",
"allowg [group] [region] - Allows a user group to a region.",
"removeg [group] [region] - Removes a user group from a region.",
"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( PaginationTools.SendPage(
args.Player, pageNumber, new[] args.Player, pageNumber, lines,
{
"set [1/2] - Sets the temporary region points.",
"clear - Clears the temporary region points.",
"define [name] - Defines the region.",
"delete [name] - Deletes the given region.",
"name - Shows the name of the region at the given point.",
"list - Lists all regions.",
"resize [region] [u/d/l/r] [amount] - Resizes a region.",
"allow [user] [region] - Allows a user to a region.",
"remove [user] [region] - Removes a user from a region.",
"allowg [group] [region] - Allows a user group to a region.",
"removeg [group] [region] - Removes a user group from a region.",
"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.",
},
new PaginationTools.Settings new PaginationTools.Settings
{ {
HeaderFormat = "Available Region Sub-Commands ({0}/{1}):", HeaderFormat = "Available Region Sub-Commands ({0}/{1}):",