Fix hard/mediumcore ban on death
Removed the force parameter since it is of no use.
This commit is contained in:
parent
3d7ba2b2d5
commit
d6caeb15cc
2 changed files with 15 additions and 19 deletions
|
|
@ -4157,7 +4157,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (shouldBan)
|
if (shouldBan)
|
||||||
{
|
{
|
||||||
if (!args.Player.Ban(banReason, false, "TShock"))
|
if (!args.Player.Ban(banReason, "TShock"))
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerKillMeV2 kicked with difficulty {0} {1}", args.Player.Name, args.TPlayer.difficulty);
|
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerKillMeV2 kicked with difficulty {0} {1}", args.Player.Name, args.TPlayer.difficulty);
|
||||||
args.Player.Kick("You died! Normally, you'd be banned.", true, true);
|
args.Player.Kick("You died! Normally, you'd be banned.", true, true);
|
||||||
|
|
|
||||||
|
|
@ -1701,30 +1701,26 @@ namespace TShockAPI
|
||||||
/// Bans and disconnects the player from the server.
|
/// Bans and disconnects the player from the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reason">The reason to be displayed to the server.</param>
|
/// <param name="reason">The reason to be displayed to the server.</param>
|
||||||
/// <param name="force">If the ban should bypass immunity to ban checks.</param>
|
|
||||||
/// <param name="adminUserName">The player who initiated the ban.</param>
|
/// <param name="adminUserName">The player who initiated the ban.</param>
|
||||||
public bool Ban(string reason, bool force = false, string adminUserName = null)
|
public bool Ban(string reason, string adminUserName = null)
|
||||||
{
|
{
|
||||||
if (!ConnectionAlive)
|
if (!ConnectionAlive)
|
||||||
return true;
|
return true;
|
||||||
if (force)
|
|
||||||
{
|
|
||||||
TShock.Bans.InsertBan($"{Identifier.IP}{IP}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
|
|
||||||
TShock.Bans.InsertBan($"{Identifier.UUID}{UUID}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
|
|
||||||
if (Account != null)
|
|
||||||
{
|
|
||||||
TShock.Bans.InsertBan($"{Identifier.Account}{Account.Name}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
Disconnect(string.Format("Banned: {0}", reason));
|
TShock.Bans.InsertBan($"{Identifier.IP}{IP}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
|
||||||
string verb = force ? "force " : "";
|
TShock.Bans.InsertBan($"{Identifier.UUID}{UUID}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
|
||||||
if (string.IsNullOrWhiteSpace(adminUserName))
|
if (Account != null)
|
||||||
TSPlayer.All.SendInfoMessage("{0} was {1}banned for '{2}'.", Name, verb, reason);
|
{
|
||||||
else
|
TShock.Bans.InsertBan($"{Identifier.Account}{Account.Name}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue);
|
||||||
TSPlayer.All.SendInfoMessage("{0} {1}banned {2} for '{3}'.", adminUserName, verb, Name, reason);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
Disconnect(string.Format("Banned: {0}", reason));
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(adminUserName))
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} was banned for '{1}'.", Name, reason);
|
||||||
|
else
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} banned {1} for '{2}'.", adminUserName, Name, reason);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue