diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 9079f3e1..c032da71 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -267,7 +267,9 @@ namespace TShockAPI [Description("The maximum value that a character may have for health.")] public int MaxMana = 400; - [Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20; + [Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20; + + [Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public bool LogRest = false; /// /// Reads a configuration file from a given path /// diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 8330ce8e..0f55cd5d 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -306,7 +306,7 @@ namespace TShockAPI var sb = new StringBuilder(); foreach (var field in typeof(Permissions).GetFields().OrderBy(f => f.Name)) { - var name = field.Name; + var name = (string)field.GetValue(null); var descattr = field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute; diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs index 1d827a35..32a5328c 100644 --- a/TShockAPI/Rest/Rest.cs +++ b/TShockAPI/Rest/Rest.cs @@ -196,8 +196,10 @@ namespace Rests protected virtual object ExecuteCommand(RestCommand cmd, RestVerbs verbs, IParameterCollection parms) { object result = cmd.Execute(verbs, parms); - if (cmd.DoLog) + if (cmd.DoLog && TShock.Config.LogRest) + { Log.ConsoleInfo("Anonymous requested REST endpoint: " + BuildRequestUri(cmd, verbs, parms, false)); + } return result; } diff --git a/TShockAPI/Rest/SecureRest.cs b/TShockAPI/Rest/SecureRest.cs index a3257f18..7e8496b4 100644 --- a/TShockAPI/Rest/SecureRest.cs +++ b/TShockAPI/Rest/SecureRest.cs @@ -192,7 +192,7 @@ namespace Rests } object result = secureCmd.Execute(verbs, parms, tokenData); - if (cmd.DoLog) + if (cmd.DoLog && TShock.Config.LogRest) TShock.Utils.SendLogs(string.Format( "\"{0}\" requested REST endpoint: {1}", tokenData.Username, this.BuildRequestUri(cmd, verbs, parms, false)), Color.PaleVioletRed);