From b88d1f562fc1423b5bf1c80c856e9fd089371bab Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 15:48:27 -0400
Subject: [PATCH 1/8] Add player count support for MOTD
---
TShockAPI/TSPlayer.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 25e61612..12ba09ad 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1528,6 +1528,7 @@ namespace TShockAPI
foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName));
foo = foo.Replace("%players%", String.Join(",", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
+ foo = foo.Replace("%playercount%", String.Join("/", TShock.Utils.GetActivePlayerCount(), TShock.Config.MaxSlots));
SendMessage(foo, lineColor);
}
From 2dc887266d26c88e6dded7eb2227e015750615c6 Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 15:50:02 -0400
Subject: [PATCH 2/8] Add player count
---
TShockAPI/FileTools.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs
index a9608c4e..d58aeab5 100644
--- a/TShockAPI/FileTools.cs
+++ b/TShockAPI/FileTools.cs
@@ -29,7 +29,7 @@ namespace TShockAPI
public class FileTools
{
private const string MotdFormat =
- "Welcome to [c/ffff00:%map%] on [c/7ddff8:T][c/81dbf6:S][c/86d7f4:h][c/8ad3f3:o][c/8ecef1:c][c/93caef:k] for [c/55d284:T][c/62d27a:e][c/6fd16f:r][c/7cd165:r][c/89d15a:a][c/95d150:r][c/a4d145:i][c/b1d03b:a].\n[c/FFFFFF:Online player(s):] [c/FFFF00:%players%]\nType [c/55D284:%specifier%][c/62D27A:h][c/6FD16F:e][c/7CD165:l][c/89D15A:p] for a list of commands.\n";
+ "Welcome to [c/ffff00:%map%] on [c/7ddff8:T][c/81dbf6:S][c/86d7f4:h][c/8ad3f3:o][c/8ecef1:c][c/93caef:k] for [c/55d284:T][c/62d27a:e][c/6fd16f:r][c/7cd165:r][c/89d15a:a][c/95d150:r][c/a4d145:i][c/b1d03b:a].\n[c/FFFFFF:Online players (%playercount%):] [c/FFFF00:%players%]\nType [c/55D284:%specifier%][c/62D27A:h][c/6FD16F:e][c/7CD165:l][c/89D15A:p] for a list of commands.\n";
///
/// Path to the file containing the rules.
///
From b8b86a42fd23db72cf56e89b43f031eb4ca431fd Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 15:51:14 -0400
Subject: [PATCH 3/8] Add space after comma so names look less clustered
---
TShockAPI/TSPlayer.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 12ba09ad..87ecb5d0 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1526,7 +1526,7 @@ namespace TShockAPI
}
foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName));
- foo = foo.Replace("%players%", String.Join(",", players));
+ foo = foo.Replace("%players%", String.Join(", ", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
foo = foo.Replace("%playercount%", String.Join("/", TShock.Utils.GetActivePlayerCount(), TShock.Config.MaxSlots));
From 7e479ea39649db758bf9a0766b6d36b9124c7169 Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 15:57:00 -0400
Subject: [PATCH 4/8] Update CHANGELOG.md
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85d31e64..da5d0369 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Correct rejection message in LandGolfBallInCupHandler to output the proper expected player id. (@drunderscore)
* Clarified the error mesage that the console is presented if a rate-limit is reached over REST to indicate that "tokens" actually refers to rate-limit tokens, and not auth tokens, and added a hint as to what config setting determines this. (@hakusaro, @patsore)
* Fixed an issue where, when the console was redirected, input was disabled and commands didn't work, in TSAPI. You can now pass `-disable-commands` to disable the input thread, but by default, it will be enabled. Fixes [#1450](https://github.com/Pryaxis/TShock/issues/1450). (@DeathCradle, @QuiCM)
+* Added online player count support `%playercount%` for MOTD. The default MOTD message was also updated to use this. (@moisterrific)
## TShock 4.5.4
* Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri)
From 1e9804a13d8f1dff0898c3bd9b8f0f998fdedd27 Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 16:12:36 -0400
Subject: [PATCH 5/8] Separate current player count and max server slots
---
TShockAPI/TSPlayer.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 87ecb5d0..3bfaffb1 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1528,7 +1528,8 @@ namespace TShockAPI
foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName));
foo = foo.Replace("%players%", String.Join(", ", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
- foo = foo.Replace("%playercount%", String.Join("/", TShock.Utils.GetActivePlayerCount(), TShock.Config.MaxSlots));
+ foo = foo.Replace("%onlineplayers%", Convert.ToString(TShock.Utils.GetActivePlayerCount()));
+ foo = foo.Replace("%serverslots%", Convert.ToString(TShock.Config.Settings.MaxSlots));
SendMessage(foo, lineColor);
}
From 89695c39650276a01f19375a0d620a2e3657fc5b Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 16:13:51 -0400
Subject: [PATCH 6/8] separate online players / max slots in stock MOTD
---
TShockAPI/FileTools.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs
index d58aeab5..a3d6c1c2 100644
--- a/TShockAPI/FileTools.cs
+++ b/TShockAPI/FileTools.cs
@@ -29,7 +29,7 @@ namespace TShockAPI
public class FileTools
{
private const string MotdFormat =
- "Welcome to [c/ffff00:%map%] on [c/7ddff8:T][c/81dbf6:S][c/86d7f4:h][c/8ad3f3:o][c/8ecef1:c][c/93caef:k] for [c/55d284:T][c/62d27a:e][c/6fd16f:r][c/7cd165:r][c/89d15a:a][c/95d150:r][c/a4d145:i][c/b1d03b:a].\n[c/FFFFFF:Online players (%playercount%):] [c/FFFF00:%players%]\nType [c/55D284:%specifier%][c/62D27A:h][c/6FD16F:e][c/7CD165:l][c/89D15A:p] for a list of commands.\n";
+ "Welcome to [c/ffff00:%map%] on [c/7ddff8:T][c/81dbf6:S][c/86d7f4:h][c/8ad3f3:o][c/8ecef1:c][c/93caef:k] for [c/55d284:T][c/62d27a:e][c/6fd16f:r][c/7cd165:r][c/89d15a:a][c/95d150:r][c/a4d145:i][c/b1d03b:a].\n[c/FFFFFF:Online players (%onlineplayers%/%serverslots%):] [c/FFFF00:%players%]\nType [c/55D284:%specifier%][c/62D27A:h][c/6FD16F:e][c/7CD165:l][c/89D15A:p] for a list of commands.\n";
///
/// Path to the file containing the rules.
///
From fabea62d96eb3b3e5083e6a5ef7fa7761a4fb8e9 Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Thu, 15 Jul 2021 16:16:19 -0400
Subject: [PATCH 7/8] Update CHANGELOG.md
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index da5d0369..b7507aad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,7 +29,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Correct rejection message in LandGolfBallInCupHandler to output the proper expected player id. (@drunderscore)
* Clarified the error mesage that the console is presented if a rate-limit is reached over REST to indicate that "tokens" actually refers to rate-limit tokens, and not auth tokens, and added a hint as to what config setting determines this. (@hakusaro, @patsore)
* Fixed an issue where, when the console was redirected, input was disabled and commands didn't work, in TSAPI. You can now pass `-disable-commands` to disable the input thread, but by default, it will be enabled. Fixes [#1450](https://github.com/Pryaxis/TShock/issues/1450). (@DeathCradle, @QuiCM)
-* Added online player count support `%playercount%` for MOTD. The default MOTD message was also updated to use this. (@moisterrific)
+* Added `%onlineplayers%` and `%serverslots%` placeholders for MOTD. The default MOTD message was also updated to use this. (@moisterrific, @bartico6)
## TShock 4.5.4
* Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri)
From d61ebb4111d6871f945607464224a177bb5e6586 Mon Sep 17 00:00:00 2001
From: stacey <57187883+moisterrific@users.noreply.github.com>
Date: Fri, 16 Jul 2021 12:20:13 -0400
Subject: [PATCH 8/8] Update TSPlayer.cs
---
TShockAPI/TSPlayer.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 3bfaffb1..47dea08b 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1528,8 +1528,8 @@ namespace TShockAPI
foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName));
foo = foo.Replace("%players%", String.Join(", ", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
- foo = foo.Replace("%onlineplayers%", Convert.ToString(TShock.Utils.GetActivePlayerCount()));
- foo = foo.Replace("%serverslots%", Convert.ToString(TShock.Config.Settings.MaxSlots));
+ foo = foo.Replace("%onlineplayers%", TShock.Utils.GetActivePlayerCount().ToString());
+ foo = foo.Replace("%serverslots%", TShock.Config.Settings.MaxSlots.ToString());
SendMessage(foo, lineColor);
}