From 8521241ab7477e977a8efe26bcfe1b9caaa0b18b Mon Sep 17 00:00:00 2001 From: Zidonuke Date: Wed, 28 Dec 2011 23:12:05 -0500 Subject: [PATCH] Fix slots bug --- TShockAPI/ConfigFile.cs | 3 +++ TShockAPI/TShock.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs index 97711b48..e9940942 100644 --- a/TShockAPI/ConfigFile.cs +++ b/TShockAPI/ConfigFile.cs @@ -132,6 +132,9 @@ namespace TShockAPI [Description("String that is used when kicking people when the server is full.")] public string ServerFullReason = "Server is full"; + [Description("String that is used when kicking people when the server is full with no reserved slots.")] + public string ServerFullNoReservedReason = "Server is full. No reserved slots open."; + [Description("This will save the world if Terraria crashes from an unhandled exception.")] public bool SaveWorldOnCrash = true; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index a2ed9927..d1c21d43 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -549,9 +549,9 @@ namespace TShockAPI player.Group = Users.GetGroupForIP(player.IP); } - if (TShock.Utils.ActivePlayers() + 20 > Config.MaxSlots) + if (TShock.Utils.ActivePlayers() + 1 > Config.MaxSlots + 20) { - TShock.Utils.ForceKick(player, Config.ServerFullReason); + TShock.Utils.ForceKick(player, Config.ServerFullNoReservedReason); handler.Handled = true; return; }