diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 542d3367..a5203995 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1371,7 +1371,7 @@ namespace TShockAPI } targetGeneralizedName = target.Name; - success = TShock.Bans.AddBan2(target.IP, target.Name, target.UUID, target.Account.Name, banReason, false, args.Player.Account.Name, + success = TShock.Bans.AddBan(target.IP, target.Name, target.UUID, target.Account.Name, banReason, false, args.Player.Account.Name, banLengthInSeconds == 0 ? "" : DateTime.UtcNow.AddSeconds(banLengthInSeconds).ToString("s")); // Since this is an online ban, we need to dc the player and tell them now. @@ -1401,7 +1401,7 @@ namespace TShockAPI Regex r = new Regex(pattern, RegexOptions.IgnoreCase); if (r.IsMatch(args.Parameters[1])) { targetGeneralizedName = "IP: " + args.Parameters[1]; - success = TShock.Bans.AddBan2(args.Parameters[1], "", "", "", banReason, + success = TShock.Bans.AddBan(args.Parameters[1], "", "", "", banReason, false, args.Player.Account.Name, banLengthInSeconds == 0 ? "" : DateTime.UtcNow.AddSeconds(banLengthInSeconds).ToString("s")); if (success && offlineUserAccount != null) { @@ -1449,7 +1449,7 @@ namespace TShockAPI string lastIP = JsonConvert.DeserializeObject>(offlineUserAccount.KnownIps).Last(); success = - TShock.Bans.AddBan2(lastIP, + TShock.Bans.AddBan(lastIP, "", offlineUserAccount.UUID, offlineUserAccount.Name, banReason, false, args.Player.Account.Name, banLengthInSeconds == 0 ? "" : DateTime.UtcNow.AddSeconds(banLengthInSeconds).ToString("s")); } diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 7ee0fa29..53a258d2 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -205,24 +205,7 @@ namespace TShockAPI.DB /// If set to true enable throwing exceptions. /// Banner. /// Expiration date. - [Obsolete("Use AddBan2 instead of AddBan.", true)] - public bool AddBan(string ip, string name = "", string uuid = "", string reason = "", bool exceptions = false, string banner = "", string expiration = "") - { - return AddBan2(ip, name, uuid, "", reason, exceptions, banner, expiration); - } - - /// - /// Adds a ban. - /// - /// true, if ban was added, false otherwise. - /// Ip. - /// Name. - /// UUID. - /// Reason. - /// If set to true enable throwing exceptions. - /// Banner. - /// Expiration date. - public bool AddBan2(string ip, string name = "", string uuid = "", string accountName = "", string reason = "", bool exceptions = false, string banner = "", string expiration = "") + public bool AddBan(string ip, string name = "", string uuid = "", string accountName = "", string reason = "", bool exceptions = false, string banner = "", string expiration = "") { try { diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index 636e0407..f9f1308e 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -624,7 +624,7 @@ namespace TShockAPI try { - TShock.Bans.AddBan2(ip, name, "", "", args.Parameters["reason"], true, args.TokenData.Username); + TShock.Bans.AddBan(ip, name, "", "", args.Parameters["reason"], true, args.TokenData.Username); } catch (Exception e) { @@ -1001,7 +1001,7 @@ namespace TShockAPI TSPlayer player = (TSPlayer)ret; var reason = null == args.Parameters["reason"] ? "Banned via web" : args.Parameters["reason"]; - TShock.Bans.AddBan2(player.IP, player.Name, "", "", reason); + TShock.Bans.AddBan(player.IP, player.Name, "", "", reason); TShock.Utils.ForceKick(player, reason, false, true); return RestResponse("Player " + player.Name + " was banned"); } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 1f101e90..6c4cc5fd 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -475,7 +475,7 @@ namespace TShockAPI { // A user just signed in successfully despite being banned by account name. // We should fix the ban database so that all of their ban info is up to date. - Bans.AddBan2(args.Player.IP, args.Player.Name, args.Player.UUID, args.Player.Account.Name, + Bans.AddBan(args.Player.IP, args.Player.Name, args.Player.UUID, args.Player.Account.Name, potentialBan.Reason, false, potentialBan.BanningUser, potentialBan.Expiration); // And then get rid of them. diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 6809710b..5ebe7de6 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -651,7 +651,7 @@ namespace TShockAPI string ip = player.IP; string uuid = player.UUID; string playerName = player.Name; - TShock.Bans.AddBan2(ip, playerName, uuid, "", reason, false, adminUserName); + TShock.Bans.AddBan(ip, playerName, uuid, "", reason, false, adminUserName); player.Disconnect(string.Format("Banned: {0}", reason)); string verb = force ? "force " : ""; if (string.IsNullOrWhiteSpace(adminUserName))