From a26ad7dce0314c65c047139b9a32411f48162093 Mon Sep 17 00:00:00 2001 From: Stealownz Date: Sun, 4 Jul 2021 17:15:13 +0800 Subject: [PATCH 01/23] Fix SendTileRectHandler not sending tile rect updates to everyone else Fixes #2386 --- CHANGELOG.md | 1 + TShockAPI/Handlers/SendTileRectHandler.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85d31e64..cbfb3a12 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) +* Fixed SendTileRectHandler not sending tile rect updates like Pylons/Mannequins to other clients. (@Stealownz) ## TShock 4.5.4 * Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri) diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs index b3955618..b5c0bafd 100644 --- a/TShockAPI/Handlers/SendTileRectHandler.cs +++ b/TShockAPI/Handlers/SendTileRectHandler.cs @@ -85,7 +85,7 @@ namespace TShockAPI.Handlers // At this point we should send our state back to the client so they remain in sync with the server if (args.Handled == true) { - args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); + TSPlayer.All.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); TShock.Log.ConsoleDebug("Bouncer / SendTileRect reimplemented from carbonara from {0}", args.Player.Name); } } From 65bbd80ca63689f2ac5a9448cc7759342044a128 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:33:48 -0400 Subject: [PATCH 02/23] Add perm check for EoL + Sundial ForceTime check If the player does not have permission to summon bosses, they should not be able to kill Prismatic Lacewing, which summons the Empress of Light. Using the Enchanted Sundial while ForceTime is set to day or night (via config) will conflict with TShock's continued attempts to set it back to day or night, this makes the world appear very glitchy. --- TShockAPI/GetDataHandlers.cs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index e92d19a9..dfb4467a 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2809,10 +2809,17 @@ namespace TShockAPI { args.Player.SendErrorMessage("You do not have permission to hurt Town NPCs."); args.Player.SendData(PacketTypes.NpcUpdate, "", id); - TShock.Log.ConsoleDebug("GetDataHandlers / HandleNpcStrike rejected npc strike {0}", args.Player.Name); + TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected npc strike {args.Player.Name}"); + return true; + } + + if (Main.npc[id].netID == NPCID.EmpressButterfly && !args.Player.HasPermission(Permissions.summonboss)) + { + args.Player.SendErrorMessage("You do not have permission to summon the Empress of Light."); + args.Player.SendData(PacketTypes.NpcUpdate, "", id); + TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected EoL summon from {args.Player.Name}"); return true; } - return false; } @@ -3201,11 +3208,20 @@ namespace TShockAPI return true; } - if (type == 3 && !args.Player.HasPermission(Permissions.usesundial)) + if (type == 3) { - TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpecial rejected enchanted sundial permission {0}", args.Player.Name); - args.Player.SendErrorMessage("You do not have permission to use the Enchanted Sundial."); - return true; + if (!args.Player.HasPermission(Permissions.usesundial)) + { + TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission {args.Player.Name}"); + args.Player.SendErrorMessage("You do not have permission to use the Enchanted Sundial."); + return true; + } + else if (TShock.Config.Settings.ForceTime != "normal") + { + TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission (ForceTime) { args.Player.Name}"); + args.Player.SendErrorMessage($"You must set ForceTime to normal via config to use the Enchanted Sundial."); + return true; + } } return false; From dd9067a50ab420d1bf92cf1a385af4cc06d600d4 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:38:34 -0400 Subject: [PATCH 03/23] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85d31e64..b77fdf94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ 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 `summonboss` permission check for Prismatic Lacewing. Players who do not have said permission will be unable to kill this critter, as it will summon the Empress of Light. (@moisterrific) +* Added `ForceTime` config setting check for Enchanted Sundial usage. If `ForceTime` is set to anything other than `normal`, Sundial use will be rejected as this would lead to very janky game behavior. (@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 ef603f61a860df671074025624f4e92bb13adb3a Mon Sep 17 00:00:00 2001 From: James Puleo Date: Fri, 9 Jul 2021 17:27:41 -0400 Subject: [PATCH 04/23] Consistently use `TilePlacementValid` and `SendTileSquare` in Bouncer. There are 3 different ways Bouncer uses these: - Not checking `TilePlacementValid` at all. - Checking `TilePlacementValid`, rejecting, but then doing a `SendTileSquare` to that player. - Checking `TilePlacementValid`, rejecting. _(this is what we should always be doing)_ Not checking `TilePlacementValid` can allow for placement outside of the world (unknown results), and checking `TilePlacementValid` and sending a `SendTileSquare` on rejection causes the server to try to frame that square. In the case of invalid coordinates (negative), framing takes much longer than expected. --- CHANGELOG.md | 1 + TShockAPI/Bouncer.cs | 51 ++++++++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85d31e64..9a3902b4 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) +* Properly sanitize packet tile coordinates that coulbe used to DoS attack a server. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/TShock/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) ## TShock 4.5.4 * Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 42cc6cd1..60737a7f 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -260,6 +260,13 @@ namespace TShockAPI try { + if (!TShock.Utils.TilePlacementValid(tileX, tileY)) + { + TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (tile placement valid) {0} {1} {2}", args.Player.Name, action, editData); + args.Handled = true; + return; + } + if (editData < 0 || ((action == EditAction.PlaceTile || action == EditAction.ReplaceTile) && editData >= Main.maxTileSets) || ((action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && editData >= Main.maxWallTypes)) @@ -270,14 +277,6 @@ namespace TShockAPI return; } - if (!TShock.Utils.TilePlacementValid(tileX, tileY)) - { - TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (tile placement valid) {0} {1} {2}", args.Player.Name, action, editData); - args.Player.SendTileSquare(tileX, tileY, 1); - args.Handled = true; - return; - } - if (action == EditAction.KillTile && Main.tile[tileX, tileY].type == TileID.MagicalIceBlock) { TShock.Log.ConsoleDebug("Bouncer / OnTileEdit super accepted from (ice block) {0} {1} {2}", args.Player.Name, action, editData); @@ -1654,6 +1653,13 @@ namespace TShockAPI short type = args.Type; short style = args.Style; + if (!TShock.Utils.TilePlacementValid(x, y)) + { + TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected valid placements from {0}", args.Player.Name); + args.Handled = true; + return; + } + if (type < 0 || type >= Main.maxTileSets) { TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected out of bounds tile from {0}", args.Player.Name); @@ -1702,14 +1708,6 @@ namespace TShockAPI return; } - if (!TShock.Utils.TilePlacementValid(x, y)) - { - TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected valid placements from {0}", args.Player.Name); - args.Player.SendTileSquare(x, y, 1); - args.Handled = true; - return; - } - if (args.Player.Dead && TShock.Config.Settings.PreventDeadModification) { TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected dead people don't do things from {0}", args.Player.Name); @@ -1801,6 +1799,13 @@ namespace TShockAPI /// The packet arguments that the event has. internal void OnPlaceTileEntity(object sender, GetDataHandlers.PlaceTileEntityEventArgs args) { + if (!TShock.Utils.TilePlacementValid(args.X, args.Y)) + { + TShock.Log.ConsoleDebug("Bouncer / OnPlaceTileEntity rejected tile placement valid from {0}", args.Player.Name); + args.Handled = true; + return; + } + if (args.Player.IsBeingDisabled()) { TShock.Log.ConsoleDebug("Bouncer / OnPlaceTileEntity rejected disabled from {0}", args.Player.Name); @@ -1828,6 +1833,13 @@ namespace TShockAPI /// The packet arguments that the event has. internal void OnPlaceItemFrame(object sender, GetDataHandlers.PlaceItemFrameEventArgs args) { + if (!TShock.Utils.TilePlacementValid(args.X, args.Y)) + { + TShock.Log.ConsoleDebug("Bouncer / OnPlaceItemFrame rejected tile placement valid from {0}", args.Player.Name); + args.Handled = true; + return; + } + if (args.Player.IsBeingDisabled()) { TShock.Log.ConsoleDebug("Bouncer / OnPlaceItemFrame rejected disabled from {0}", args.Player.Name); @@ -2129,6 +2141,13 @@ namespace TShockAPI /// internal void OnFoodPlatterTryPlacing(object sender, GetDataHandlers.FoodPlatterTryPlacingEventArgs args) { + if (!TShock.Utils.TilePlacementValid(args.TileX, args.TileY)) + { + TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected tile placement valid from {0}", args.Player.Name); + args.Handled = true; + return; + } + if ((args.Player.SelectedItem.type != args.ItemID && args.Player.ItemInHand.type != args.ItemID)) { TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected item not placed by hand from {0}", args.Player.Name); From 2a6bc51dd686688c364b805f0fcbc6421c5ed4c2 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sun, 11 Jul 2021 23:11:28 -0400 Subject: [PATCH 05/23] Change EoL summon to be more consistent w/ config now this should be more in line with how other boss summons are currently handled, also made the sundial user messages better thx to quake's suggestions --- TShockAPI/GetDataHandlers.cs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index dfb4467a..ed701f2f 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2813,12 +2813,21 @@ namespace TShockAPI return true; } - if (Main.npc[id].netID == NPCID.EmpressButterfly && !args.Player.HasPermission(Permissions.summonboss)) + if (Main.npc[id].netID == NPCID.EmpressButterfly) { - args.Player.SendErrorMessage("You do not have permission to summon the Empress of Light."); - args.Player.SendData(PacketTypes.NpcUpdate, "", id); - TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected EoL summon from {args.Player.Name}"); - return true; + if (!args.Player.HasPermission(Permissions.summonboss)) + { + args.Player.SendErrorMessage("You do not have permission to summon the Empress of Light."); + args.Player.SendData(PacketTypes.NpcUpdate, "", id); + TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected EoL summon from {args.Player.Name}"); + return true; + } + else if (!TShock.Config.Settings.AnonymousBossInvasions) + { + TShock.Utils.Broadcast(string.Format($"{args.Player.Name} summoned the Empress of Light!"), 175, 75, 255); + } + else + TShock.Utils.SendLogs(string.Format($"{args.Player.Name} summoned the Empress of Light!"), Color.PaleVioletRed, args.Player); } return false; } @@ -3214,14 +3223,18 @@ namespace TShockAPI { TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission {args.Player.Name}"); args.Player.SendErrorMessage("You do not have permission to use the Enchanted Sundial."); - return true; } else if (TShock.Config.Settings.ForceTime != "normal") { - TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission (ForceTime) { args.Player.Name}"); - args.Player.SendErrorMessage($"You must set ForceTime to normal via config to use the Enchanted Sundial."); - return true; + TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission (ForceTime) {args.Player.Name}"); + if (!args.Player.HasPermission(Permissions.cfgreload)) + { + args.Player.SendErrorMessage("You cannot use the Enchanted Sundial because time is stopped."); + } + else + args.Player.SendErrorMessage("You must set ForceTime to normal via config to use the Enchanted Sundial."); } + return true; } return false; From 0316f9d502e3e5f90b5af83dfbfda39b8a6f63fb Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sun, 11 Jul 2021 23:22:31 -0400 Subject: [PATCH 06/23] update change log again --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b77fdf94..c7649d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,8 +29,8 @@ 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 `summonboss` permission check for Prismatic Lacewing. Players who do not have said permission will be unable to kill this critter, as it will summon the Empress of Light. (@moisterrific) -* Added `ForceTime` config setting check for Enchanted Sundial usage. If `ForceTime` is set to anything other than `normal`, Sundial use will be rejected as this would lead to very janky game behavior. (@moisterrific) +* Added `summonboss` permission check for Prismatic Lacewing. Players who do not have said permission will be unable to kill this critter, as it will summon the Empress of Light. Also added support for the `AnonymousBossInvasions` config option, if this is set to `false` it will now broadcast the name of the player who summoned her. (@moisterrific) +* Added `ForceTime` config setting check for Enchanted Sundial usage. If `ForceTime` is set to anything other than `normal`, Sundial use will be rejected as this would lead to very janky game behavior. Additionally, players with `cfgreload` permission will be advised to change it back to `normal` in order to use sundial. (@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 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 07/23] 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 08/23] 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 09/23] 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 10/23] 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 11/23] 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 12/23] 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 13/23] 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 14/23] 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); } From 154bee58f1fd8304ec9065dd92754debb490bbe9 Mon Sep 17 00:00:00 2001 From: Killia0 Date: Fri, 16 Jul 2021 14:53:37 -0400 Subject: [PATCH 15/23] Typo fixes on comments/strings My first PR contribution to TShock is spellcheck huh, frankly I don't know why but hey I could spare the time for this and caught some stuff. --- TShockAPI/Bouncer.cs | 2 +- TShockAPI/Commands.cs | 10 +++++----- TShockAPI/DB/GroupManager.cs | 4 ++-- TShockAPI/DB/RegionManager.cs | 10 +++++----- TShockAPI/DB/RememberedPosManager.cs | 2 +- TShockAPI/DB/UserManager.cs | 2 +- TShockAPI/DB/WarpsManager.cs | 6 +++--- TShockAPI/GetDataHandlers.cs | 10 +++++----- TShockAPI/Group.cs | 2 +- TShockAPI/Handlers/NetModules/PylonHandler.cs | 2 +- TShockAPI/ILog.cs | 4 ++-- TShockAPI/Permissions.cs | 2 +- TShockAPI/Rest/RestManager.cs | 4 ++-- TShockAPI/Sockets/LinuxTcpSocket.cs | 2 +- TShockAPI/TSPlayer.cs | 2 +- TShockAPI/TSServerPlayer.cs | 4 ++-- TShockAPI/TShock.cs | 2 +- TShockAPI/Utils.cs | 2 +- 18 files changed, 36 insertions(+), 36 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 42cc6cd1..299ab85b 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1726,7 +1726,7 @@ namespace TShockAPI return; } - // This is neccessary to check in order to prevent special tiles such as + // This is necessary to check in order to prevent special tiles such as // queen bee larva, paintings etc that use this packet from being placed // without selecting the right item. if (type != args.Player.TPlayer.inventory[args.Player.TPlayer.selectedItem].createTile) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index b6ba179f..39ab2cd5 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -50,7 +50,7 @@ namespace TShockAPI public bool Silent { get; private set; } /// - /// Parameters passed to the arguement. Does not include the command name. + /// Parameters passed to the argument. Does not include the command name. /// IE '/kick "jerk face"' will only have 1 argument /// public List Parameters { get; private set; } @@ -939,7 +939,7 @@ namespace TShockAPI } catch (UserAccountManagerException ex) { - args.Player.SendErrorMessage("Sorry, an error occured: " + ex.Message + "."); + args.Player.SendErrorMessage("Sorry, an error occurred: " + ex.Message + "."); TShock.Log.ConsoleError("PasswordUser returned an error: " + ex); } } @@ -1003,7 +1003,7 @@ namespace TShockAPI } catch (UserAccountManagerException ex) { - args.Player.SendErrorMessage("Sorry, an error occured: " + ex.Message + "."); + args.Player.SendErrorMessage("Sorry, an error occurred: " + ex.Message + "."); TShock.Log.ConsoleError("RegisterUser returned an error: " + ex); } } @@ -1216,7 +1216,7 @@ namespace TShockAPI if (DateTime.TryParse(account.LastAccessed, out LastSeen)) { LastSeen = DateTime.Parse(account.LastAccessed).ToLocalTime(); - args.Player.SendSuccessMessage("{0}'s last login occured {1} {2} UTC{3}.", account.Name, LastSeen.ToShortDateString(), + args.Player.SendSuccessMessage("{0}'s last login occurred {1} {2} UTC{3}.", account.Name, LastSeen.ToShortDateString(), LastSeen.ToShortTimeString(), Timezone); } @@ -6472,6 +6472,6 @@ namespace TShockAPI } } - #endregion Cheat Comamnds + #endregion Cheat Commands } } diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 7b3b62dd..3bb50881 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -425,14 +425,14 @@ namespace TShockAPI.DB } catch (Exception ex) { - TShock.Log.Error($"An exception has occured during database transaction: {ex.Message}"); + TShock.Log.Error($"An exception has occurred during database transaction: {ex.Message}"); try { transaction.Rollback(); } catch (Exception rollbackEx) { - TShock.Log.Error($"An exception has occured during database rollback: {rollbackEx.Message}"); + TShock.Log.Error($"An exception has occurred during database rollback: {rollbackEx.Message}"); } } } diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index eaf8f1ba..60ff0ed5 100644 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -168,7 +168,7 @@ namespace TShockAPI.DB } /// - /// Delets the region from this world with a given ID. + /// Deletes the region from this world with a given ID. /// /// The ID of the region to delete. /// Whether the region was successfully deleted. @@ -584,7 +584,7 @@ namespace TShockAPI.DB /// /// Region name /// New owner's username - /// Whether the change was successfull + /// Whether the change was successful public bool ChangeOwner(string regionName, string newOwner) { var region = GetRegionByName(regionName); @@ -604,7 +604,7 @@ namespace TShockAPI.DB /// /// Region name /// Group's name - /// Whether the change was successfull + /// Whether the change was successful public bool AllowGroup(string regionName, string groupName) { string mergedGroups = ""; @@ -646,7 +646,7 @@ namespace TShockAPI.DB /// /// Region name /// Group name - /// Whether the change was successfull + /// Whether the change was successful public bool RemoveGroup(string regionName, string group) { Region r = GetRegionByName(regionName); @@ -688,7 +688,7 @@ namespace TShockAPI.DB /// /// Region name /// New Z index - /// Whether the change was successfull + /// Whether the change was successful public bool SetZ(string name, int z) { try diff --git a/TShockAPI/DB/RememberedPosManager.cs b/TShockAPI/DB/RememberedPosManager.cs index 77fef847..c49c5912 100644 --- a/TShockAPI/DB/RememberedPosManager.cs +++ b/TShockAPI/DB/RememberedPosManager.cs @@ -56,7 +56,7 @@ namespace TShockAPI.DB { int checkX=reader.Get("X"); int checkY=reader.Get("Y"); - //fix leftover inconsistancies + //fix leftover inconsistencies if (checkX==0) checkX++; if (checkY==0) diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs index 2d09ba5a..4fedaaed 100644 --- a/TShockAPI/DB/UserManager.cs +++ b/TShockAPI/DB/UserManager.cs @@ -378,7 +378,7 @@ namespace TShockAPI.DB /// The hashed password for the user account. public string Password { get; internal set; } - /// The user's saved Univerally Unique Identifier token. + /// The user's saved Universally Unique Identifier token. public string UUID { get; set; } /// The group object that the user account is a part of. diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs index a409580e..bd13ce4d 100644 --- a/TShockAPI/DB/WarpsManager.cs +++ b/TShockAPI/DB/WarpsManager.cs @@ -139,7 +139,7 @@ namespace TShockAPI.DB /// The warp name. /// The X position. /// The Y position. - /// Whether the operation suceeded. + /// Whether the operation succeeded. public bool Position(string warpName, int x, int y) { try @@ -163,7 +163,7 @@ namespace TShockAPI.DB /// /// The warp name. /// The state. - /// Whether the operation suceeded. + /// Whether the operation succeeded. public bool Hide(string warpName, bool state) { try @@ -216,4 +216,4 @@ namespace TShockAPI.DB IsPrivate = false; } } -} \ No newline at end of file +} diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index ed701f2f..c675910b 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -346,7 +346,7 @@ namespace TShockAPI /// public Vector2 Velocity { get; set; } /// - /// Original poisition of the player when using Potion of Return. + /// Original position of the player when using Potion of Return. /// public Vector2? OriginalPos { get; set; } /// @@ -770,7 +770,7 @@ namespace TShockAPI { /// The projectile's identity...? public int ProjectileIdentity; - /// The the player index of the projectile's owner (Main.players). + /// The player index of the projectile's owner (Main.players). public byte ProjectileOwner; /// The index of the projectile in Main.projectile. public int ProjectileIndex; @@ -1846,7 +1846,7 @@ namespace TShockAPI /// public byte ID { get; set; } /// - /// The direction the damage is occuring from + /// The direction the damage is occurring from /// public byte Direction { get; set; } /// @@ -1902,7 +1902,7 @@ namespace TShockAPI /// public byte Direction { get; set; } /// - /// Amount of damage delt + /// Amount of damage dealt /// public short Damage { get; set; } /// @@ -1989,7 +1989,7 @@ namespace TShockAPI /// public int Slot { get; set; } /// - /// Wether or not the slot that is being modified is a Dye slot. + /// Whether or not the slot that is being modified is a Dye slot. /// public bool IsDye { get; set; } /// diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs index fa2d1975..ff2ba2e9 100644 --- a/TShockAPI/Group.cs +++ b/TShockAPI/Group.cs @@ -273,7 +273,7 @@ namespace TShockAPI /// /// Clears the permission list and sets it to the list provided, - /// will parse "!permssion" and add it to the negated permissions. + /// will parse "!permission" and add it to the negated permissions. /// /// The new list of permissions to associate with the group. public void SetPermission(List permission) diff --git a/TShockAPI/Handlers/NetModules/PylonHandler.cs b/TShockAPI/Handlers/NetModules/PylonHandler.cs index 7cbe054b..10a30b68 100644 --- a/TShockAPI/Handlers/NetModules/PylonHandler.cs +++ b/TShockAPI/Handlers/NetModules/PylonHandler.cs @@ -11,7 +11,7 @@ namespace TShockAPI.Handlers.NetModules public class PylonHandler : INetModuleHandler { /// - /// Event occuring + /// Event occurring /// public SubPacketType PylonEventType { get; set; } /// diff --git a/TShockAPI/ILog.cs b/TShockAPI/ILog.cs index 9fac3789..4c560f1f 100644 --- a/TShockAPI/ILog.cs +++ b/TShockAPI/ILog.cs @@ -119,7 +119,7 @@ namespace TShockAPI /// Writes a message to the log /// /// Message to write - /// LogLevel assosciated with the message + /// LogLevel associated with the message void Write(string message, TraceLevel level); /// @@ -152,4 +152,4 @@ namespace TShockAPI /// void Dispose(); } -} \ No newline at end of file +} diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 8ce013b8..7df1ca83 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -399,7 +399,7 @@ namespace TShockAPI [Description("User can use Creative UI to set world time speed.")] public static readonly string journey_timespeed = "tshock.journey.time.setspeed"; - [Description("User can use Creative UI to to toggle character godmode.")] + [Description("User can use Creative UI to toggle character godmode.")] public static readonly string journey_godmode = "tshock.journey.godmode"; [Description("User can use Creative UI to set world wind strength/seed.")] diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index 8a88dbb6..6ca9889e 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -1117,7 +1117,7 @@ namespace TShockAPI [Permission(RestPermissions.restmanagegroups)] [Noun("group", true, "The name of the new group.", typeof(String))] [Noun("parent", false, "The name of the parent group.", typeof(String))] - [Noun("permissions", false, "A comma seperated list of permissions for the new group.", typeof(String))] + [Noun("permissions", false, "A comma separated list of permissions for the new group.", typeof(String))] [Noun("chatcolor", false, "A r,g,b string representing the color for this groups chat.", typeof(String))] [Token] private object GroupCreate(RestRequestArgs args) @@ -1142,7 +1142,7 @@ namespace TShockAPI [Noun("group", true, "The name of the group to modify.", typeof(String))] [Noun("parent", false, "The name of the new parent for this group.", typeof(String))] [Noun("chatcolor", false, "The new chat color r,g,b.", typeof(String))] - [Noun("permissions", false, "The new comma seperated list of permissions.", typeof(String))] + [Noun("permissions", false, "The new comma separated list of permissions.", typeof(String))] [Token] private object GroupUpdate(RestRequestArgs args) { diff --git a/TShockAPI/Sockets/LinuxTcpSocket.cs b/TShockAPI/Sockets/LinuxTcpSocket.cs index 98892c42..5a95794b 100644 --- a/TShockAPI/Sockets/LinuxTcpSocket.cs +++ b/TShockAPI/Sockets/LinuxTcpSocket.cs @@ -200,7 +200,7 @@ namespace TShockAPI.Sockets this._listener.Stop(); // currently vanilla will stop listening when the slots are full, however it appears that this Netplay.IsListening - // flag is still set, making the server loop beleive it's still listening when it's actually not. + // flag is still set, making the server loop believe it's still listening when it's actually not. // clearing this flag when we actually have stopped will allow the ServerLoop to start listening again when // there are enough slots available. Netplay.IsListening = false; diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 47dea08b..afde7cef 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1018,7 +1018,7 @@ namespace TShockAPI } /// - /// Player Y cooridnate divided by 16. Supposed Y world coordinate. + /// Player Y coordinate divided by 16. Supposed Y world coordinate. /// public int TileY { diff --git a/TShockAPI/TSServerPlayer.cs b/TShockAPI/TSServerPlayer.cs index 09642f59..9f59da49 100644 --- a/TShockAPI/TSServerPlayer.cs +++ b/TShockAPI/TSServerPlayer.cs @@ -182,12 +182,12 @@ namespace TShockAPI public void RevertTiles(Dictionary tiles) { - // Update Main.Tile first so that when tile sqaure is sent it is correct + // Update Main.Tile first so that when tile square is sent it is correct foreach (KeyValuePair entry in tiles) { Main.tile[(int)entry.Key.X, (int)entry.Key.Y] = entry.Value; } - // Send all players updated tile sqaures + // Send all players updated tile squares foreach (Vector2 coords in tiles.Keys) { All.SendTileSquare((int)coords.X, (int)coords.Y, 3); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index ed74b882..c743a7d7 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1614,7 +1614,7 @@ namespace TShockAPI } /// OnProjectileSetDefaults - Called when a projectile sets the default attributes for itself. - /// e - The SetDefaultsEventArgs object praameterized with Projectile and int. + /// e - The SetDefaultsEventArgs object parameterized with Projectile and int. private void OnProjectileSetDefaults(SetDefaultsEventArgs e) { //tombstone fix. diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 23007b19..92d45299 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -141,7 +141,7 @@ namespace TShockAPI } /// - /// Broadcasts a message from a Terraria playerplayer, not TShock + /// Broadcasts a message from a Terraria player, not TShock /// /// ply - the Terraria player index that will send the packet /// msg - The message to send From 6ad57ba51710a99e86166c8e934a0c8f9a19d9e5 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Jul 2021 18:14:46 -0700 Subject: [PATCH 16/23] Fix changelog typos --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a3902b4..3ca714dc 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) -* Properly sanitize packet tile coordinates that coulbe used to DoS attack a server. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/TShock/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) +* Properly sanitized packet tile coordinates that could be used to DoS attack a server. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/TShock/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) ## 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 853715cfa7b922de5fec2c014df0dfb45aef8ce8 Mon Sep 17 00:00:00 2001 From: James Puleo Date: Wed, 21 Jul 2021 21:40:44 -0400 Subject: [PATCH 17/23] Update changelog to be _much_ more verbose about GHSA-jq4j-v8pr-jv7j --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ca714dc..35b3788e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,12 @@ 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) -* Properly sanitized packet tile coordinates that could be used to DoS attack a server. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/TShock/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) +* Fixed Bouncer inconsistently using `TilePlacementValid` when validating tile coordinates, which could cause a DoS attack due to unexpectedly large world framing. The list below shows the corrected methods within Bouncer. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/Plugins/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) + * `OnTileEdit`: The check was moved to be the first, and will no longer `SendTileSquare` upon failure. + * `OnPlaceObject`: The check was moved to be the first, and will no longer `SendTileSquare` upon failure. + * `OnPlaceTileEntity`: The check was newly added. + * `OnPlaceItemFrame`: The check was newly added. + * `OnFoodPlatterTryPlacing`: The check was newly added. ## 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 87d5b769c78a8d514af4c45bccd78fc01935af2b Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Jul 2021 18:46:01 -0700 Subject: [PATCH 18/23] Version tick: 4.5.5 --- CHANGELOG.md | 3 +++ TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- TShockAPI/TShock.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ccb7a06..4399f2f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes +* This could be you! + +## TShock 4.5.5 * Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro) * Added `/slay` as an alias for `/kill` to be more consistent with other server mods. (@hakusaro) * Added `/god` as an alias for `/godmode` to be more consistent with other server mods. (@hakusaro) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 819058cb..28c98cd4 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -53,5 +53,5 @@ using System.Runtime.InteropServices; // Also, be sure to release on github with the exact assembly version tag as below // so that the update manager works correctly (via the Github releases api and mimic) -[assembly: AssemblyVersion("4.5.4")] -[assembly: AssemblyFileVersion("4.5.4")] +[assembly: AssemblyVersion("4.5.5")] +[assembly: AssemblyFileVersion("4.5.5")] diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index ed74b882..2114b469 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -58,7 +58,7 @@ namespace TShockAPI /// VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info. public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version; /// VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions. - public static readonly string VersionCodename = "Blood Moon edition"; + public static readonly string VersionCodename = "Olympics maybe?"; /// SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins). public static string SavePath = "tshock"; From 59f7ea02455545b3820edb69bfbcdde834ab37d7 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Jul 2021 19:22:45 -0700 Subject: [PATCH 19/23] I'm seeing things --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4399f2f9..b1a5d203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added `summonboss` permission check for Prismatic Lacewing. Players who do not have said permission will be unable to kill this critter, as it will summon the Empress of Light. Also added support for the `AnonymousBossInvasions` config option, if this is set to `false` it will now broadcast the name of the player who summoned her. (@moisterrific) * Added `ForceTime` config setting check for Enchanted Sundial usage. If `ForceTime` is set to anything other than `normal`, Sundial use will be rejected as this would lead to very janky game behavior. Additionally, players with `cfgreload` permission will be advised to change it back to `normal` in order to use sundial. (@moisterrific, @bartico6) * Added `%onlineplayers%` and `%serverslots%` placeholders for MOTD. The default MOTD message was also updated to use this. (@moisterrific, @bartico6) -* Fixed Bouncer inconsistently using `TilePlacementValid` when validating tile coordinates, which could cause a DoS attack due to unexpectedly large world framing. The list below shows the corrected methods within Bouncer. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/Plugins/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) +* Fixed Bouncer inconsistently using `TilePlacementValid` when validating tile coordinates, which could cause a DoS attack due to unexpectedly large world framing. The list below shows the corrected methods within Bouncer. This was assigned [GHSA-jq4j-v8pr-jv7j](https://github.com/Pryaxis/TShock/security/advisories/GHSA-jq4j-v8pr-jv7j). (@drunderscore) * `OnTileEdit`: The check was moved to be the first, and will no longer `SendTileSquare` upon failure. * `OnPlaceObject`: The check was moved to be the first, and will no longer `SendTileSquare` upon failure. * `OnPlaceTileEntity`: The check was newly added. From c71bcc02b94bfd2f28ffff0b40f262c89c80a731 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 24 Jul 2021 16:19:59 -0700 Subject: [PATCH 20/23] Update PR template changelog warning --- .github/PULL_REQUEST_TEMPLATE.md | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4cf87d10..473130c4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,19 +1,3 @@ -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? -?????? HAVE YOU UPDATED THE CHANGELOG? ?????? \ No newline at end of file + From 2a80e22e125c35c6e68426d6c36bfd751ae07df1 Mon Sep 17 00:00:00 2001 From: Killia0 Date: Sat, 24 Jul 2021 19:47:29 -0400 Subject: [PATCH 21/23] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55df643..8d9e18eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes +* Fix some typos that have been in the repository for over a lustrum. (@Killia0) * Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro) * Added `/slay` as an alias for `/kill` to be more consistent with other server mods. (@hakusaro) * Added `/god` as an alias for `/godmode` to be more consistent with other server mods. (@hakusaro) From ba8db77823a15ced1875f110798e5077c61e2d43 Mon Sep 17 00:00:00 2001 From: Killia0 Date: Sat, 24 Jul 2021 20:21:07 -0400 Subject: [PATCH 22/23] Fix changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1434d2c4..73eb4121 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,10 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes -* Fix some typos that have been in the repository for over a lustrum. (@Killia0) * Fixed SendTileRectHandler not sending tile rect updates like Pylons/Mannequins to other clients. (@Stealownz) +* Fix some typos that have been in the repository for over a lustrum. (@Killia0) + +## TShock 4.5.5 * Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro) * Added `/slay` as an alias for `/kill` to be more consistent with other server mods. (@hakusaro) * Added `/god` as an alias for `/godmode` to be more consistent with other server mods. (@hakusaro) From 3ba1e7419d63535eeb8b5634ec668448499f71df Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 24 Jul 2021 17:40:42 -0700 Subject: [PATCH 23/23] Rename game commands region For compliance purposes --- TShockAPI/Commands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 39ab2cd5..cae1ebf3 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5518,7 +5518,7 @@ namespace TShockAPI #endregion General Commands - #region Cheat Commands + #region Game Commands private static void Clear(CommandArgs args) { @@ -6472,6 +6472,6 @@ namespace TShockAPI } } - #endregion Cheat Commands + #endregion Game Commands } }