From 4011ee5bc9a8e04bea2ef9c4deb1ce16b9b2bc14 Mon Sep 17 00:00:00 2001 From: MarioE Date: Mon, 11 Nov 2013 00:05:02 -0500 Subject: [PATCH] Add months, fix whitespace in command quotes --- TShockAPI/Commands.cs | 2 +- TShockAPI/TShock.cs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 8f45542f..7f0db088 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -618,7 +618,7 @@ namespace TShockAPI sb.Clear(); } } - else if (IsWhiteSpace(c)) + else if (IsWhiteSpace(c) && !instr) { if (sb.Length > 0) { diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b436040c..1fa93ad8 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -957,14 +957,20 @@ namespace TShockAPI else { TimeSpan ts = exp - DateTime.UtcNow; - if (ts.Days > 0) + int months = ts.Days / 30; + if (months > 0) { - player.Disconnect(String.Format("You are banned for {0} day{1}, {2} hour{3}: {4}", + player.Disconnect(String.Format("You are banned for {0} month{1} and {2} day{3}: {4}", + months, months == 1 ? "" : "s", ts.Days, ts.Days == 1 ? "" : "s", ban.Reason)); + } + else if (ts.Days > 0) + { + player.Disconnect(String.Format("You are banned for {0} day{1} and {2} hour{3}: {4}", ts.Days, ts.Days == 1 ? "": "s", ts.Hours, ts.Hours == 1 ? "" : "s", ban.Reason)); } else if (ts.Hours > 0) { - player.Disconnect(String.Format("You are banned for {0} hour{1}, {2} minute{3}: {4}", + player.Disconnect(String.Format("You are banned for {0} hour{1} and {2} minute{3}: {4}", ts.Hours, ts.Hours == 1 ? "" : "s", ts.Minutes, ts.Minutes == 1 ? "" : "s", ban.Reason)); } else