Removed deprecation messages. This is a new version already.
This commit is contained in:
parent
8ba1aa58ac
commit
a9788f4576
1 changed files with 204 additions and 236 deletions
|
|
@ -16,15 +16,15 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading;
|
||||
using TShockAPI.PluginUpdater;
|
||||
using Terraria;
|
||||
using TShockAPI.DB;
|
||||
|
|
@ -71,16 +71,16 @@ namespace TShockAPI
|
|||
public List<string> Permissions { get; protected set; }
|
||||
|
||||
private CommandDelegate commandDelegate;
|
||||
public CommandDelegate CommandDelegate
|
||||
{
|
||||
get { return commandDelegate; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
commandDelegate = value;
|
||||
}
|
||||
public CommandDelegate CommandDelegate
|
||||
{
|
||||
get { return commandDelegate; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
commandDelegate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Command(List<string> permissionsneeded, CommandDelegate cmd, params string[] names)
|
||||
|
|
@ -154,10 +154,10 @@ namespace TShockAPI
|
|||
public static void InitCommands()
|
||||
{
|
||||
List<Command> tshockCommands = new List<Command>(100);
|
||||
Action<Command> add2 = (cmd) =>
|
||||
{
|
||||
tshockCommands.Add(cmd);
|
||||
ChatCommands.Add(cmd);
|
||||
Action<Command> add2 = (cmd) =>
|
||||
{
|
||||
tshockCommands.Add(cmd);
|
||||
ChatCommands.Add(cmd);
|
||||
};
|
||||
AddChatCommand add = (p, c, n) => add2(new Command(p, c, n));
|
||||
|
||||
|
|
@ -177,7 +177,6 @@ namespace TShockAPI
|
|||
add2(new Command(Permissions.tphere, TPHere, "tphere") { AllowServer = false });
|
||||
add2(new Command(Permissions.tpallow, TPAllow, "tpallow") { AllowServer = false });
|
||||
add(Permissions.kick, Kick, "kick");
|
||||
add(Permissions.ban, DeprecateBans, "banip", "listbans", "unban", "unbanip", "clearbans");
|
||||
add(Permissions.ban, Ban, "ban");
|
||||
add(Permissions.whitelist, Whitelist, "whitelist");
|
||||
add(Permissions.maintenance, Off, "off", "exit");
|
||||
|
|
@ -201,8 +200,6 @@ namespace TShockAPI
|
|||
add(Permissions.spawnboss, Hardcore, "hardcore");
|
||||
add(Permissions.spawnmob, SpawnMob, "spawnmob", "sm");
|
||||
add(Permissions.warp, Warp, "warp");
|
||||
add(Permissions.managewarp, DeprecateWarp, "setwarp", "delwarp", "hidewarp");
|
||||
add(Permissions.tphere, DeprecateWarp, "sendwarp", "sw");
|
||||
add(Permissions.managegroup, AddGroup, "addgroup");
|
||||
add(Permissions.managegroup, DeleteGroup, "delgroup");
|
||||
add(Permissions.managegroup, ModifyGroup, "modgroup");
|
||||
|
|
@ -859,21 +856,10 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
private static void DeprecateBans(CommandArgs args)
|
||||
{
|
||||
args.Player.SendInfoMessage("All ban commands were merged into one in TShock 4.0.");
|
||||
args.Player.SendInfoMessage("Syntax: /ban [option] [arguments]");
|
||||
args.Player.SendInfoMessage("Options: list, listip, clear, add, addip, del, delip");
|
||||
args.Player.SendInfoMessage("Arguments: list, listip, clear [code], add [name], addip [ip], del [name], delip [name]");
|
||||
args.Player.SendInfoMessage("In addition, a reason may be provided for all new bans after the arguments.");
|
||||
return;
|
||||
}
|
||||
|
||||
private static void Ban(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count == 0 || args.Parameters[0].ToLower() == "help")
|
||||
{
|
||||
args.Player.SendInfoMessage("All ban commands were merged into one in TShock 4.0.");
|
||||
args.Player.SendInfoMessage("Syntax: /ban [option] [arguments]");
|
||||
args.Player.SendInfoMessage("Options: list, listip, clear, add, addip, del, delip");
|
||||
args.Player.SendInfoMessage("Arguments: list, listip, clear [code], add [name], addip [ip], del [name], delip [name]");
|
||||
|
|
@ -1181,10 +1167,10 @@ namespace TShockAPI
|
|||
|
||||
public static void OverrideSSI( CommandArgs args )
|
||||
{
|
||||
if (!TShock.Config.ServerSideInventory)
|
||||
{
|
||||
args.Player.SendErrorMessage("Server Side Inventory is disabled.");
|
||||
return;
|
||||
if (!TShock.Config.ServerSideInventory)
|
||||
{
|
||||
args.Player.SendErrorMessage("Server Side Inventory is disabled.");
|
||||
return;
|
||||
}
|
||||
if( args.Parameters.Count < 1 )
|
||||
{
|
||||
|
|
@ -1206,20 +1192,20 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
TSPlayer matchedPlayer = matchedPlayers[0];
|
||||
if (matchedPlayer.IsLoggedIn)
|
||||
{
|
||||
args.Player.SendErrorMessage("Player \"{0}\" is already logged in.", matchedPlayer.Name);
|
||||
return;
|
||||
if (matchedPlayer.IsLoggedIn)
|
||||
{
|
||||
args.Player.SendErrorMessage("Player \"{0}\" is already logged in.", matchedPlayer.Name);
|
||||
return;
|
||||
}
|
||||
if (!matchedPlayer.LoginFailsBySsi)
|
||||
{
|
||||
args.Player.SendErrorMessage("Player \"{0}\" has to perform a /login attempt first.", matchedPlayer.Name);
|
||||
return;
|
||||
if (!matchedPlayer.LoginFailsBySsi)
|
||||
{
|
||||
args.Player.SendErrorMessage("Player \"{0}\" has to perform a /login attempt first.", matchedPlayer.Name);
|
||||
return;
|
||||
}
|
||||
if (matchedPlayer.IgnoreActionsForClearingTrashCan)
|
||||
{
|
||||
args.Player.SendErrorMessage("Player \"{0}\" has to reconnect first.", matchedPlayer.Name);
|
||||
return;
|
||||
if (matchedPlayer.IgnoreActionsForClearingTrashCan)
|
||||
{
|
||||
args.Player.SendErrorMessage("Player \"{0}\" has to reconnect first.", matchedPlayer.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
TShock.InventoryDB.InsertPlayerData(matchedPlayer);
|
||||
|
|
@ -1784,17 +1770,6 @@ namespace TShockAPI
|
|||
args.Player.TPAllow = !args.Player.TPAllow;
|
||||
}
|
||||
|
||||
private static void DeprecateWarp(CommandArgs args)
|
||||
{
|
||||
args.Player.SendInfoMessage("All warp commands were merged into one in TShock 4.0.");
|
||||
args.Player.SendInfoMessage("Previous warps with spaces should be wrapped in single quotes.");
|
||||
args.Player.SendInfoMessage("Invalid syntax. Syntax: /warp [command] [arguments]");
|
||||
args.Player.SendInfoMessage("Commands: add, del, hide, list, send, [warpname]");
|
||||
args.Player.SendInfoMessage("Arguments: add [warp name], del [warp name], list [page]");
|
||||
args.Player.SendInfoMessage("Arguments: send [player] [warp name], hide [warp name] [Enable(true/false)]");
|
||||
args.Player.SendInfoMessage("Examples: /warp add foobar, /warp hide foobar true, /warp foobar");
|
||||
}
|
||||
|
||||
private static void Warp(CommandArgs args)
|
||||
{
|
||||
bool hasManageWarpPermission = args.Player.Group.HasPermission(Permissions.managewarp);
|
||||
|
|
@ -1802,8 +1777,6 @@ namespace TShockAPI
|
|||
{
|
||||
if (hasManageWarpPermission)
|
||||
{
|
||||
args.Player.SendInfoMessage("All warp commands were merged into one in TShock 4.0.");
|
||||
args.Player.SendInfoMessage("Previous warps with spaces should be wrapped in single quotes.");
|
||||
args.Player.SendInfoMessage("Invalid syntax. Syntax: /warp [command] [arguments]");
|
||||
args.Player.SendInfoMessage("Commands: add, del, hide, list, send, [warpname]");
|
||||
args.Player.SendInfoMessage("Arguments: add [warp name], del [warp name], list [page]");
|
||||
|
|
@ -1814,8 +1787,6 @@ namespace TShockAPI
|
|||
else
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid syntax. Syntax: /warp [name] or /warp list <page>");
|
||||
args.Player.SendErrorMessage("Previous warps with spaces should be wrapped in single quotes.");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1896,7 +1867,6 @@ namespace TShockAPI
|
|||
else
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /warp add [name]");
|
||||
#endregion
|
||||
|
||||
}
|
||||
else if (args.Parameters[0].ToLower() == "del" && hasManageWarpPermission)
|
||||
{
|
||||
|
|
@ -1912,7 +1882,6 @@ namespace TShockAPI
|
|||
else
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /warp del [name]");
|
||||
#endregion
|
||||
|
||||
}
|
||||
else if (args.Parameters[0].ToLower() == "hide" && hasManageWarpPermission)
|
||||
{
|
||||
|
|
@ -1976,7 +1945,6 @@ namespace TShockAPI
|
|||
args.Player.SendErrorMessage("Specified warp not found.");
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2830,12 +2798,12 @@ namespace TShockAPI
|
|||
);
|
||||
|
||||
PaginationTools.SendPage(
|
||||
args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(regionNames),
|
||||
new PaginationTools.Settings
|
||||
{
|
||||
HeaderFormat = "List of Regions ({0}/{1})",
|
||||
FooterFormat = "Type /region list {0} for more.",
|
||||
NothingToDisplayString = "There are currently no regions defined."
|
||||
args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(regionNames),
|
||||
new PaginationTools.Settings
|
||||
{
|
||||
HeaderFormat = "List of Regions ({0}/{1})",
|
||||
FooterFormat = "Type /region list {0} for more.",
|
||||
NothingToDisplayString = "There are currently no regions defined."
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -2843,10 +2811,10 @@ namespace TShockAPI
|
|||
}
|
||||
case "info":
|
||||
{
|
||||
if (args.Parameters.Count == 1 || args.Parameters.Count > 4)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /region info <region> [-d] [page]");
|
||||
break;
|
||||
if (args.Parameters.Count == 1 || args.Parameters.Count > 4)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /region info <region> [-d] [page]");
|
||||
break;
|
||||
}
|
||||
|
||||
string regionName = args.Parameters[1];
|
||||
|
|
@ -2866,87 +2834,87 @@ namespace TShockAPI
|
|||
if (!PaginationTools.TryParsePageNumber(args.Parameters, pageNumberIndex, args.Player, out pageNumber))
|
||||
break;
|
||||
|
||||
List<string> lines = new List<string>
|
||||
{
|
||||
string.Format("X: {0}; Y: {1}; W: {2}; H: {3}, Z: {4}", region.Area.X, region.Area.Y, region.Area.Width, region.Area.Height, region.Z),
|
||||
string.Concat("Owner: ", region.Owner),
|
||||
string.Concat("Protected: ", region.DisableBuild.ToString()),
|
||||
List<string> lines = new List<string>
|
||||
{
|
||||
string.Format("X: {0}; Y: {1}; W: {2}; H: {3}, Z: {4}", region.Area.X, region.Area.Y, region.Area.Width, region.Area.Height, region.Z),
|
||||
string.Concat("Owner: ", region.Owner),
|
||||
string.Concat("Protected: ", region.DisableBuild.ToString()),
|
||||
};
|
||||
|
||||
if (region.AllowedIDs.Count > 0)
|
||||
{
|
||||
IEnumerable<string> sharedUsersSelector = region.AllowedIDs.Select(userId =>
|
||||
{
|
||||
if (region.AllowedIDs.Count > 0)
|
||||
{
|
||||
IEnumerable<string> sharedUsersSelector = region.AllowedIDs.Select(userId =>
|
||||
{
|
||||
User user = TShock.Users.GetUserByID(userId);
|
||||
if (user != null)
|
||||
return user.Name;
|
||||
else
|
||||
return string.Concat("{ID: ", userId, "}");
|
||||
});
|
||||
List<string> extraLines = PaginationTools.BuildLinesFromTerms(sharedUsersSelector.Distinct());
|
||||
extraLines[0] = "Shared with: " + extraLines[0];
|
||||
lines.AddRange(extraLines);
|
||||
return string.Concat("{ID: ", userId, "}");
|
||||
});
|
||||
List<string> extraLines = PaginationTools.BuildLinesFromTerms(sharedUsersSelector.Distinct());
|
||||
extraLines[0] = "Shared with: " + extraLines[0];
|
||||
lines.AddRange(extraLines);
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.Add("Region is not shared with any users.");
|
||||
else
|
||||
{
|
||||
lines.Add("Region is not shared with any users.");
|
||||
}
|
||||
|
||||
if (region.AllowedGroups.Count > 0)
|
||||
{
|
||||
List<string> extraLines = PaginationTools.BuildLinesFromTerms(region.AllowedGroups.Distinct());
|
||||
extraLines[0] = "Shared with groups: " + extraLines[0];
|
||||
lines.AddRange(extraLines);
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.Add("Region is not shared with any groups.");
|
||||
if (region.AllowedGroups.Count > 0)
|
||||
{
|
||||
List<string> extraLines = PaginationTools.BuildLinesFromTerms(region.AllowedGroups.Distinct());
|
||||
extraLines[0] = "Shared with groups: " + extraLines[0];
|
||||
lines.AddRange(extraLines);
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.Add("Region is not shared with any groups.");
|
||||
}
|
||||
|
||||
PaginationTools.SendPage(
|
||||
args.Player, pageNumber, lines, new PaginationTools.Settings
|
||||
{
|
||||
HeaderFormat = string.Format("Information About Region \"{0}\" ({{0}}/{{1}}):", region.Name),
|
||||
FooterFormat = "Type /region info {0} for more information."
|
||||
PaginationTools.SendPage(
|
||||
args.Player, pageNumber, lines, new PaginationTools.Settings
|
||||
{
|
||||
HeaderFormat = string.Format("Information About Region \"{0}\" ({{0}}/{{1}}):", region.Name),
|
||||
FooterFormat = "Type /region info {0} for more information."
|
||||
}
|
||||
);
|
||||
|
||||
if (displayBoundaries)
|
||||
{
|
||||
Rectangle regionArea = region.Area;
|
||||
foreach (Point boundaryPoint in Utils.Instance.EnumerateRegionBoundaries(regionArea))
|
||||
{
|
||||
// Preferring dotted lines as those should easily be distinguishable from actual wires.
|
||||
if ((boundaryPoint.X + boundaryPoint.Y & 1) == 0)
|
||||
{
|
||||
// Could be improved by sending raw tile data to the client instead but not really
|
||||
// worth the effort as chances are very low that overwriting the wire for a few
|
||||
// nanoseconds will cause much trouble.
|
||||
Tile tile = Main.tile[boundaryPoint.X, boundaryPoint.Y];
|
||||
bool oldWireState = tile.wire;
|
||||
tile.wire = true;
|
||||
|
||||
try {
|
||||
args.Player.SendTileSquare(boundaryPoint.X, boundaryPoint.Y, 1);
|
||||
} finally {
|
||||
tile.wire = oldWireState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer boundaryHideTimer = null;
|
||||
boundaryHideTimer = new Timer((state) => {
|
||||
foreach (Point boundaryPoint in Utils.Instance.EnumerateRegionBoundaries(regionArea))
|
||||
if ((boundaryPoint.X + boundaryPoint.Y & 1) == 0)
|
||||
args.Player.SendTileSquare(boundaryPoint.X, boundaryPoint.Y, 1);
|
||||
|
||||
// ReSharper disable AccessToModifiedClosure
|
||||
Debug.Assert(boundaryHideTimer != null);
|
||||
boundaryHideTimer.Dispose();
|
||||
// ReSharper restore AccessToModifiedClosure
|
||||
},
|
||||
null, 5000, Timeout.Infinite
|
||||
);
|
||||
if (displayBoundaries)
|
||||
{
|
||||
Rectangle regionArea = region.Area;
|
||||
foreach (Point boundaryPoint in Utils.Instance.EnumerateRegionBoundaries(regionArea))
|
||||
{
|
||||
// Preferring dotted lines as those should easily be distinguishable from actual wires.
|
||||
if ((boundaryPoint.X + boundaryPoint.Y & 1) == 0)
|
||||
{
|
||||
// Could be improved by sending raw tile data to the client instead but not really
|
||||
// worth the effort as chances are very low that overwriting the wire for a few
|
||||
// nanoseconds will cause much trouble.
|
||||
Tile tile = Main.tile[boundaryPoint.X, boundaryPoint.Y];
|
||||
bool oldWireState = tile.wire;
|
||||
tile.wire = true;
|
||||
|
||||
try {
|
||||
args.Player.SendTileSquare(boundaryPoint.X, boundaryPoint.Y, 1);
|
||||
} finally {
|
||||
tile.wire = oldWireState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer boundaryHideTimer = null;
|
||||
boundaryHideTimer = new Timer((state) => {
|
||||
foreach (Point boundaryPoint in Utils.Instance.EnumerateRegionBoundaries(regionArea))
|
||||
if ((boundaryPoint.X + boundaryPoint.Y & 1) == 0)
|
||||
args.Player.SendTileSquare(boundaryPoint.X, boundaryPoint.Y, 1);
|
||||
|
||||
// ReSharper disable AccessToModifiedClosure
|
||||
Debug.Assert(boundaryHideTimer != null);
|
||||
boundaryHideTimer.Dispose();
|
||||
// ReSharper restore AccessToModifiedClosure
|
||||
},
|
||||
null, 5000, Timeout.Infinite
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -3031,67 +2999,67 @@ namespace TShockAPI
|
|||
}
|
||||
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.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;
|
||||
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;
|
||||
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":
|
||||
default:
|
||||
{
|
||||
int pageNumber;
|
||||
int pageParamIndex = 0;
|
||||
if (args.Parameters.Count > 1)
|
||||
pageParamIndex = 1;
|
||||
if (!PaginationTools.TryParsePageNumber(args.Parameters, pageParamIndex, args.Player, out pageNumber))
|
||||
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 [-u][-z][-p] - 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> [-d] - 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}):",
|
||||
FooterFormat = "Type /region {0} for more sub-commands."
|
||||
}
|
||||
);
|
||||
break;
|
||||
case "help":
|
||||
default:
|
||||
{
|
||||
int pageNumber;
|
||||
int pageParamIndex = 0;
|
||||
if (args.Parameters.Count > 1)
|
||||
pageParamIndex = 1;
|
||||
if (!PaginationTools.TryParsePageNumber(args.Parameters, pageParamIndex, args.Player, out pageNumber))
|
||||
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 [-u][-z][-p] - 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> [-d] - 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}):",
|
||||
FooterFormat = "Type /region {0} for more sub-commands."
|
||||
}
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3495,22 +3463,22 @@ namespace TShockAPI
|
|||
|
||||
int amountParamIndex = -1;
|
||||
int itemAmount = 0;
|
||||
for (int i = 1; i < args.Parameters.Count; i++)
|
||||
{
|
||||
if (int.TryParse(args.Parameters[i], out itemAmount))
|
||||
{
|
||||
amountParamIndex = i;
|
||||
break;
|
||||
}
|
||||
for (int i = 1; i < args.Parameters.Count; i++)
|
||||
{
|
||||
if (int.TryParse(args.Parameters[i], out itemAmount))
|
||||
{
|
||||
amountParamIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
string itemNameOrId;
|
||||
if (amountParamIndex == -1)
|
||||
itemNameOrId = string.Join(" ", args.Parameters);
|
||||
else
|
||||
itemNameOrId = string.Join(" ", args.Parameters.Take(amountParamIndex));
|
||||
|
||||
Item item;
|
||||
if (amountParamIndex == -1)
|
||||
itemNameOrId = string.Join(" ", args.Parameters);
|
||||
else
|
||||
itemNameOrId = string.Join(" ", args.Parameters.Take(amountParamIndex));
|
||||
|
||||
Item item;
|
||||
List<Item> matchedItems = TShock.Utils.GetItemByIdOrName(itemNameOrId);
|
||||
if (matchedItems.Count == 0)
|
||||
{
|
||||
|
|
@ -3522,37 +3490,37 @@ namespace TShockAPI
|
|||
args.Player.SendErrorMessage("More than one item matched:");
|
||||
args.Player.SendErrorMessage(string.Join(", ", matchedItems.Select(i => i.name)));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = matchedItems[0];
|
||||
}
|
||||
if (item.type < 1 && item.type >= Main.maxItemTypes)
|
||||
{
|
||||
args.Player.SendErrorMessage("The item type {0} is invalid.", itemNameOrId);
|
||||
return;
|
||||
}
|
||||
|
||||
int prefixId = 0;
|
||||
if (amountParamIndex != -1 && args.Parameters.Count > amountParamIndex + 1)
|
||||
{
|
||||
string prefixidOrName = args.Parameters[amountParamIndex + 1];
|
||||
List<int> matchedPrefixIds = TShock.Utils.GetPrefixByIdOrName(prefixidOrName);
|
||||
if (matchedPrefixIds.Count > 1)
|
||||
{
|
||||
args.Player.SendErrorMessage("More than one ({0}) prefixes matched \"{1}\".", matchedPrefixIds.Count, prefixidOrName);
|
||||
return;
|
||||
}
|
||||
else if (matchedPrefixIds.Count == 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("No prefix matched \"{0}\".", prefixidOrName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
prefixId = matchedPrefixIds[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item = matchedItems[0];
|
||||
}
|
||||
if (item.type < 1 && item.type >= Main.maxItemTypes)
|
||||
{
|
||||
args.Player.SendErrorMessage("The item type {0} is invalid.", itemNameOrId);
|
||||
return;
|
||||
}
|
||||
|
||||
int prefixId = 0;
|
||||
if (amountParamIndex != -1 && args.Parameters.Count > amountParamIndex + 1)
|
||||
{
|
||||
string prefixidOrName = args.Parameters[amountParamIndex + 1];
|
||||
List<int> matchedPrefixIds = TShock.Utils.GetPrefixByIdOrName(prefixidOrName);
|
||||
if (matchedPrefixIds.Count > 1)
|
||||
{
|
||||
args.Player.SendErrorMessage("More than one ({0}) prefixes matched \"{1}\".", matchedPrefixIds.Count, prefixidOrName);
|
||||
return;
|
||||
}
|
||||
else if (matchedPrefixIds.Count == 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("No prefix matched \"{0}\".", prefixidOrName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
prefixId = matchedPrefixIds[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (args.Player.InventorySlotAvailable || item.name.Contains("Coin"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue