Add months, fix whitespace in command quotes

This commit is contained in:
MarioE 2013-11-11 00:05:02 -05:00
parent bc72390bf0
commit 4011ee5bc9
2 changed files with 10 additions and 4 deletions

View file

@ -618,7 +618,7 @@ namespace TShockAPI
sb.Clear(); sb.Clear();
} }
} }
else if (IsWhiteSpace(c)) else if (IsWhiteSpace(c) && !instr)
{ {
if (sb.Length > 0) if (sb.Length > 0)
{ {

View file

@ -957,14 +957,20 @@ namespace TShockAPI
else else
{ {
TimeSpan ts = exp - DateTime.UtcNow; 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)); ts.Days, ts.Days == 1 ? "": "s", ts.Hours, ts.Hours == 1 ? "" : "s", ban.Reason));
} }
else if (ts.Hours > 0) 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)); ts.Hours, ts.Hours == 1 ? "" : "s", ts.Minutes, ts.Minutes == 1 ? "" : "s", ban.Reason));
} }
else else