From 63179deaa57b06429623a1b2673645fd2c80d9f7 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 9 Dec 2017 15:54:51 -0700 Subject: [PATCH] Adds /dumpdata which dumps the permission table & ref data. --- TShockAPI/Commands.cs | 12 ++++++++++++ TShockAPI/Permissions.cs | 3 +++ TShockAPI/Utils.cs | 1 - 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 592177cf..d682c8e6 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -616,6 +616,10 @@ namespace TShockAPI { HelpText = "Sends a PM to a player." }); + add(new Command(Permissions.createdumps, CreateDumps, "datadump") + { + HelpText = "Creates a reference tables for Terraria data types and the TShock permission system in the server folder." + }); #endregion add(new Command(Aliases, "aliases") @@ -5178,6 +5182,14 @@ namespace TShockAPI args.Player.SendErrorMessage("No command or command alias matching \"{0}\" found.", givenCommandName); } + private static void CreateDumps(CommandArgs args) + { + TShock.Utils.DumpPermissionMatrix("PermissionMatrix.txt"); + TShock.Utils.Dump(); + args.Player.SendSuccessMessage("Your reference dumps have been created in the server folder."); + return; + } + #endregion General Commands #region Cheat Commands diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 37340e48..a02b3ff7 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -103,6 +103,9 @@ namespace TShockAPI [Description("User can get other users' info.")] public static readonly string userinfo = "tshock.admin.userinfo"; + [Description("User can create reference files of Terraria IDs and the permission matrix in the server folder.")] + public static readonly string createdumps = "tshock.admin.createdumps"; + // tshock.buff nodes [Description("User can buff self.")] diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 050515a6..b899276a 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -1204,7 +1204,6 @@ namespace TShockAPI Permissions.DumpDescriptions(); ServerSideCharacters.ServerSideConfig.DumpDescriptions(); RestManager.DumpDescriptions(); - DumpPermissionMatrix("PermissionMatrix.txt"); DumpBuffs("BuffList.txt"); DumpItems("Items-1_0.txt", -48, 235); DumpItems("Items-1_1.txt", 235, 604);