diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8b81bb18..a4a2a203 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,6 +69,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Removed `Utils.ActivePlayers()` -- use `TShock.Players.Length` instead. (@hakusaro)
* Moved `Utils.Kick()` to `TSPlayer` since its first argument was a `TSPlayer` object. (@hakusaro)
* Removed `Utils.ForceKick()`. (@hakusaro)
+* Replaced `Utils.ForceKickAll()` with `TSPlayer.KickAll`. (@hakusaro)
## TShock 4.3.25
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index bb94688a..d40d362e 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -110,6 +110,22 @@ namespace TShockAPI
return found;
}
+ ///
+ /// Disconnects all players from the server without checking for immunetokick permission.
+ ///
+ /// If the kick should bypass permission checks.
+ /// The reason for the kick.
+ public static void KickAll(bool force, string reason)
+ {
+ foreach (TSPlayer player in TShock.Players)
+ {
+ if (player != null && player.Active)
+ {
+ player.Kick(reason, force, true, null, true);
+ }
+ }
+ }
+
///
/// The amount of tiles that the player has killed in the last second.
///
diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs
index 0f4d724a..3daebc79 100644
--- a/TShockAPI/Utils.cs
+++ b/TShockAPI/Utils.cs
@@ -496,21 +496,6 @@ namespace TShockAPI
return GetPrefixByName(idOrName);
}
- ///
- /// Kicks all player from the server without checking for immunetokick permission.
- ///
- /// string reason
- public void ForceKickAll(string reason)
- {
- foreach (TSPlayer player in TShock.Players)
- {
- if (player != null && player.Active)
- {
- player.Kick(reason, true, true, null, true);
- }
- }
- }
-
///
/// Stops the server after kicking all players with a reason message, and optionally saving the world
///
@@ -520,12 +505,10 @@ namespace TShockAPI
{
TShock.ShuttingDown = true;
- ForceKickAll(reason);
if (save)
SaveManager.Instance.SaveWorld();
- // Save takes a while so kick again
- ForceKickAll(reason);
+ TSPlayer.KickAll(true, reason);
// Broadcast so console can see we are shutting down as well
TShock.Utils.Broadcast(reason, Color.Red);