Added Config option for Rest spam.

This commit is contained in:
Zack Piispanen 2013-10-01 01:06:41 -04:00
parent 545709e845
commit 811a98bb4c
4 changed files with 8 additions and 4 deletions

View file

@ -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;
/// <summary>
/// Reads a configuration file from a given path
/// </summary>

View file

@ -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;

View file

@ -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;
}

View file

@ -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);