Remove ban immunity at the command level.

Ban immunity will be managed when a ban is validated
This commit is contained in:
Chris 2020-11-29 14:26:25 +10:30
parent c71cf79125
commit 3e6cdb3c71
2 changed files with 8 additions and 14 deletions

View file

@ -1452,12 +1452,6 @@ namespace TShockAPI
var player = players[0];
if (player.HasPermission(Permissions.immunetoban))
{
args.Player.SendErrorMessage("That player is immune to bans.");
return;
}
string banReason = null;
void DoBan(string ident)
{
@ -1478,23 +1472,23 @@ namespace TShockAPI
{
if (player.Account != null)
{
DoBan($"{Identifiers.Account}{player.Account.Name}");
DoBan($"{Identifier.Account}{player.Account.Name}");
}
}
if (banUuid)
{
DoBan($"{Identifiers.UUID}{player.UUID}");
DoBan($"{Identifier.UUID}{player.UUID}");
}
if (banName)
{
DoBan($"{Identifiers.Name}{player.Name}");
DoBan($"{Identifier.Name}{player.Name}");
}
if (banIp)
{
DoBan($"{Identifiers.IP}{player.IP}");
DoBan($"{Identifier.IP}{player.IP}");
}
//Using the ban reason to determine if a ban actually happened or not is messy, but it works

View file

@ -1636,13 +1636,13 @@ namespace TShockAPI
{
if (!ConnectionAlive)
return true;
if (force || !HasPermission(Permissions.immunetoban))
if (force)
{
TShock.Bans.InsertBan($"{Identifiers.IP}{IP}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan($"{Identifiers.IP}{UUID}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan($"{Identifier.IP}{IP}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan($"{Identifier.IP}{UUID}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
if (Account != null)
{
TShock.Bans.InsertBan($"{Identifiers.Account}{Account.Name}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
TShock.Bans.InsertBan($"{Identifier.Account}{Account.Name}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
}
Disconnect(string.Format("Banned: {0}", reason));