Added basic framework for allowing for ban durations and banning admin.
Added BanningUser, Date(of ban), and Expiration to the db On join, Expiration is checked, if ban is expired we remove it and the user is allowed on. When running the ban command, your UAN is used as the banning user, and the date is that moment, with no expiration. #531
This commit is contained in:
parent
222042cc4d
commit
856def83b3
6 changed files with 75 additions and 22 deletions
|
|
@ -785,9 +785,14 @@ namespace TShockAPI
|
|||
|
||||
if (ban != null)
|
||||
{
|
||||
Utils.ForceKick(player, string.Format("You are banned: {0}", ban.Reason), true, false);
|
||||
handler.Handled = true;
|
||||
return;
|
||||
if (!Utils.HasBanExpired(ban))
|
||||
{
|
||||
DateTime exp;
|
||||
string duration = DateTime.TryParse(ban.Expiration, out exp) ? String.Format("until {0}", exp.ToString("G")) : "forever";
|
||||
Utils.ForceKick(player, string.Format("You are banned {0}: {1}", duration, ban.Reason), true, false);
|
||||
handler.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!FileTools.OnWhitelist(player.IP))
|
||||
|
|
@ -838,9 +843,13 @@ namespace TShockAPI
|
|||
|
||||
if (ban != null)
|
||||
{
|
||||
Utils.ForceKick(player, string.Format("You are banned: {0}", ban.Reason), true, false);
|
||||
handler.Handled = true;
|
||||
return;
|
||||
if (!Utils.HasBanExpired(ban))
|
||||
{
|
||||
DateTime exp;
|
||||
string duration = DateTime.TryParse(ban.Expiration, out exp) ? String.Format("until {0}", exp.ToString("G")) : "forever";
|
||||
Utils.ForceKick(player, string.Format("You are banned {0}: {1}", duration, ban.Reason), true, false);
|
||||
handler.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue