From 872b239b47192b75a18e0efc43ae41c3dc197a53 Mon Sep 17 00:00:00 2001 From: James Puleo Date: Wed, 14 Dec 2022 21:41:37 -0500 Subject: [PATCH 01/45] Seed initial group database with `default` and `guest` names from config The `GroupManager` constructor ensures the structure of the `GroupList` table, and if the table is newly-created, then some initial data is seeded. We previously used the names `default` to represent the group that accounts are defaultly registered to, and `guest` to represent players that have not logged in yet. We now instead refer to the group names specified by the config (`DefaultRegistrationGroupName` and `DefaultGuestGroupName` respectively) --- TShockAPI/DB/GroupManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 8e0e3192..ed90a11a 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -57,7 +57,7 @@ namespace TShockAPI.DB if (creator.EnsureTableStructure(table)) { // Add default groups if they don't exist - AddDefaultGroup("guest", "", + AddDefaultGroup(TShock.Config.Settings.DefaultGuestGroupName, "", string.Join(",", Permissions.canbuild, Permissions.canregister, @@ -68,7 +68,7 @@ namespace TShockAPI.DB Permissions.synclocalarea, Permissions.sendemoji)); - AddDefaultGroup("default", "guest", + AddDefaultGroup(TShock.Config.Settings.DefaultRegistrationGroupName, TShock.Config.Settings.DefaultGuestGroupName, string.Join(",", Permissions.warp, Permissions.canchangepassword, @@ -82,7 +82,7 @@ namespace TShockAPI.DB Permissions.magicconch, Permissions.demonconch)); - AddDefaultGroup("vip", "default", + AddDefaultGroup("vip", TShock.Config.Settings.DefaultRegistrationGroupName, string.Join(",", Permissions.reservedslot, Permissions.renamenpc, From 2e8823434c298e3052674add48d54b83fb658cae Mon Sep 17 00:00:00 2001 From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com> Date: Sun, 14 May 2023 10:30:52 +0700 Subject: [PATCH 02/45] Updated the PlayerData constructors. Added a new constructor with a parameter that is responsible for installing TShock items into inventory. The `TSPlayer` parameter was not used, so I labeled the constructor obsolete. --- TShockAPI/PlayerData.cs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/TShockAPI/PlayerData.cs b/TShockAPI/PlayerData.cs index 2a8dd41f..aae27672 100644 --- a/TShockAPI/PlayerData.cs +++ b/TShockAPI/PlayerData.cs @@ -23,6 +23,7 @@ using Terraria.Localization; using Terraria.GameContent.NetModules; using Terraria.Net; using Terraria.ID; +using System; namespace TShockAPI { @@ -63,18 +64,27 @@ namespace TShockAPI public int unlockedSuperCart; public int enabledSuperCart; - public PlayerData(TSPlayer player) + /// + /// Sets the default values for the inventory. + /// + [Obsolete("The player argument is not used.")] + public PlayerData(TSPlayer player) : this(true) { } + + /// + /// Sets the default values for the inventory. + /// + /// Is it necessary to load items from TShock's config + public PlayerData(bool includingStarterInventory = true) { for (int i = 0; i < NetItem.MaxInventory; i++) - { this.inventory[i] = new NetItem(); - } - for (int i = 0; i < TShock.ServerSideCharacterConfig.Settings.StartingInventory.Count; i++) - { - var item = TShock.ServerSideCharacterConfig.Settings.StartingInventory[i]; - StoreSlot(i, item.NetId, item.PrefixId, item.Stack); - } + if (includingStarterInventory) + for (int i = 0; i < TShock.ServerSideCharacterConfig.Settings.StartingInventory.Count; i++) + { + var item = TShock.ServerSideCharacterConfig.Settings.StartingInventory[i]; + StoreSlot(i, item.NetId, item.PrefixId, item.Stack); + } } /// From 763519150a5a4ab4fdca7435cdf0dfa8c3d3e246 Mon Sep 17 00:00:00 2001 From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com> Date: Sun, 14 May 2023 10:33:54 +0700 Subject: [PATCH 03/45] Updated the `PlayerData.StoreSlot` method Removed the ability to call a method when a slot less than 0 is specified. Added an overload that takes `NetItem` in parameters. --- TShockAPI/PlayerData.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/TShockAPI/PlayerData.cs b/TShockAPI/PlayerData.cs index aae27672..b2866eb1 100644 --- a/TShockAPI/PlayerData.cs +++ b/TShockAPI/PlayerData.cs @@ -96,12 +96,22 @@ namespace TShockAPI /// public void StoreSlot(int slot, int netID, byte prefix, int stack) { - if (slot > (this.inventory.Length - 1)) //if the slot is out of range then dont save + StoreSlot(slot, new NetItem(netID, stack, prefix)); + } + + /// + /// Stores an item at the specific storage slot + /// + /// + /// + public void StoreSlot(int slot, NetItem item) + { + if (slot > (this.inventory.Length - 1) || slot < 0) //if the slot is out of range then dont save { return; } - this.inventory[slot] = new NetItem(netID, stack, prefix); + this.inventory[slot] = item; } /// From b184133a7f8594e84bf8dca16d0c1525715477fd Mon Sep 17 00:00:00 2001 From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com> Date: Sun, 14 May 2023 10:43:01 +0700 Subject: [PATCH 04/45] Updated the call to the obsolete constructor `PlayerData` --- TShockAPI/DB/CharacterManager.cs | 2 +- TShockAPI/GetDataHandlers.cs | 4 ++-- TShockAPI/TSPlayer.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index 5a5e13a6..357dc746 100644 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -79,7 +79,7 @@ namespace TShockAPI.DB public PlayerData GetPlayerData(TSPlayer player, int acctid) { - PlayerData playerData = new PlayerData(player); + PlayerData playerData = new PlayerData(false); try { diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 1ef2f4f8..f82b7a8e 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2619,9 +2619,9 @@ namespace TShockAPI private static bool HandleConnecting(GetDataHandlerArgs args) { var account = TShock.UserAccounts.GetUserAccountByName(args.Player.Name);// - args.Player.DataWhenJoined = new PlayerData(args.Player); + args.Player.DataWhenJoined = new PlayerData(false); args.Player.DataWhenJoined.CopyCharacter(args.Player); - args.Player.PlayerData = new PlayerData(args.Player); + args.Player.PlayerData = new PlayerData(false); args.Player.PlayerData.CopyCharacter(args.Player); if (account != null && !TShock.Config.Settings.DisableUUIDLogin) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index ef5c3c22..afbd3176 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1267,7 +1267,7 @@ namespace TShockAPI } } - PlayerData = new PlayerData(this); + PlayerData = new PlayerData(); Group = TShock.Groups.GetGroupByName(TShock.Config.Settings.DefaultGuestGroupName); tempGroup = null; if (tempGroupTimer != null) From 8ccb3c6210077c8ddaf90dcc799ac096a0362b39 Mon Sep 17 00:00:00 2001 From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com> Date: Sun, 14 May 2023 10:43:12 +0700 Subject: [PATCH 05/45] Update changelog.md --- docs/changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 3f64f355..93485b3f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -78,7 +78,9 @@ Use past tense when adding new entries; sign your name off when you add or chang * 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 -Your changes could be here! +* Added a constructor for `TShockAPI.PlayerData` that accepts the `includingStarterInventory` parameter, which is responsible for loading the TShock inventory. +* Declared the constructor `TShockAPI.PlayerData` accepting the argument `TShockAPI.TSPlayer` obsolete. +* Updated the `PlayerData.StoreSlot` method: Added an overload that takes `TShockAPI.NetItem`. ## TShock 5.2 * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK) From ad36e7eeb67024c95891f7dedff989c286c0a0f8 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Tue, 9 Apr 2024 03:43:27 +0000 Subject: [PATCH 06/45] Add permission for Moondial and unrecognized SFX --- TShockAPI/GetDataHandlers.cs | 46 +++++++++++++++++++++++++++++++++--- TShockAPI/Permissions.cs | 3 +++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 1ef2f4f8..2eb9be4f 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3469,8 +3469,12 @@ namespace TShockAPI args.Player.Spawn(PlayerSpawnContext.RecallFromItem); return true; } - - if (type == 3) + else if (type == 2) + { + // Plays SoundID.Item1 + return false; + } + else if (type == 3) { if (!args.Player.HasPermission(Permissions.usesundial)) { @@ -3490,6 +3494,42 @@ namespace TShockAPI return true; } } + else if (type == 4) + { + // Big Mimic Spawn Smoke + return false; + } + else if (type == 5) + { + // Register Kill for Torch God in Bestiary + return false; + } + else if (type == 6) + { + if (!args.Player.HasPermission(Permissions.usemoondial)) + { + TShock.Log.ConsoleDebug(GetString($"GetDataHandlers / HandleSpecial rejected enchanted moondial permission {args.Player.Name}")); + args.Player.SendErrorMessage(GetString("You do not have permission to use the Enchanted Moondial.")); + return true; + } + else if (TShock.Config.Settings.ForceTime != "normal") + { + TShock.Log.ConsoleDebug(GetString($"GetDataHandlers / HandleSpecial rejected enchanted moondial permission (ForceTime) {args.Player.Name}")); + if (!args.Player.HasPermission(Permissions.cfgreload)) + { + args.Player.SendErrorMessage(GetString("You cannot use the Enchanted Moondial because time is stopped.")); + } + else + args.Player.SendErrorMessage(GetString("You must set ForceTime to normal via config to use the Enchanted Moondial.")); + return true; + } + } + else if (!args.Player.HasPermission($"tshock.specialeffects.{type}")) + { + args.Player.SendErrorMessage(GetString("You do not have permission to use this effect.")); + TShock.Log.ConsoleError(GetString("Unrecognized special effect (Packet 51). Please report this to the TShock developers.")); + return true; + } return false; } @@ -3785,7 +3825,7 @@ namespace TShockAPI if (type == 0 && !args.Player.HasPermission(Permissions.rod)) { TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleTeleport rejected rod type {0} {1}", args.Player.Name, type)); - args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD. + args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD. args.Player.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y); // Suggest renaming rod permission unless someone plans to add separate perms for the other 2 tp items. return true; } diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index d7ec7166..6aea9859 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -331,6 +331,9 @@ namespace TShockAPI [Description("Player can use the Enchanted Sundial item.")] public static readonly string usesundial = "tshock.world.time.usesundial"; + [Description("Player can use the Enchanted Moondial item.")] + public static readonly string usemoondial = "tshock.world.time.usemoondial"; + [Description("User can grow plants.")] public static readonly string grow = "tshock.world.grow"; From b0396900cc174d8f6df5a22452f8ce113137ae35 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Tue, 9 Apr 2024 03:46:20 +0000 Subject: [PATCH 07/45] Update changelog --- docs/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 035df8ad..1c3d2766 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -90,6 +90,8 @@ Use past tense when adding new entries; sign your name off when you add or chang * Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace) * Fixed typo in `/gbuff`. (@sgkoishi, #2955) * Rewrote the `.dockerignore` file into a denylist. (@timschumi) +* Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri) +* Added a set of new permissions, `tshock.specialeffects.{type}`, for regulating use of new special effects(Packet 51) which are not yet recognized by TShock. (@Arthri) ## TShock 5.2 * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK) From 1db76035a5255e096f98a08e45ee317f60be5e12 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:03:51 +0000 Subject: [PATCH 08/45] Fix skeletron summon --- TShockAPI/GetDataHandlers.cs | 14 +++++++++----- docs/changelog.md | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 2eb9be4f..755a9ff8 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3462,12 +3462,16 @@ namespace TShockAPI if (OnNPCSpecial(args.Player, args.Data, id, type)) return true; - if (type == 1 && TShock.Config.Settings.DisableDungeonGuardian) + if (type == 1) { - TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpecial rejected type 1 for {0}", args.Player.Name)); - args.Player.SendMessage(GetString("The Dungeon Guardian returned you to your spawn point."), Color.Purple); - args.Player.Spawn(PlayerSpawnContext.RecallFromItem); - return true; + if (!args.Player.HasPermission(Permissions.summonboss)) + { + args.Player.SendErrorMessage(GetString("You do not have permission to summon the Skeletron.")); + TShock.Log.ConsoleDebug(GetString($"GetDataHandlers / HandleNpcStrike rejected Skeletron summon from {args.Player.Name}")); + return true; + } + + return false; } else if (type == 2) { diff --git a/docs/changelog.md b/docs/changelog.md index 1c3d2766..f0e19fd2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -92,6 +92,9 @@ Use past tense when adding new entries; sign your name off when you add or chang * Rewrote the `.dockerignore` file into a denylist. (@timschumi) * Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri) * Added a set of new permissions, `tshock.specialeffects.{type}`, for regulating use of new special effects(Packet 51) which are not yet recognized by TShock. (@Arthri) +* Added check for `tshock.npc.summonboss` permission for Skeletron summoning. (@Arthri) +* Fixed `DisableDungeonGuardian` disabling Skeletron summon instead. The config option is useless as of writing. (@Arthri) +* Added CI for Docker images. (@timschumi) ## TShock 5.2 * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK) From 3295ee7a57801716e102b5c585f6444843c4226d Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:07:50 +0000 Subject: [PATCH 09/45] Remove unnecessary change --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 043558e9..489afcce 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -91,11 +91,11 @@ Use past tense when adding new entries; sign your name off when you add or chang * Fixed bug where when the `UseSqlLogs` config property is true, an empty log file would still get created. (@ZakFahey) * Fixed typo in `/gbuff`. (@sgkoishi, #2955) * Rewrote the `.dockerignore` file into a denylist. (@timschumi) +* Added CI for Docker images. (@timschumi) * Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri) * Added a set of new permissions, `tshock.specialeffects.{type}`, for regulating use of new special effects(Packet 51) which are not yet recognized by TShock. (@Arthri) * Added check for `tshock.npc.summonboss` permission for Skeletron summoning. (@Arthri) * Fixed `DisableDungeonGuardian` disabling Skeletron summon instead. The config option is useless as of writing. (@Arthri) -* Added CI for Docker images. (@timschumi) ## TShock 5.2 * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK) From 060a3e5dfd6dd300af2f02199e4fd2f731c69e48 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Tue, 23 Apr 2024 20:09:08 +0000 Subject: [PATCH 10/45] Remove unnecessary change --- TShockAPI/GetDataHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 755a9ff8..7377c7d1 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3829,7 +3829,7 @@ namespace TShockAPI if (type == 0 && !args.Player.HasPermission(Permissions.rod)) { TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleTeleport rejected rod type {0} {1}", args.Player.Name, type)); - args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD. + args.Player.SendErrorMessage(GetString("You do not have permission to teleport using items.")); // Was going to write using RoD but Hook of Disonnance and Potion of Return both use the same teleport packet as RoD. args.Player.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y); // Suggest renaming rod permission unless someone plans to add separate perms for the other 2 tp items. return true; } From 4c01740177afb64af2be438117d1d33db2a0f941 Mon Sep 17 00:00:00 2001 From: ohayo Date: Sun, 2 Feb 2025 12:08:14 +1000 Subject: [PATCH 11/45] Fix handshake stuff part 2 If the player has requested world data before sending the spawn player packet, they should be at state 3, otherwise they should be at state 1 for skipping it. Just check based on that instead. --- TShockAPI/GetDataHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 8f70fd2c..42bd6401 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2726,7 +2726,7 @@ namespace TShockAPI short numberOfDeathsPVP = args.Data.ReadInt16(); PlayerSpawnContext context = (PlayerSpawnContext)args.Data.ReadByte(); - args.Player.FinishedHandshake = true; + args.Player.FinishedHandshake = args.Player.State == 3; //If the player has requested world data before sending spawn player, this should be set to 3, otherwise it'll be set to 1. if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context)) return true; From 4f2fff050dbbae17d59ff9fc9ddca677665010dd Mon Sep 17 00:00:00 2001 From: ohayo Date: Sun, 2 Feb 2025 12:40:04 +1000 Subject: [PATCH 12/45] Quick bug fix - forgot about respawns + only set handshake once The connection state should NEVER be set to under 3 if the player is fully connected. --- TShockAPI/GetDataHandlers.cs | 3 ++- TShockAPI/TShock.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 42bd6401..c0faf964 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2726,7 +2726,8 @@ namespace TShockAPI short numberOfDeathsPVP = args.Data.ReadInt16(); PlayerSpawnContext context = (PlayerSpawnContext)args.Data.ReadByte(); - args.Player.FinishedHandshake = args.Player.State == 3; //If the player has requested world data before sending spawn player, this should be set to 3, otherwise it'll be set to 1. + if (args.Player.State >= 3 && !args.Player.FinishedHandshake) + args.Player.FinishedHandshake = true; //If the player has requested world data before sending spawn player, this should be equal to or greater than 3, otherwise it'll usually be 1. Also only set this once to remove redundant updates. if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context)) return true; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e984da2f..d88b4403 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1461,7 +1461,8 @@ namespace TShockAPI } } - + TShock.Log.ConsoleInfo($"Setting handshake to false for {tsplr.Name}"); + tsplr.FinishedHandshake = false; // Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object. From b5d546a660907a6eda1bccb82395801a2315e021 Mon Sep 17 00:00:00 2001 From: ohayo Date: Sun, 2 Feb 2025 12:41:35 +1000 Subject: [PATCH 13/45] Remove debug logging (sorry haha) --- TShockAPI/TShock.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index d88b4403..061d05fa 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1461,8 +1461,6 @@ namespace TShockAPI } } - TShock.Log.ConsoleInfo($"Setting handshake to false for {tsplr.Name}"); - tsplr.FinishedHandshake = false; // Fire the OnPlayerLogout hook too, if the player was logged in and they have a TSPlayer object. From 52d1840003c82b83ae2654c4cf97f44a684cc72f Mon Sep 17 00:00:00 2001 From: ohayo Date: Tue, 4 Feb 2025 11:07:10 +1000 Subject: [PATCH 14/45] Packet filtering for those who never finish the handshake This also kicks those who never finish handshaking upon chat now. (To free up the resources a bit I guess?) Before a player finishes the connection handshake, the server will check if it's necessary to send them a packet - it checks against a list of necessary packets like: - ContinueConnecting (Send User Slot), - PlayerSpawnSelf (CompleteConnectionAndSpawn), - WorldInfo (Which the server does a further check if the player is at the appropriate state to be sent the world info) - Status - Disconnection - TileFrameSection & TileSendSection --- TShockAPI/TSPlayer.cs | 28 ++++++++++++++++++++++++++++ TShockAPI/TShock.cs | 1 + 2 files changed, 29 insertions(+) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index cb66649a..cb418b0e 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -2102,6 +2102,28 @@ namespace TShockAPI SendData(PacketTypes.PlayerAddBuff, number: Index, number2: type, number3: time); } + + /// + /// Determines if an outgoing packet is necessary to send to a player before they have finished the connection handshake. + /// + /// The packet type to check against the necessary list. + /// + private bool NecessaryPacket(PacketTypes msgType) + { + List ConnectionPackets = new List() + { + PacketTypes.ContinueConnecting, + PacketTypes.WorldInfo, + PacketTypes.Status, + PacketTypes.Disconnect, + PacketTypes.TileFrameSection, + PacketTypes.TileSendSection, + PacketTypes.PlayerSpawnSelf + }; + + return ConnectionPackets.Contains(msgType); + } + //Todo: Separate this into a few functions. SendTo, SendToAll, etc /// /// Sends data to the player. @@ -2119,6 +2141,12 @@ namespace TShockAPI if (RealPlayer && !ConnectionAlive) return; + if (!NecessaryPacket(msgType) && !FinishedHandshake) + return; + + if (msgType == PacketTypes.WorldInfo && State < 3) //If the player has requested the world data, their state will be 3. + return; + NetMessage.SendData((int)msgType, Index, -1, text == null ? null : NetworkText.FromLiteral(text), number, number2, number3, number4, number5); } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 061d05fa..64f23ec3 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1494,6 +1494,7 @@ namespace TShockAPI if (!tsplr.FinishedHandshake) { + tsplr.Kick(GetString("Your client didn't finish the handshake."), true); args.Handled = true; return; } From fa3c1442741e291c17df08db93da3aa5422c6a82 Mon Sep 17 00:00:00 2001 From: ohayo Date: Tue, 4 Feb 2025 11:28:09 +1000 Subject: [PATCH 15/45] Add necessary packets to a static hashset for further performance boosts title --- TShockAPI/TSPlayer.cs | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index cb418b0e..6569ef01 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -2102,27 +2102,26 @@ namespace TShockAPI SendData(PacketTypes.PlayerAddBuff, number: Index, number2: type, number3: time); } + /// + /// The list of necessary packets to make sure gets through to the player upon connection (before they finish the handshake). + /// + private static readonly HashSet NecessaryPackets = new() + { + PacketTypes.ContinueConnecting, + PacketTypes.WorldInfo, + PacketTypes.Status, + PacketTypes.Disconnect, + PacketTypes.TileFrameSection, + PacketTypes.TileSendSection, + PacketTypes.PlayerSpawnSelf + }; /// /// Determines if an outgoing packet is necessary to send to a player before they have finished the connection handshake. /// /// The packet type to check against the necessary list. - /// - private bool NecessaryPacket(PacketTypes msgType) - { - List ConnectionPackets = new List() - { - PacketTypes.ContinueConnecting, - PacketTypes.WorldInfo, - PacketTypes.Status, - PacketTypes.Disconnect, - PacketTypes.TileFrameSection, - PacketTypes.TileSendSection, - PacketTypes.PlayerSpawnSelf - }; - - return ConnectionPackets.Contains(msgType); - } + /// Whether the packet is necessary for connection or not + private bool NecessaryPacket(PacketTypes msgType) => NecessaryPackets.Contains(msgType); //Todo: Separate this into a few functions. SendTo, SendToAll, etc /// From ff9cb9f8581b0cb4cbb6eb81afcbd2efbe75c5fb Mon Sep 17 00:00:00 2001 From: ohayo Date: Tue, 4 Feb 2025 12:13:47 +1000 Subject: [PATCH 16/45] Change the cast PacketTypes for 74 to its corresponding definition --- TShockAPI/Commands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index d82f10e2..f630165f 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -2530,8 +2530,8 @@ namespace TShockAPI { foreach (TSPlayer ply in TShock.Players.Where(p => p != null && p.Active && p.TPlayer.name.ToLower().Equals(args.Parameters[0].ToLower()))) { - //this will always tell the client that they have not done the quest today. - ply.SendData((PacketTypes)74, ""); + //this will always tell the client that they have not done the quest today. * Update: We have a definition for Packet 74, why are you sending it as a cast to PacketTypes? + ply.SendData(PacketTypes.AnglerQuest, ""); } args.Player.SendSuccessMessage(GetString("Removed {0} players from the angler quest completion list for today.", result)); } From ce04d9d173166f65d38c4956430b0f0379c76ea4 Mon Sep 17 00:00:00 2001 From: ohayo Date: Tue, 4 Feb 2025 21:06:40 +1000 Subject: [PATCH 17/45] Remove magic number + Use suggestions by particles Added a new ClientState enum based on code in Terraria.MessageBuffer.GetData & Terraria.Netplay.InnerClientLoop --- TShockAPI/Commands.cs | 2 +- TShockAPI/DB/CharacterManager.cs | 2 +- TShockAPI/GetDataHandlers.cs | 25 +++++++++------- TShockAPI/TSPlayer.cs | 49 ++++++++++++++++++++++++++++++-- TShockAPI/TShock.cs | 6 ++-- 5 files changed, 66 insertions(+), 18 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index f630165f..f4d00f71 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -2530,7 +2530,7 @@ namespace TShockAPI { foreach (TSPlayer ply in TShock.Players.Where(p => p != null && p.Active && p.TPlayer.name.ToLower().Equals(args.Parameters[0].ToLower()))) { - //this will always tell the client that they have not done the quest today. * Update: We have a definition for Packet 74, why are you sending it as a cast to PacketTypes? + //this will always tell the client that they have not done the quest today. ply.SendData(PacketTypes.AnglerQuest, ""); } args.Player.SendSuccessMessage(GetString("Removed {0} players from the angler quest completion list for today.", result)); diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index 5a5e13a6..32ac924d 100644 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -189,7 +189,7 @@ namespace TShockAPI.DB if (!player.IsLoggedIn) return false; - if (player.State < 10) + if (player.State < (int)ClientState.ClientSpawned) return false; if (player.HasPermission(Permissions.bypassssc) && !fromCommand) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index c0faf964..043b12a4 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2618,7 +2618,7 @@ namespace TShockAPI private static bool HandleConnecting(GetDataHandlerArgs args) { - var account = TShock.UserAccounts.GetUserAccountByName(args.Player.Name);// + var account = TShock.UserAccounts.GetUserAccountByName(args.Player.Name); args.Player.DataWhenJoined = new PlayerData(args.Player); args.Player.DataWhenJoined.CopyCharacter(args.Player); args.Player.PlayerData = new PlayerData(args.Player); @@ -2628,8 +2628,9 @@ namespace TShockAPI { if (account.UUID == args.Player.UUID) { - if (args.Player.State == 1) - args.Player.State = 2; + if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) + args.Player.State = (int)ClientState.ClientSentPlayerInformation; + NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); var group = TShock.Groups.GetGroupByName(account.Group); @@ -2687,8 +2688,9 @@ namespace TShockAPI return true; } - if (args.Player.State == 1) + if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) args.Player.State = 2; + NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); return true; } @@ -2726,8 +2728,8 @@ namespace TShockAPI short numberOfDeathsPVP = args.Data.ReadInt16(); PlayerSpawnContext context = (PlayerSpawnContext)args.Data.ReadByte(); - if (args.Player.State >= 3 && !args.Player.FinishedHandshake) - args.Player.FinishedHandshake = true; //If the player has requested world data before sending spawn player, this should be equal to or greater than 3, otherwise it'll usually be 1. Also only set this once to remove redundant updates. + if (args.Player.State >= (int)ClientState.ClientRequestedWorldData && !args.Player.FinishedHandshake) + args.Player.FinishedHandshake = true; //If the player has requested world data before sending spawn player, they should be at the obvious ClientRequestedWorldData state. Also only set this once to remove redundant updates. if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context)) return true; @@ -3219,8 +3221,9 @@ namespace TShockAPI args.Player.RequiresPassword = false; args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, account.ID); - if (args.Player.State == 1) - args.Player.State = 2; + if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) + args.Player.State = (int)ClientState.ClientSentPlayerInformation; + NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); var group = TShock.Groups.GetGroupByName(account.Group); @@ -3267,8 +3270,10 @@ namespace TShockAPI if (TShock.Config.Settings.ServerPassword == password) { args.Player.RequiresPassword = false; - if (args.Player.State == 1) - args.Player.State = 2; + + if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) + args.Player.State = (int)ClientState.ClientSentPlayerInformation; + NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); return true; } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 6569ef01..aeadd408 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -62,6 +62,49 @@ namespace TShockAPI WriteToLogAndConsole } + /// + /// An enum based on the current client's connection state to the server. + /// + public enum ClientState : int + { + /// + /// The server has accepted the client's connection but now requires a password from them before they can continue. (Only for password protected servers) + /// + RequiresPassword = -1, + /// + /// The server has accepted the client's connection. In this state, they will send their current version string to the server. + /// + ClientConnecting = 0, + /// + /// The server has accepted the client's password to connect and/or the server has verified the client's version string as being correct. In this state, the server will send them their user slot and in return, they must send their player information. + /// + ClientReceivingPlayerSlot = 1, + /// + /// The client has sent their player information. In this state, they must request world data. + /// + ClientSentPlayerInformation = 2, + /// + /// The client has requested the world data. + /// + ClientRequestedWorldData = 3, + /// + /// The client has received the world data. + /// + ClientReceivedWorldData = 4, + /// + /// The client has loaded the world data and map. + /// + ClientLoadedWorldData = 5, + /// + /// The client is requesting tile data. + /// + ClientRequestingTileData = 6, + /// + /// The client has sent a SpawnPlayer packet and has finished the connection process. + /// + ClientSpawned = 10 + } + public class TSPlayer { /// @@ -2105,7 +2148,7 @@ namespace TShockAPI /// /// The list of necessary packets to make sure gets through to the player upon connection (before they finish the handshake). /// - private static readonly HashSet NecessaryPackets = new() + private static readonly HashSet HandshakeNecessaryPackets = new() { PacketTypes.ContinueConnecting, PacketTypes.WorldInfo, @@ -2121,7 +2164,7 @@ namespace TShockAPI /// /// The packet type to check against the necessary list. /// Whether the packet is necessary for connection or not - private bool NecessaryPacket(PacketTypes msgType) => NecessaryPackets.Contains(msgType); + private bool NecessaryPacket(PacketTypes msgType) => HandshakeNecessaryPackets.Contains(msgType); //Todo: Separate this into a few functions. SendTo, SendToAll, etc /// @@ -2143,7 +2186,7 @@ namespace TShockAPI if (!NecessaryPacket(msgType) && !FinishedHandshake) return; - if (msgType == PacketTypes.WorldInfo && State < 3) //If the player has requested the world data, their state will be 3. + if (msgType == PacketTypes.WorldInfo && State < (int)ClientState.ClientRequestedWorldData) return; NetMessage.SendData((int)msgType, Index, -1, text == null ? null : NetworkText.FromLiteral(text), number, number2, number3, number4, number5); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 64f23ec3..6c1b251c 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1440,7 +1440,7 @@ namespace TShockAPI if (tsplr.ReceivedInfo) { - if (!tsplr.SilentKickInProgress && tsplr.State >= 3 && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player. + if (!tsplr.SilentKickInProgress && tsplr.State >= (int)ClientState.ClientRequestedWorldData && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player. Utils.Broadcast(GetString("{0} has left.", tsplr.Name), Color.Yellow); Log.Info(GetString("{0} disconnected.", tsplr.Name)); @@ -1494,7 +1494,7 @@ namespace TShockAPI if (!tsplr.FinishedHandshake) { - tsplr.Kick(GetString("Your client didn't finish the handshake."), true); + tsplr.Kick(GetString("Your didn't send the right connection information."), true); args.Handled = true; return; } @@ -1678,7 +1678,7 @@ namespace TShockAPI return; } - if ((player.State < 10 || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 && + if ((player.State < (int)ClientState.ClientSpawned || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 && (int)type != 38 && (int)type != 21 && (int)type != 22 && type != PacketTypes.SyncLoadout) { e.Handled = true; From 72f529fcb1f5a2de2aa0bdd5d857aa03f18bdafa Mon Sep 17 00:00:00 2001 From: ohayo Date: Tue, 4 Feb 2025 21:24:44 +1000 Subject: [PATCH 18/45] Typo fix --- TShockAPI/TShock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 6c1b251c..b70a857d 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1494,7 +1494,7 @@ namespace TShockAPI if (!tsplr.FinishedHandshake) { - tsplr.Kick(GetString("Your didn't send the right connection information."), true); + tsplr.Kick(GetString("Your client didn't send the right connection information."), true); args.Handled = true; return; } From 5a23073db5834fd2bc7757a8ff5ff6f95fc1072c Mon Sep 17 00:00:00 2001 From: ohayo Date: Wed, 5 Feb 2025 09:33:36 +1000 Subject: [PATCH 19/45] Suggestions + fix last missed magic number --- TShockAPI/DB/CharacterManager.cs | 2 +- TShockAPI/GetDataHandlers.cs | 18 +++++++-------- TShockAPI/TSPlayer.cs | 38 ++++++++++++++++---------------- TShockAPI/TShock.cs | 4 ++-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index 32ac924d..0b8246b9 100644 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -189,7 +189,7 @@ namespace TShockAPI.DB if (!player.IsLoggedIn) return false; - if (player.State < (int)ClientState.ClientSpawned) + if (player.State < (int)ConnectionState.Complete) return false; if (player.HasPermission(Permissions.bypassssc) && !fromCommand) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 043b12a4..ac290356 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2628,8 +2628,8 @@ namespace TShockAPI { if (account.UUID == args.Player.UUID) { - if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) - args.Player.State = (int)ClientState.ClientSentPlayerInformation; + if (args.Player.State == (int)ConnectionState.AssigningPlayerSlot) + args.Player.State = (int)ConnectionState.AwaitingPlayerInfo; NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); @@ -2688,8 +2688,8 @@ namespace TShockAPI return true; } - if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) - args.Player.State = 2; + if (args.Player.State == (int)ConnectionState.AssigningPlayerSlot) + args.Player.State = (int)ConnectionState.AwaitingPlayerInfo; NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); return true; @@ -2728,7 +2728,7 @@ namespace TShockAPI short numberOfDeathsPVP = args.Data.ReadInt16(); PlayerSpawnContext context = (PlayerSpawnContext)args.Data.ReadByte(); - if (args.Player.State >= (int)ClientState.ClientRequestedWorldData && !args.Player.FinishedHandshake) + if (args.Player.State >= (int)ConnectionState.RequestingWorldData && !args.Player.FinishedHandshake) args.Player.FinishedHandshake = true; //If the player has requested world data before sending spawn player, they should be at the obvious ClientRequestedWorldData state. Also only set this once to remove redundant updates. if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context)) @@ -3221,8 +3221,8 @@ namespace TShockAPI args.Player.RequiresPassword = false; args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, account.ID); - if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) - args.Player.State = (int)ClientState.ClientSentPlayerInformation; + if (args.Player.State == (int)ConnectionState.AssigningPlayerSlot) + args.Player.State = (int)ConnectionState.AwaitingPlayerInfo; NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); @@ -3271,8 +3271,8 @@ namespace TShockAPI { args.Player.RequiresPassword = false; - if (args.Player.State == (int)ClientState.ClientReceivingPlayerSlot) - args.Player.State = (int)ClientState.ClientSentPlayerInformation; + if (args.Player.State == (int)ConnectionState.AssigningPlayerSlot) + args.Player.State = (int)ConnectionState.AwaitingPlayerInfo; NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index); return true; diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index aeadd408..cf08d5bf 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -65,44 +65,44 @@ namespace TShockAPI /// /// An enum based on the current client's connection state to the server. /// - public enum ClientState : int + public enum ConnectionState : int { /// - /// The server has accepted the client's connection but now requires a password from them before they can continue. (Only for password protected servers) + /// The server is password protected and the connection is pending until a password is sent by the client. /// - RequiresPassword = -1, + AwaitingPassword = -1, /// - /// The server has accepted the client's connection. In this state, they will send their current version string to the server. + /// The connection has been established, and the client must verify its version. /// - ClientConnecting = 0, + AwaitingVersionCheck = 0, /// - /// The server has accepted the client's password to connect and/or the server has verified the client's version string as being correct. In this state, the server will send them their user slot and in return, they must send their player information. + /// The server has accepted the client's password to connect and/or the server has verified the client's version string as being correct. The client is now being assigned a player slot. /// - ClientReceivingPlayerSlot = 1, + AssigningPlayerSlot = 1, /// - /// The client has sent their player information. In this state, they must request world data. + /// The player slot has been received by the client, and the server is now waiting for the player information. /// - ClientSentPlayerInformation = 2, + AwaitingPlayerInfo = 2, /// - /// The client has requested the world data. + /// Player information has been received, and the client is requesting world data. /// - ClientRequestedWorldData = 3, + RequestingWorldData = 3, /// - /// The client has received the world data. + /// The world data is being sent to the client. /// - ClientReceivedWorldData = 4, + ReceivingWorldData = 4, /// - /// The client has loaded the world data and map. + /// The world data has been received, and the client is now finalizing the load. /// - ClientLoadedWorldData = 5, + FinalizingWorldLoad = 5, /// /// The client is requesting tile data. /// - ClientRequestingTileData = 6, + RequestingTileData = 6, /// - /// The client has sent a SpawnPlayer packet and has finished the connection process. + /// The connection process is complete (The player has spawned), and the client has fully joined the game. /// - ClientSpawned = 10 + Complete = 10 } public class TSPlayer @@ -2186,7 +2186,7 @@ namespace TShockAPI if (!NecessaryPacket(msgType) && !FinishedHandshake) return; - if (msgType == PacketTypes.WorldInfo && State < (int)ClientState.ClientRequestedWorldData) + if (msgType == PacketTypes.WorldInfo && State < (int)ConnectionState.RequestingWorldData) return; NetMessage.SendData((int)msgType, Index, -1, text == null ? null : NetworkText.FromLiteral(text), number, number2, number3, number4, number5); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b70a857d..f3afa716 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1440,7 +1440,7 @@ namespace TShockAPI if (tsplr.ReceivedInfo) { - if (!tsplr.SilentKickInProgress && tsplr.State >= (int)ClientState.ClientRequestedWorldData && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player. + if (!tsplr.SilentKickInProgress && tsplr.State >= (int)ConnectionState.RequestingWorldData && tsplr.FinishedHandshake) //The player has left, do not broadcast any clients exploiting the behaviour of not spawning their player. Utils.Broadcast(GetString("{0} has left.", tsplr.Name), Color.Yellow); Log.Info(GetString("{0} disconnected.", tsplr.Name)); @@ -1678,7 +1678,7 @@ namespace TShockAPI return; } - if ((player.State < (int)ClientState.ClientSpawned || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 && + if ((player.State < (int)ConnectionState.Complete || player.Dead) && (int)type > 12 && (int)type != 16 && (int)type != 42 && (int)type != 50 && (int)type != 38 && (int)type != 21 && (int)type != 22 && type != PacketTypes.SyncLoadout) { e.Handled = true; From de142e419ea2544a30bbb705818751248fed5329 Mon Sep 17 00:00:00 2001 From: ohayo Date: Wed, 5 Feb 2025 09:37:53 +1000 Subject: [PATCH 20/45] I guess update the magic number here too? --- TShockAPI/GetDataHandlers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index ac290356..684d7f3e 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3441,9 +3441,9 @@ namespace TShockAPI if (buff == 10 && TShock.Config.Settings.DisableInvisPvP && args.TPlayer.hostile) buff = 0; - if (Netplay.Clients[args.TPlayer.whoAmI].State < 2 && (buff == 156 || buff == 47 || buff == 149)) + if (Netplay.Clients[args.TPlayer.whoAmI].State < (int)ConnectionState.AwaitingPlayerInfo && (buff == 156 || buff == 47 || buff == 149)) { - TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePlayerBuffList zeroed player buff due to below state 2 {0} {1}", args.Player.Name, buff)); + TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePlayerBuffList zeroed player buff due to below state awaiting player information {0} {1}", args.Player.Name, buff)); buff = 0; } From 6d5fff83cf749a5b02d6f22c9262e5b602e17875 Mon Sep 17 00:00:00 2001 From: ohayo Date: Sat, 8 Feb 2025 14:37:48 +1000 Subject: [PATCH 21/45] Prevent blank UUIDs from being banned This fixes a bug with a bad actor getting banned with a blank client UUID and then preventing anyone from joining the server due to a lack of UUID on the Connect Request ban check. --- TShockAPI/Commands.cs | 2 +- TShockAPI/DB/BanManager.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index f4d00f71..16183431 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1607,7 +1607,7 @@ namespace TShockAPI } } - if (banUuid) + if (banUuid && player.UUID.Length > 0) { banResult = DoBan($"{Identifier.UUID}{player.UUID}", reason, expiration); } diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 42892100..3e93a3b7 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -189,11 +189,15 @@ namespace TShockAPI.DB { List identifiers = new List { - $"{Identifier.UUID}{player.UUID}", $"{Identifier.Name}{player.Name}", $"{Identifier.IP}{player.IP}" }; + if (player.UUID != null && player.UUID.Length > 0) + { + identifiers.Add($"{Identifier.UUID}{player.UUID}"); + } + if (player.Account != null) { identifiers.Add($"{Identifier.Account}{player.Account.Name}"); From 20532135580568478ba7dbc98150604751454e99 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Sat, 8 Feb 2025 07:13:03 +0000 Subject: [PATCH 22/45] Bounce infinite or NaN velocity / position --- TShockAPI/Bouncer.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 0f5f6e3c..bfcd1836 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -504,6 +504,14 @@ namespace TShockAPI return; } + if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y)) + { + TShock.Log.ConsoleInfo(GetString("Bouncer / OnPlayerUpdate force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name)); + args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + args.Handled = true; + return; + } + if (pos.X < 0 || pos.Y < 0 || pos.X >= Main.maxTilesX * 16 - 16 || pos.Y >= Main.maxTilesY * 16 - 16) { TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (position check) {0}", args.Player.Name)); @@ -1072,6 +1080,22 @@ namespace TShockAPI bool noDelay = args.NoDelay; short type = args.Type; + if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y)) + { + TShock.Log.ConsoleInfo(GetString("Bouncer / OnItemDrop force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name)); + args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + args.Handled = true; + return; + } + + if (!float.IsFinite(vel.X) || !float.IsFinite(vel.Y)) + { + TShock.Log.ConsoleInfo(GetString("Bouncer / OnItemDrop force kicked (attempted to set velocity to infinity or NaN) from {0}", args.Player.Name)); + args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + args.Handled = true; + return; + } + // player is attempting to crash clients if (type < -48 || type >= Terraria.ID.ItemID.Count) { @@ -1175,6 +1199,22 @@ namespace TShockAPI int index = args.Index; float[] ai = args.Ai; + if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y)) + { + TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name)); + args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + args.Handled = true; + return; + } + + if (!float.IsFinite(vel.X) || !float.IsFinite(vel.Y)) + { + TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile force kicked (attempted to set velocity to infinity or NaN) from {0}", args.Player.Name)); + args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + args.Handled = true; + return; + } + if (index > Main.maxProjectiles) { TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from above projectile limit from {0}", args.Player.Name)); From 64d819bebb086f92e55bcd6d1ae26d64d6eb7af0 Mon Sep 17 00:00:00 2001 From: Arthri <41360489+a@users.noreply.github.com> Date: Sat, 8 Feb 2025 07:18:06 +0000 Subject: [PATCH 23/45] Changelog entry --- docs/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.md b/docs/changelog.md index afcfc727..505419e2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -95,6 +95,7 @@ Use past tense when adding new entries; sign your name off when you add or chang * * Ensured `TSPlayer.PlayerData` is non-null whilst syncing loadouts. (@drunderscore) * * Detected invalid installations, by checking for a file named `TerrariaServer.exe`. (@drunderscore) * This made the two most common installation mistakes (extracting into the Terraria client directory, and extracting TShock 5 or newer into a TShock 4 or older install) prompt the user with a more useful diagnostic, rather than (likely) crashing moments later. +* Changed Bouncer to block updates which set the following fields to infinity or NaN: player position, projectile position, projectile velocity, item position, and item velocity. (@Arthri) ## TShock 5.2.1 * Updated `TSPlayer.GodMode`. (@AgaSpace) From 836cc33c8dd338fe558b8e6c5f1b410d0573d7ad Mon Sep 17 00:00:00 2001 From: Joseph Goh Date: Mon, 27 Jan 2025 09:58:40 +0800 Subject: [PATCH 24/45] rewrite: bed spawning for SSC --- TShockAPI/GetDataHandlers.cs | 81 ++++++++++++++++++++++-------------- TShockAPI/PlayerData.cs | 14 +------ TShockAPI/TSPlayer.cs | 37 +++++++++++----- TShockAPI/TShock.cs | 16 +++---- docs/changelog.md | 3 ++ 5 files changed, 90 insertions(+), 61 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 8f70fd2c..07010c94 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2248,7 +2248,7 @@ namespace TShockAPI var args = new SyncTilePickingEventArgs { - Player = player, + Player = player, PlayerIndex = playerIndex, TileX = tileX, TileY = tileY, @@ -2719,8 +2719,8 @@ namespace TShockAPI } byte player = args.Data.ReadInt8(); - short spawnx = args.Data.ReadInt16(); - short spawny = args.Data.ReadInt16(); + short spawnX = args.Data.ReadInt16(); + short spawnY = args.Data.ReadInt16(); int respawnTimer = args.Data.ReadInt32(); short numberOfDeathsPVE = args.Data.ReadInt16(); short numberOfDeathsPVP = args.Data.ReadInt16(); @@ -2728,43 +2728,62 @@ namespace TShockAPI args.Player.FinishedHandshake = true; - if (OnPlayerSpawn(args.Player, args.Data, player, spawnx, spawny, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context)) + if (OnPlayerSpawn(args.Player, args.Data, player, spawnX, spawnY, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context)) return true; + + args.Player.Dead = respawnTimer > 0; - if ((Main.ServerSideCharacter) && (spawnx == -1 && spawny == -1)) //this means they want to spawn to vanilla spawn + if (Main.ServerSideCharacter) { - args.Player.sX = Main.spawnTileX; - args.Player.sY = Main.spawnTileY; - args.Player.Teleport(args.Player.sX * 16, (args.Player.sY * 16) - 48); - TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawn force teleport 'vanilla spawn' {0}", args.Player.Name)); - } + // As long as the player has not changed his spawnpoint since initial connection, + // we should not use the client's spawnpoint value. This is because the spawnpoint + // value is not saved on the client when SSC is enabled. Hence, we have to assert + // the server-saved spawnpoint value until we can detect that the player has changed + // his spawn. Once we detect the spawnpoint changed, the client's spawnpoint value + // becomes the correct one to use. + // + // Note that spawnpoint changes (right-clicking beds) are not broadcasted to the + // server. Hence, the only way to detect spawnpoint changes is from the + // PlayerSpawn packet. - else if ((Main.ServerSideCharacter) && (args.Player.sX > 0) && (args.Player.sY > 0) && (args.TPlayer.SpawnX > 0) && ((args.TPlayer.SpawnX != args.Player.sX) && (args.TPlayer.SpawnY != args.Player.sY))) - { - args.Player.sX = args.TPlayer.SpawnX; - args.Player.sY = args.TPlayer.SpawnY; - - if (((Main.tile[args.Player.sX, args.Player.sY - 1].active() && Main.tile[args.Player.sX, args.Player.sY - 1].type == TileID.Beds)) && (WorldGen.StartRoomCheck(args.Player.sX, args.Player.sY - 1))) + // handle initial connection + if (args.Player.State == 3) { - args.Player.Teleport(args.Player.sX * 16, (args.Player.sY * 16) - 48); - TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawn force teleport phase 1 {0}", args.Player.Name)); - } - } + // server saved spawnpoint value + args.Player.initialSpawn = true; + args.Player.initialServerSpawnX = args.TPlayer.SpawnX; + args.Player.initialServerSpawnY = args.TPlayer.SpawnY; - else if ((Main.ServerSideCharacter) && (args.Player.sX > 0) && (args.Player.sY > 0)) - { - if (((Main.tile[args.Player.sX, args.Player.sY - 1].active() && Main.tile[args.Player.sX, args.Player.sY - 1].type == TileID.Beds)) && (WorldGen.StartRoomCheck(args.Player.sX, args.Player.sY - 1))) + // initial client spawn point, do not use this to spawn the player + // we only use it to detect if the spawnpoint has changed during this session + args.Player.initialClientSpawnX = spawnX; + args.Player.initialClientSpawnY = spawnY; + + // we first let the game handle completing the connection (state 3 => 10), + // then we will spawn the player at the saved spawnpoint in the next second, + // by reasserting the correct spawnpoint value + return false; + } + + // once we detect the client has changed his spawnpoint in the current session, + // the client spawnpoint value will be correct for the rest of the session + if (args.Player.spawnSynced || args.Player.initialClientSpawnX != spawnX || args.Player.initialClientSpawnY != spawnY) { - args.Player.Teleport(args.Player.sX * 16, (args.Player.sY * 16) - 48); - TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawn force teleport phase 2 {0}", args.Player.Name)); + // Player has changed his spawnpoint, client and server TPlayer.Spawn{X,Y} is now synced + args.Player.spawnSynced = true; + return false; } + + // the player has not changed his spawnpoint yet, so we assert the server-saved spawnpoint + // by teleporting the player instead of letting the game use the client's incorrect spawnpoint. + TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawn force ssc teleport for {0} at ({1},{2})", args.Player.Name, args.TPlayer.SpawnX, args.TPlayer.SpawnY)); + args.Player.TeleportSpawnpoint(); + + args.TPlayer.respawnTimer = respawnTimer; + args.TPlayer.numberOfDeathsPVE = numberOfDeathsPVE; + args.TPlayer.numberOfDeathsPVP = numberOfDeathsPVP; + return true; } - - if (respawnTimer > 0) - args.Player.Dead = true; - else - args.Player.Dead = false; - return false; } diff --git a/TShockAPI/PlayerData.cs b/TShockAPI/PlayerData.cs index 2a8dd41f..bab9f7a6 100644 --- a/TShockAPI/PlayerData.cs +++ b/TShockAPI/PlayerData.cs @@ -104,16 +104,8 @@ namespace TShockAPI this.maxHealth = player.TPlayer.statLifeMax; this.mana = player.TPlayer.statMana; this.maxMana = player.TPlayer.statManaMax; - if (player.sX > 0 && player.sY > 0) - { - this.spawnX = player.sX; - this.spawnY = player.sY; - } - else - { - this.spawnX = player.TPlayer.SpawnX; - this.spawnY = player.TPlayer.SpawnY; - } + this.spawnX = player.TPlayer.SpawnX; + this.spawnY = player.TPlayer.SpawnY; extraSlot = player.TPlayer.extraAccessory ? 1 : 0; this.skinVariant = player.TPlayer.skinVariant; this.hair = player.TPlayer.hair; @@ -266,8 +258,6 @@ namespace TShockAPI player.TPlayer.statManaMax = this.maxMana; player.TPlayer.SpawnX = this.spawnX; player.TPlayer.SpawnY = this.spawnY; - player.sX = this.spawnX; - player.sY = this.spawnY; player.TPlayer.hairDye = this.hairDye; player.TPlayer.anglerQuestsFinished = this.questsCompleted; player.TPlayer.UsingBiomeTorches = this.usingBiomeTorches == 1; diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index cb66649a..4fd65275 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -177,8 +177,13 @@ namespace TShockAPI /// public int RPPending = 0; - public int sX = -1; - public int sY = -1; + + public bool initialSpawn = false; + public int initialServerSpawnX = -2; + public int initialServerSpawnY = -2; + public bool spawnSynced = false; + public int initialClientSpawnX = -2; + public int initialClientSpawnY = -2; /// /// A queue of tiles destroyed by the player for reverting. @@ -1383,6 +1388,25 @@ namespace TShockAPI return true; } + /// + /// Teleports the player to their spawnpoint. + /// Teleports to main spawnpoint if their bed is not active. + /// Supports SSC. + /// + public bool TeleportSpawnpoint() + { + // NOTE: it is vanilla behaviour to not permanently override the spawnpoint if the bed spawn is broken/invalid + int x = TPlayer.SpawnX; + int y = TPlayer.SpawnY; + if ((x == -1 && y == -1) || + !Main.tile[x, y - 1].active() || Main.tile[x, y - 1].type != TileID.Beds || !WorldGen.StartRoomCheck(x, y - 1)) + { + x = Main.spawnTileX; + y = Main.spawnTileY; + } + return Teleport(x * 16, y * 16 - 48); + } + /// /// Heals the player. /// @@ -1397,14 +1421,7 @@ namespace TShockAPI /// public void Spawn(PlayerSpawnContext context, int? respawnTimer = null) { - if (this.sX > 0 && this.sY > 0) - { - Spawn(this.sX, this.sY, context, respawnTimer); - } - else - { - Spawn(TPlayer.SpawnX, TPlayer.SpawnY, context, respawnTimer); - } + Spawn(TPlayer.SpawnX, TPlayer.SpawnY, context, respawnTimer); } /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e984da2f..c5f2b968 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1182,16 +1182,16 @@ namespace TShockAPI if (player.RecentFuse > 0) player.RecentFuse--; - if ((Main.ServerSideCharacter) && (player.TPlayer.SpawnX > 0) && (player.sX != player.TPlayer.SpawnX)) + if (Main.ServerSideCharacter && player.initialSpawn) { - player.sX = player.TPlayer.SpawnX; - player.sY = player.TPlayer.SpawnY; - } + player.initialSpawn = false; - if ((Main.ServerSideCharacter) && (player.sX > 0) && (player.sY > 0) && (player.TPlayer.SpawnX < 0)) - { - player.TPlayer.SpawnX = player.sX; - player.TPlayer.SpawnY = player.sY; + // reassert the correct spawnpoint value after the game's Spawn handler changed it + player.TPlayer.SpawnX = player.initialServerSpawnX; + player.TPlayer.SpawnY = player.initialServerSpawnY; + + player.TeleportSpawnpoint(); + TShock.Log.ConsoleDebug(GetString("OnSecondUpdate / initial ssc spawn for {0} at ({1}, {2})", player.Name, player.TPlayer.SpawnX, player.TPlayer.SpawnY)); } if (player.RPPending > 0) diff --git a/docs/changelog.md b/docs/changelog.md index afcfc727..3c9051c0 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -95,6 +95,9 @@ Use past tense when adding new entries; sign your name off when you add or chang * * Ensured `TSPlayer.PlayerData` is non-null whilst syncing loadouts. (@drunderscore) * * Detected invalid installations, by checking for a file named `TerrariaServer.exe`. (@drunderscore) * This made the two most common installation mistakes (extracting into the Terraria client directory, and extracting TShock 5 or newer into a TShock 4 or older install) prompt the user with a more useful diagnostic, rather than (likely) crashing moments later. +* Rewrote bed spawning for SSC. (@PotatoCider) + * Removed `TSPlayer.s{X,Y}` in favour of using desyncing client and server spawnpoint values (`Terraria.Player.Spawn{X,Y}`) until the player has changed their spawnpoint per session. + * Partially fixed the bed spawning bug when SSC is enabled. Players would need to spawn at their beds at least once to tell TShock that the player's spawnpoint has changed. ## TShock 5.2.1 * Updated `TSPlayer.GodMode`. (@AgaSpace) From 56c586504321d0cf5ff31ccd87e8ec51c75928fb Mon Sep 17 00:00:00 2001 From: ohayo Date: Tue, 11 Feb 2025 07:47:14 +1000 Subject: [PATCH 25/45] Emergency bug fix for handshake on all/server player The All Player does not have a valid state and because FinishedHandshake is false by default, they would never get time update packets, etc. --- TShockAPI/TSPlayer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index cf08d5bf..da9b7df6 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -35,6 +35,7 @@ using TShockAPI.Net; using Timer = System.Timers.Timer; using System.Linq; using Terraria.GameContent.Creative; +using SteelSeries.GameSense; namespace TShockAPI { @@ -1367,6 +1368,9 @@ namespace TShockAPI FakePlayer = new Player { name = playerName, whoAmI = -1 }; Group = Group.DefaultGroup; AwaitingResponse = new Dictionary>(); + + if (playerName == "All" || playerName == "Server") + FinishedHandshake = true; //Hot fix for the all player object not getting packets like TimeSet, etc because they have no state and finished handshake will always be false. } /// @@ -2186,7 +2190,7 @@ namespace TShockAPI if (!NecessaryPacket(msgType) && !FinishedHandshake) return; - if (msgType == PacketTypes.WorldInfo && State < (int)ConnectionState.RequestingWorldData) + if (FakePlayer != null && FakePlayer.whoAmI != -1 && msgType == PacketTypes.WorldInfo && State < (int)ConnectionState.RequestingWorldData) //So.. the All player doesn't have a state, so we cannot check this, skip over them if their index is -1 (server/all) return; NetMessage.SendData((int)msgType, Index, -1, text == null ? null : NetworkText.FromLiteral(text), number, number2, number3, number4, number5); From 98eed425e238cad814c85a754053b2f48b117a5c Mon Sep 17 00:00:00 2001 From: ohayo Date: Wed, 12 Feb 2025 21:51:14 +1000 Subject: [PATCH 26/45] Suppress logging of un-spawnable npcs Not anything related to the handshake fixes, but still a nice fix which could help server owners deal with mischievous client users. --- TShockAPI/GetDataHandlers.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 684d7f3e..1454299b 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3648,10 +3648,15 @@ namespace TShockAPI thing = GetString("{0} summoned the {1}!", args.Player.Name, npc.FullName); break; } - if (TShock.Config.Settings.AnonymousBossInvasions) - TShock.Utils.SendLogs(thing, Color.PaleVioletRed, args.Player); - else - TShock.Utils.Broadcast(thing, 175, 75, 255); + + if (NPCID.Sets.MPAllowedEnemies[thingType]) + { + if (TShock.Config.Settings.AnonymousBossInvasions) + TShock.Utils.SendLogs(thing, Color.PaleVioletRed, args.Player); + else + TShock.Utils.Broadcast(thing, 175, 75, 255); + } + return false; } From 1e23785a04dfcedb139f00ed86d0666640844361 Mon Sep 17 00:00:00 2001 From: LaoSparrow Date: Fri, 28 Feb 2025 23:01:40 +0800 Subject: [PATCH 27/45] fix(Bouncer/SendTileRectHandler): MatchRemoval incorrect check range --- TShockAPI/Handlers/SendTileRectHandler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs index d85185b8..e5e3f360 100644 --- a/TShockAPI/Handlers/SendTileRectHandler.cs +++ b/TShockAPI/Handlers/SendTileRectHandler.cs @@ -327,7 +327,7 @@ namespace TShockAPI.Handlers private bool MatchRemoval(TSPlayer player, TileRect rect) { - for (int x = rect.X; x < rect.Y + rect.Width; x++) + for (int x = rect.X; x < rect.X + rect.Width; x++) { for (int y = rect.Y; y < rect.Y + rect.Height; y++) { @@ -910,7 +910,7 @@ namespace TShockAPI.Handlers } } - /* + /* * This is a copy of the `WorldGen.Convert` method with the following precise changes: * - Added a `MockTile tile` parameter * - Changed the `i` and `j` parameters to `k` and `l` @@ -921,7 +921,7 @@ namespace TShockAPI.Handlers * - Removed the ifs checking the bounds of the tile and wall types * - Removed branches that would call `WorldGen.KillTile` * - Changed branches depending on randomness to instead set the property to both values after one another - * + * * This overall leads to a method that can be called on a MockTile and real-world coordinates and will spit out the proper conversion changes into the MockTile. */ From 28aa3aea482badcd54344d910c7f8811a8e1a99e Mon Sep 17 00:00:00 2001 From: LaoSparrow Date: Sat, 1 Mar 2025 01:42:18 +0800 Subject: [PATCH 28/45] fix(Bouncer/SendTileRectHandler): tile rect changes not synced between clients && unable to place HatRack --- TShockAPI/Handlers/SendTileRectHandler.cs | 67 +++++++++++++---------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs index e5e3f360..d66c3ef6 100644 --- a/TShockAPI/Handlers/SendTileRectHandler.cs +++ b/TShockAPI/Handlers/SendTileRectHandler.cs @@ -78,6 +78,13 @@ namespace TShockAPI.Handlers Removal, } + public enum MatchResult + { + NotMatched, + RejectChanges, + BroadcastChanges, + } + private readonly int Width; private readonly int Height; @@ -179,11 +186,11 @@ namespace TShockAPI.Handlers /// The player the operation originates from. /// The tile rectangle of the operation. /// , if the rect matches this operation and the changes have been applied, otherwise . - public bool Matches(TSPlayer player, TileRect rect) + public MatchResult Matches(TSPlayer player, TileRect rect) { if (rect.Width != Width || rect.Height != Height) { - return false; + return MatchResult.NotMatched; } for (int x = 0; x < rect.Width; x++) @@ -195,7 +202,7 @@ namespace TShockAPI.Handlers { if (tile.Type != TileType) { - return false; + return MatchResult.NotMatched; } } if (Type is MatchType.Placement or MatchType.StateChange) @@ -204,7 +211,7 @@ namespace TShockAPI.Handlers { if (tile.FrameX < 0 || tile.FrameX > MaxFrameX || tile.FrameX % FrameXStep != 0) { - return false; + return MatchResult.NotMatched; } } if (MaxFrameY != IGNORE_FRAME) @@ -214,7 +221,7 @@ namespace TShockAPI.Handlers // this is the only tile type sent in a tile rect where the frame have a different pattern (56, 74, 92 instead of 54, 72, 90) if (!(TileType == TileID.LunarMonolith && tile.FrameY % FrameYStep == 2)) { - return false; + return MatchResult.NotMatched; } } } @@ -223,7 +230,7 @@ namespace TShockAPI.Handlers { if (tile.Active) { - return false; + return MatchResult.NotMatched; } } } @@ -236,7 +243,7 @@ namespace TShockAPI.Handlers if (!player.HasBuildPermission(x, y)) { // for simplicity, let's pretend that the edit was valid, but do not execute it - return true; + return MatchResult.RejectChanges; } } } @@ -257,10 +264,10 @@ namespace TShockAPI.Handlers } } - return false; + return MatchResult.NotMatched; } - private bool MatchPlacement(TSPlayer player, TileRect rect) + private MatchResult MatchPlacement(TSPlayer player, TileRect rect) { for (int x = rect.X; x < rect.Y + rect.Width; x++) { @@ -268,7 +275,7 @@ namespace TShockAPI.Handlers { if (Main.tile[x, y].active()) // the client will kill tiles that auto break before placing the object { - return false; + return MatchResult.NotMatched; } } } @@ -277,7 +284,7 @@ namespace TShockAPI.Handlers if (TShock.TileBans.TileIsBanned((short)TileType, player)) { // for simplicity, let's pretend that the edit was valid, but do not execute it - return true; + return MatchResult.RejectChanges; } for (int x = 0; x < rect.Width; x++) @@ -291,10 +298,10 @@ namespace TShockAPI.Handlers } } - return true; + return MatchResult.BroadcastChanges; } - private bool MatchStateChange(TSPlayer player, TileRect rect) + private MatchResult MatchStateChange(TSPlayer player, TileRect rect) { for (int x = rect.X; x < rect.Y + rect.Width; x++) { @@ -302,7 +309,7 @@ namespace TShockAPI.Handlers { if (!Main.tile[x, y].active() || Main.tile[x, y].type != TileType) { - return false; + return MatchResult.NotMatched; } } } @@ -322,10 +329,10 @@ namespace TShockAPI.Handlers } } - return true; + return MatchResult.BroadcastChanges; } - private bool MatchRemoval(TSPlayer player, TileRect rect) + private MatchResult MatchRemoval(TSPlayer player, TileRect rect) { for (int x = rect.X; x < rect.X + rect.Width; x++) { @@ -333,7 +340,7 @@ namespace TShockAPI.Handlers { if (!Main.tile[x, y].active() || Main.tile[x, y].type != TileType) { - return false; + return MatchResult.NotMatched; } } } @@ -348,7 +355,7 @@ namespace TShockAPI.Handlers } } - return true; + return MatchResult.BroadcastChanges; } } @@ -364,7 +371,7 @@ namespace TShockAPI.Handlers TileRectMatch.Placement(2, 3, TileID.TargetDummy, 54, 36, 18, 18), TileRectMatch.Placement(3, 4, TileID.TeleportationPylon, 468, 54, 18, 18), TileRectMatch.Placement(2, 3, TileID.DisplayDoll, 126, 36, 18, 18), - TileRectMatch.Placement(2, 3, TileID.HatRack, 90, 54, 18, 18), + TileRectMatch.Placement(3, 4, TileID.HatRack, 90, 54, 18, 18), TileRectMatch.Placement(2, 2, TileID.ItemFrame, 162, 18, 18, 18), TileRectMatch.Placement(3, 3, TileID.WeaponsRack2, 90, 36, 18, 18), TileRectMatch.Placement(1, 1, TileID.FoodPlatter, 18, 0, 18, 18), @@ -436,7 +443,7 @@ namespace TShockAPI.Handlers TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from throttle from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } @@ -446,7 +453,7 @@ namespace TShockAPI.Handlers TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from being disabled from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } @@ -468,7 +475,7 @@ namespace TShockAPI.Handlers TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect reimplemented from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } @@ -478,7 +485,7 @@ namespace TShockAPI.Handlers TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from out of range from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } @@ -488,19 +495,23 @@ namespace TShockAPI.Handlers TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect reimplemented from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } // check if the rect matches any valid operation foreach (TileRectMatch match in Matches) { - if (match.Matches(args.Player, rect)) + var result = match.Matches(args.Player, rect); + if (result != TileRectMatch.MatchResult.NotMatched) { TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect reimplemented from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + if (result == TileRectMatch.MatchResult.RejectChanges) + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); + if (result == TileRectMatch.MatchResult.BroadcastChanges) + TSPlayer.All.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } } @@ -511,14 +522,14 @@ namespace TShockAPI.Handlers TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect reimplemented from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from matches from {args.Player.Name}")); // send correcting data - args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width); + args.Player.SendTileRect(args.TileX, args.TileY, args.Width, args.Length); return; } From 61e574ce7230544ce42dc3f730fda99d4843ad75 Mon Sep 17 00:00:00 2001 From: LaoSparrow Date: Sat, 1 Mar 2025 02:02:24 +0800 Subject: [PATCH 29/45] docs(changelog): update entries --- docs/changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index afcfc727..147d5559 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -95,6 +95,10 @@ Use past tense when adding new entries; sign your name off when you add or chang * * Ensured `TSPlayer.PlayerData` is non-null whilst syncing loadouts. (@drunderscore) * * Detected invalid installations, by checking for a file named `TerrariaServer.exe`. (@drunderscore) * This made the two most common installation mistakes (extracting into the Terraria client directory, and extracting TShock 5 or newer into a TShock 4 or older install) prompt the user with a more useful diagnostic, rather than (likely) crashing moments later. +* Updated `TShockAPI.Handlers.SendTileRectHandler` (@LaoSparrow): + * Fixed incorrect validating range in `TileRectMatch.MatchRemoval`. + * Fixed tile rect changes (e.g. turning on and off campfires) are not synced between clients. + * Fixed unable to place Hat Rack without permission `tshock.ignore.sendtilesquare`. ## TShock 5.2.1 * Updated `TSPlayer.GodMode`. (@AgaSpace) From 740c5c9250c262e2602292ac9e5b2d396ec0f842 Mon Sep 17 00:00:00 2001 From: LaoSparrow Date: Sat, 1 Mar 2025 03:41:30 +0800 Subject: [PATCH 30/45] fix(GetDataHandlers): handle and ignore `NpcItemStrike(msgid 24)` --- TShockAPI/GetDataHandlers.cs | 8 ++++++++ docs/changelog.md | 1 + 2 files changed, 9 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 8f70fd2c..22cfadb3 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -95,6 +95,7 @@ namespace TShockAPI { PacketTypes.TileSendSquare, HandleSendTileRect }, { PacketTypes.ItemDrop, HandleItemDrop }, { PacketTypes.ItemOwner, HandleItemOwner }, + { PacketTypes.NpcItemStrike, HandleNpcItemStrike }, { PacketTypes.ProjectileNew, HandleProjectileNew }, { PacketTypes.NpcStrike, HandleNpcStrike }, { PacketTypes.ProjectileDestroy, HandleProjectileKill }, @@ -2945,6 +2946,13 @@ namespace TShockAPI return false; } + private static bool HandleNpcItemStrike(GetDataHandlerArgs args) + { + // Never sent by vanilla client, ignore this + TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleNpcItemStrike surprise packet! Someone tell the TShock team! {0}", args.Player.Name)); + return true; + } + private static bool HandleProjectileNew(GetDataHandlerArgs args) { short ident = args.Data.ReadInt16(); diff --git a/docs/changelog.md b/docs/changelog.md index 147d5559..cf4e43f2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -99,6 +99,7 @@ Use past tense when adding new entries; sign your name off when you add or chang * Fixed incorrect validating range in `TileRectMatch.MatchRemoval`. * Fixed tile rect changes (e.g. turning on and off campfires) are not synced between clients. * Fixed unable to place Hat Rack without permission `tshock.ignore.sendtilesquare`. +* Updated `GetDataHandlers` to ignore `NpcItemStrike(msgid 24)`, which should never be sent by a vanilla client. (@LaoSparrow) ## TShock 5.2.1 * Updated `TSPlayer.GodMode`. (@AgaSpace) From 701a7d1ca0f1ad8d40f9d4342abf03ee353a8390 Mon Sep 17 00:00:00 2001 From: ohayo <9443476+ohayo@users.noreply.github.com> Date: Tue, 4 Mar 2025 21:00:33 +1000 Subject: [PATCH 31/45] Update TShockAPI/TSPlayer.cs Co-authored-by: Chris <2648373+QuiCM@users.noreply.github.com> --- TShockAPI/TSPlayer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index da9b7df6..2c70955b 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -35,7 +35,6 @@ using TShockAPI.Net; using Timer = System.Timers.Timer; using System.Linq; using Terraria.GameContent.Creative; -using SteelSeries.GameSense; namespace TShockAPI { From 1abb53b22e24aaed18c1e449ee987747e6743400 Mon Sep 17 00:00:00 2001 From: ohayo <9443476+ohayo@users.noreply.github.com> Date: Tue, 4 Mar 2025 21:01:01 +1000 Subject: [PATCH 32/45] Update TShockAPI/TSPlayer.cs Oops Co-authored-by: Chris <2648373+QuiCM@users.noreply.github.com> --- TShockAPI/TSPlayer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 2c70955b..3fb22887 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -35,7 +35,6 @@ using TShockAPI.Net; using Timer = System.Timers.Timer; using System.Linq; using Terraria.GameContent.Creative; - namespace TShockAPI { /// From db9c47d7c05ad2eaf4e4a51ff1551256332d6477 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 10 Mar 2025 01:22:38 +0900 Subject: [PATCH 33/45] Version tick: 5.2.3 --- TShockAPI/TShock.cs | 2 +- TShockAPI/TShockAPI.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index cf47b170..8e467973 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -63,7 +63,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 = "East"; + public static readonly string VersionCodename = "Better late than never!"; /// 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"; diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 88f61606..a01bb022 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -18,7 +18,7 @@ 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) --> - 5.2.2 + 5.2.3 TShock for Terraria Pryaxis & TShock Contributors TShockAPI From e99655bb80200129611425b814c1f7254f0cf3b9 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 12 Mar 2025 06:01:47 +0900 Subject: [PATCH 34/45] Update changelog file for the last time --- docs/changelog.md | 1159 +-------------------------------------------- 1 file changed, 1 insertion(+), 1158 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 49a579ed..142555d7 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,1158 +1 @@ -# TShock for Terraria - -This is the rolling changelog for TShock for Terraria. Changes listed under "upcoming changes" are only available in experimental builds. - - - -## Upcoming changes -* Added a variable for handshake (True upon spawn player), clients no longer notify others of their presence and cant chat if this is never set to true. (@ohayo) -* Fixed a security issue with how bans are handled on join. (@ohayo) -* Fixed `/dump-reference-data` mutate the command names. (#2943, @sgkoishi) -* Added `ParryDamageBuff` (Striking Moment with Brand of the Inferno and shield) for player, updated `CursedInferno` buff for NPC (@sgkoishi, #3005) -* Changed the use of `Player.active` to `TSPlayer.Active` for consistency. (@sgkoishi, #2939) -* Fix typo in config for IP bans. (@redchess64) -* Updated `TShockAPI.NetItem` (@AgaSpace): - * Added constructor overload with parameter `Terraria.Item`. - * Added the `ToItem` method to get a copy of `Terraria.Item`. - * In the constructor `stack` and `prefix` are now optional parameters. -* Fixed unable to transfer long response body for REST API. (@sgkoishi, #2925) -* Fixed the `/wind` command not being very helpful. (@punchready) -* Fixed /help, /me, and /p commands can't work in non-English languages. (@ACaiCat) -* Added a hook `AccountHooks.AccountGroupUpdate`, which is called when you change the user group. (@AgaSpace) -* * Ensured `TSPlayer.PlayerData` is non-null whilst syncing loadouts. (@drunderscore) -* * Detected invalid installations, by checking for a file named `TerrariaServer.exe`. (@drunderscore) - * This made the two most common installation mistakes (extracting into the Terraria client directory, and extracting TShock 5 or newer into a TShock 4 or older install) prompt the user with a more useful diagnostic, rather than (likely) crashing moments later. Rewrote bed spawning for SSC. (@PotatoCider) - * Removed `TSPlayer.s{X,Y}` in favour of using desyncing client and server spawnpoint values (`Terraria.Player.Spawn{X,Y}`) until the player has changed their spawnpoint per session. - * Partially fixed the bed spawning bug when SSC is enabled. Players would need to spawn at their beds at least once to tell TShock that the player's spawnpoint has changed. -* Changed Bouncer to block updates which set the following fields to infinity or NaN: player position, projectile position, projectile velocity, item position, and item velocity. (@Arthri) -* Updated `TShockAPI.Handlers.SendTileRectHandler` (@LaoSparrow): - * Fixed incorrect validating range in `TileRectMatch.MatchRemoval`. - * Fixed tile rect changes (e.g. turning on and off campfires) are not synced between clients. - * Fixed unable to place Hat Rack without permission `tshock.ignore.sendtilesquare`. -* Updated `GetDataHandlers` to ignore `NpcItemStrike(msgid 24)`, which should never be sent by a vanilla client. (@LaoSparrow) - -## TShock 5.2.1 -* Updated `TSPlayer.GodMode`. (@AgaSpace) - * Previously the field was used as some kind of dataset changed by /godmode command, but now it is a property that receives/changes data in journey mode. -* Added the `TSPlayer.Client` property. It allows the developer to get the `RemoteClient` player, without an additional call to `Terraria.Netplay.Clients`. (@AgaSpace) -* Updated the documentation for the `TSPlayer.SetPvP` method. The `sendMsg` parameter, which is responsible for sending a pvp mode change message, was not documented earlier. (@AgaSpace) -* Added methods `TSPlayer.KillPlayer` and `TSPlayer.DamagePlayer` for which you can specify the cause (`PlayerDeathReason`) in parameters. (@AgaSpace) -* Added an error when trying to change a `TSPlayer` team to, say, 9, when there are only 6. (@AgaSpace) -* Added an error when trying to call the `TSPlayer.SetTeam` method with an argument (team) greater than 5 or less than 0. (@AgaSpace) -* Added a method `TSPlayer.UpdateSection` with arguments `rectangle` and `isLoaded`, which will load some area from the server to the player. (@AgaSpace) -* Added a method `TSPlayer.GiveItem`, which has `TShockAPI.NetItem` structure in its arguments. (@AgaSpace) -* Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace) -* Fixed bug where when the `UseSqlLogs` config property is true, an empty log file would still get created. (@ZakFahey) -* Fixed typo in `/gbuff`. (@sgkoishi, #2955) - -Rewrote the Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri) -* Added a set of new permissions, `tshock.specialeffects.{type}`, for regulating use of new special effects(Packet 51) which are not yet recognized by TShock. (@Arthri) -* Added check for `tshock.npc.summonboss` permission for Skeletron summoning. (@Arthri) -* Fixed `DisableDungeonGuardian` disabling Skeletron summon instead. The config option is useless as of writing. (@Arthri) -* Added a constructor for `TShockAPI.PlayerData` that accepts the `includingStarterInventory` parameter, which is responsible for loading the TShock inventory. -* Declared the constructor `TShockAPI.PlayerData` accepting the argument `TShockAPI.TSPlayer` obsolete. -* Updated the `PlayerData.StoreSlot` method: Added an overload that takes `TShockAPI.NetItem`. -* Added `PlayerHooks.PrePlayerCommand` hook, which fired before command execution. (@AgaSpace) -* Added `PlayerHooks.PostPlayerCommand` hook, which fired after command execution. (@AgaSpace) - -## TShock 5.2 -* An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK) -* Corrected and updated deserialization of the following packets (@ATFGK): - * `ProjectileNew`: Read the third `AI` value. - * Before this change, it was previously possible for the projectile damage limit to falsely trigger, such as when using the Terra Balde and Fire Gauntlet together. - * `PlayerSpawn`: Read the `NumberOfDeathsPVE` and `NumberOfDeathsPVP` values. - * Before this change, the `PlayerSpawnContext` was always read incorrectly, due to the values above being placed in the middle of the existing structure. - * `NpcTeleportPortal`: Read the NPC index as a `ushort` instead of a `byte`. - * `PlaceObject`: Read the `Random` value. - * Before this change, the `Direction` was always read incorrectly, due to the value above being placed in the middle of the existing structure. - * `Zones`: Read the `zone5` value. - * `PaintTile` and `PaintWall`: Read the `coatTile` and `coatWall` values. - * `PlayerHurtV2`: Read the `cooldownCounter` value. -* Updated `SpawnMsg` to include the `NumberOfDeathsPVE` and `NumberOfDeathsPVP`, and allow them to be optionally used in `TSPlayer.Spawn`. (@ATFGK) -* Added `WorldTileProvider` to the tshock config with values `default`, `constileation` or `heaptile`. This allows tile providers to be changed in environments where CLI args cannot be altered. See the documentation website for more info about these providers. (@SignatureBeef) -* Updated the Utils.FindByIdOrName to follow same logic. Now fuzzy match fallback to `StartsWith` and then `Contains`. (@sgkoishi) -* Added `ShadowCandle` and `BrainOfConfusionBuff` (BoC dodge buff) to the `PlayerAddBuffWhitelist` (@drunderscore) -* Improved rejection message and code duplication in `OnPlayerBuff`. (@drunderscore) - * This will make it so Bouncer rejections regarding `PlayerAddBuff` will now always include the sender index, buff type, receiver index, and time in ticks, allowing much faster triage of buff whitelist issues. -* Allowed Digging Molecart and bomb fish to break tiles and place tracks. (@sgkoishi) -* Added built-in package management capabilities for plugins. (@pontaoski) -* Fixed Super Sponge unable to absorb shimmer. (@sgkoishi, #2833) -* Increased whitelisted duration of the Mighty Wind (`WindPushed`) buff (from sandstorms). (@drunderscore) -* Allowed the Hellfire (`OnFire3`) buff. (@drunderscore) -* Allowed Digging Molecart and bomb fish to break tiles and place tracks (@sgkoishi) -* Initialized achievements and the `AchievementManager` on the server. This ensures that players cannot cause exceptions to be thrown, chat messages are always logged, and allows achievement names to be localized in the console. Also added a test case for this. (@drunderscore) -* Allowed multiple test cases to be in TShock's test suite. (@drunderscore) -* Fixed unable to use Purification/Evil Powder in jungle. (@sgkoishi) -* Set the `GetDataHandledEventArgs.Player` property for the `SyncTilePicking` data handler. (@drunderscore) -* Relaxed custom death message restrictions to allow Inferno potions in PvP. (@drunderscore) -* Allowed Flower Boots to place Ash Flowers on Ash Grass blocks. (@punchready) -* Removed unnecessary range check that artifically shortened quick stack reach. (@boddyn, #2885, @bcat) - -## TShock 5.1.3 -* Added support for Terraria 1.4.4.9 via OTAPI 3.1.20. (@SignatureBeef) - -## TShock 5.1.2 -* Added support for Terraria 1.4.4.8.1 via OTAPI 3.1.19. (@SignatureBeef) - -## TShock 5.1.1 -* Fixed item giving potentially dropping too many items. (@PotatoCider, @punchready) -* Excluded GeoIP.dat from release bundle. (@SignatureBeef) -* Added `TownSlimeRed` to `FishableNpcIDs` list, allowing it to be fished up. (@drunderscore) -* Bump to Terraria 1.4.4.8 via OTAPI 3.1.18. (@hakusaro, @SignatureBeef) - * In this version of Terraria, `Main.maxBuffTypes` and other `maxWhateverTypes` fields have been removed. Their replacements are in `Terraria.ID.whateverID.Count`. TShock calls to these fields have been swapped in order to bring forward compatibility with Terraria 1.4.4.8. -* In OTAPI 3.1.17, allowed Crystal Shard to grow. (@sgkoishi, @cc004, SignatureBeef/Open-Terraria-API#96) -* Added permission for summoning Mechdusa, Deerclops and slime pet. (@sgkoishi, #2808) -* Changed login to only restrict CC'd players during login whilst SSC is enabled. (@drunderscore) - * This change allows the config option `RequireLogin` to function usefully again when SSC is not enabled. -* Changed `PlayerData.RestoreCharacter` to remove all buffs. (@drunderscore) - * Before this change, it was theoretically possible to smuggle buffs onto servers with SSC enabled, by using buff indexes past `22`. -* Allowed Torch God's Favor to place different types of torches and campfires. (@sgkoishi, #2811) -* Updated translations! Currently, the major projects are at the following completion rates: - * Chinese (93%) - * Portuguese, Brazilian (89%) - * Indonesian (89%) - * Russian (56%) - * Spanish (24%) - * toki pona (10%) - * Turkish (8%) - * For complete credits, see the table below. - -### Translation credits -The following translators contributed changes from November 1, 2022 to November 9, 2022 (from TShock 5.0.0 to 5.1.0). - -|Contributor | Language | Translated words| -|-----|-----|-----| -|Shiva Goddess (ShivaGoddess) | Portuguese, Brazilian | 6979| -|Ricko (Rickojp) | Portuguese, Brazilian | 3154| -|RidnRaven (ridwankun2) | Indonesian | 2329| -|Janet Blackquill (pontaoski) | toki pona | 1216| -|SGKoishi | Chinese Simplified | 640| -|Cristofer GamerTVH (cristoferherame) | Spanish | 622| -|HDSeventh (hdseventh) | Indonesian | 315| -|EMRE ÇELİK (emre0447) | Turkish | 312| -|PHPoenX | Russian | 297| -|./lemon.sh (lemon-sh) | Polish | 206| -|Сергей Червяков (chsergeyg) | Russian | 182| -|okaythisisepic | Russian | 80| -|KomashiOFC | Portuguese, Brazilian | 76| -|Runesicle | toki pona | 22| -|Marotheit | Pirate English | 7| -|ATFGK | Chinese Simplified | 4| - -## TShock 5.1.0 - -This release was scrubbed. All changes have been re-allocated to the 5.1.1 release. We consider a verison "final" after the tick and do not apply more changes. Thus, we were unable to simply release 5.0.0 as-is, as a late-breaking bug was discovered and fixed after the tick. - -## TShock 5.0.0 -* Reduced load/save console spam. (@SignatureBeef, @YehnBeep) -* Replaced SQLite library with Microsoft.Data.Sqlite for arm64 support. (@SignatureBeef) -* Initial support for MonoMod hooks on Raspberry Pi (arm64). (@kevzhao2) -* Ported to OTAPI3 and .NET6. (@SignatureBeef) -* Introduced a new module framework for TShock developers. (@SignatureBeef) -* Fixed a secondary crash when server init fails and log services were not initialised. (@SignatureBeef) -* Added preliminary support for Terraria 1.4.4.4. (@SignatureBeef) -* GrassSpreadEventArgs Color property has been changed from a Byte to a TileColorCache type. (@SignatureBeef) -* SetDefaultsEventArgs now includes a nullable ItemVariant instance. (@SignatureBeef) -* Use a string interpolation and escape single quotes when escaping tables. (@drunderscore) -* Removed obsolete resource files `TShockAPI/Resources.resx` and `TShockAPI/Resources.Designer.cs`. (@Arthri) -* Fixed hardcore and mediumcore not banning on death when settings are enabled. This also alters the TSPlayer.Ban method to remove the force option which is no longer needed. (@SignatureBeef) -* Plugins and ./bin dependencies are now loaded relative to the launcher, this improves the use of startup files. (@SignatureBeef) -* Added preliminary support for Terraria 1.4.4.5. (@drunderscore) - * For clarity sake, we're listing the individual changes to Terraria's version, despite the fact that this version only supports the latest one. -* Don't allow players to sync loadout index whilst disabled. (@drunderscore) -* Fixed painting wall/tile being rejected from hand of creation. (@Rozen4334) -* Added a second `Utils.TryParseTime` method for parsing large, positive time spans. (@punchready) -* Fixed `/tempgroup` breaking on durations greater than roughly 24 days. (@punchready) -* Fixed player not being checked for permissions to use the Shellphone (Ocean), Shellphone (Underworld) and Shellphone (Spawn). (@hufang360) -* Updated to OTAPI 3.1.10-alpha, which allows FreeBSD .NET 6 to use Re-Logic's Linux platform. (@SignatureBeef) -* Updated Github CI to not tarball files for Windows only. (@PotatoCider) -* Allow Blood Butcherer and Shimmer buffs to be applied to NPCs by players. (@drunderscore) -* In OTAPI 3.1.11-alpha, chest stacking was fixed. (@SignatureBeef) -* In OTAPI 3.1.12-alpha, "server world deletions" were fixed. (@SignatureBeef) -* Fixed NetTile errors by implementing new packet read/write data. (@SignatureBeef) -* Fixed Inferno Fork causing kick from rejected abnormal buff. (@Stealownz) -* Prevented Server Broadcast from executing without a message. (@PackmanDude, @punchready) -* Added `LiquidType.Shimmer`. (@drunderscore) -* Made Bouncer allow Bottomless Honey Bucket usage. (@drunderscore) -* Made Bouncer reject Shimmer placement without bucket or whilst banned. (@drunderscore) -* Fixed Bouncer rejecting Explosive Bunny critter release when using the Bunny Cannon, if the player had since stopped selecting the Explosive Bunny. (@drunderscore) -* Allowed breaking of tiles that are in `BreakableWhenPlacing` set. This will allow you to place tiles over other tiles (like piles) properly, without being rejected. (@drunderscore) -* Allowed the Axe of Regrowth and the Rubblemaker to pass Bouncer checks. (@drunderscore) - * The Axe of Regrowth places a `Saplings` where a tree used to be, which previously failed. - * The Rubblemaker places rubble (which are echo piles), of varying styles, which previously failed. -* Fixed `HandlePlayerAddBuff` data handler always being marked as `Handled`, and therefore never allowing the `PlayerAddBuff` to be sent to anyone. (@drunderscore) -* Improved `OnPlayerBuff` logic to properly handle players adding buffs to other players. (@drunderscore) - * Check if the target ID is within bounds as the first thing to check. - * Check if the buff type being applied is within bounds. - * Introduce `AddPlayerBuffWhitelist` (replacing `WhitelistBuffMaxTime`), which allows us to specify the maximum amount of ticks a buff can be applied for, and if it can be applied without the target being in PvP. - * When rejecting from `OnPlayerBuff`, instead of sending a `PlayerAddBuff` packet with the rejected buff (essentially a no-op, as the sender implicitly applies the buff to the target, and causes desync as the buff was rejected), send a `PlayerBuff` to re-sync the target's buffs, without the buff we just rejected. -* Added new tile provider. Use `-constileation` or `-c` to use it. Constileation is an alternative tile provider to Tiled and HeapTile. (@SignatureBeef) -* Fixed an exploit with grass mowing not removing hanging vines. (@punchready) -* Added `-additionalplugins` command line argument to load additional plugins. (@pontaoski) -* Added localization support for console spam reduction. (@KawaiiYuyu) -* Added an internationalization system. The base for the i18n system was built by Janet Blackquill ([@pontaoski](https://github.com/pontaoski)). A small donation in her honor was made to the [KDE project](https://kde.org/) as a thankyou for this work. This also includes the `TSHOCK_LANGUAGE` environment variable. Setting `TSHOCK_LANGUAGE=tok` will enable a small number of [Toki Pona](https://tokipona.org/) translations as a proof-of-concept. (@pontaoski) -* Added support for Terraria 1.4.4.6, through OTAPI 3.1.5. (@SignatureBeef) -* Added GeoIP.dat back to the included list of files. (@SignatureBeef) -* Allow loadouts to properly sync by allowing the `SyncLoadout` packet during early connection. (@drunderscore) -* Introduced support for loadouts, and saving the current loadout index to SSC. Both `NetItem` and `PlayerData` were modified to support this. (@drunderscore) -* Introduced checking of loadout slots for hacked item stacks. (@drunderscore) -* Fixed players being kicked after using the Flamethrower to apply the `OnFire3` debuff for `1200` ticks. (@BashGuy10) -* Fixed being kicked for using the new sponge types on liquid. (@BashGuy10) -* Fixed SSC not saving `ateArtisanBread`, `usedAegisCrystal`, `usedAegisFruit`, `usedArcaneCrystal`, `usedGalaxyPearl`, `usedGummyWorm`, `usedAmbrosia`, `unlockedSuperCart`, and `enabledSuperCart` data flags. (@hufang360) -* Allowed flask buffs to be applied on town npc due to the Flymeal. Add a permission could skip the buff detection. (@KawaiiYuyu) -* Dockerized TShock. (@PotatoCider) -* Changed the log system to log the command itself without arguments if the command is not `DoLog`. (@sgkoishi, [#2779](https://github.com/Pryaxis/TShock/issues/2779)) -* Added ability for items given to players to be inserted directly into their inventory instead of spawned as an item drop. (@pontaoski) -* Added support of `-lang` and `-language` flags for our i18n system. (@KawaiiYuyu) -* Added support for Terraria 1.4.4.7 (OTAPI 3.1.16). (@drunderscore) -* Added support for various languages, most notably Chinese (99% complete), Russian (57% complete), Indonesian (53% complete), and Spanish (21% complete). Thank you to the lovely contributors who were responsible for this [on Crowdin](https://crowdin.com/project/tshock): - * RidnRaven (ridwankun2) - * okaythisisepic - * xml3344 has stopped making trouble (1212122222) - * Axeel (AxeelAnder) - * SGKoishi - * Leader-txt (Leader_txt) - * Esteban Delgado (Kojirremer) - * Cai233 - * Anzhelika (AnzhelikaO) - * VariolaX - * hufang 360 (hufang360) - * AgaSpace (Zoom L1) (agaspacel1) - * Killia0 (Killia) - * EMRE ÇELİK (emre0447) - * Marcus Persson (squidistaken) - * StarCloud-cy - * HDSeventh (hdseventh) - * JJJJGGGG12345 - * xml3344 - * Seele Vollerei (aaa1115910) - * 问心|MiaoVPS (WenXin_MiaoVPS) - * avlensa - * Sykhasamann (Syks) - * AndPlay - * TruffleToad - * kuaizhi - * Simone Caporale (caporalesimone) - * josefcorosado - * kuukiman - * Kronex (Kronex6) - * Jifeng - * Janet Blackquill (pontaoski) - * Yuiinar (Yuiinars) - * Muteduanxing - -## TShock 4.5.18 -* Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@PotatoCider) -* Only allow using Teleportation Potions, Magic Conch, and Demon Conch whilst holding them. (@drunderscore) -* Updated server startup language to be more clear when encountering a fatal startup error. Now, the server gives more context as to what happened so that there's a better chance of people being able to help themselves. (@hakusaro) -* Added `-worldevil ` command line argument. (@NotGeri) -* Added PlayerHasBuildPermission hook to PlayerHooks. (@AnzhelikaO, @Killia0) -* Fixed an exploit in which the Ice Block deletion allowance from the Ice Rod bypassed region protection, allowing for deleting all tiles in a protected region and/or replacing them with Ice Blocks. (@punchready) -* Changed SendTileRect handling from a denylist to an allowlist with stricter checks. This prevents essentially all exploits involving this packet. Most notably this stops people from placing arbitrary tiles with arbitrary framing values, which are the root of most exploits. (@punchready) -* Removed the config options `TileRectangleSizeThreshold` and `KickOnTileRectangleSizeThresholdBroken` because they are made obsolete by the new system, which will only allow valid rectangle sizes (at a maximum of only 4 by 4 tiles in 1.4.3.6). (@punchready) -* Bumped Newtonsoft Json to 13.0.1. (@dependabot) -* Allow the Cool Whip to apply `CoolWhipNPCDebuff` for `240` ticks, fixing abnormal NPC buff add rejects in Bouncer. (@drunderscore) - -## TShock 4.5.17 -* Fixed duplicate characters (twins) after repeatedly logging in as the same character due to connection not being immediately closed during `NetHooks_NameCollision`. (@PotatoCider) -* Fixed mobs not dropping picked up coins. (@PotatoCider) - -## TShock 4.5.16 -* Added preliminary support for Terraria 1.4.3.6. (@SignatureBeef, @hakusaro) - -## TShock 4.5.15 -* Added preliminary support for Terraria 1.4.3.5. (@SignatureBeef, @hakusaro) - -## TShock 4.5.14 -* Improved the `/grow` command to reduce code duplication, use `TileID` constants for less ambiguous types. (@drunderscore) -* Fixed item dupe via /logout & NPC. (@Terrarxxn) -* Added preliminary support for Terraria 1.4.3.4. Note that this has the side-effect of adding `IEntitySource` as the first parameter to `Item.NewItem` and `NPC.NewNPC`, and in `TSAPI`, `NpcLootDropEventArgs` passes `IEntitySource` as `Source`. If you're updating a plugin, you can either make something that implements with `IEntitySource` or just use `new EntitySource_DebugCommand()` [like TShock does](https://github.com/Pryaxis/TShock/commit/1b96ed8992110c5bbcc2ef952cc98459ea194dee). (@SignatureBeef, @Patrikkk, @hakusaro) - -## TShock 4.5.13 -* Added hook `GetDataHandlers.OnReleaseNpc` to handling ReleaseNPC packet and a bouncer to stops unregistered and logged out players on SSC servers from releasing critters NPC. The bouncer has additional filter to stops players who tried to release different critter using crafted packet, e.g. using bunny item to release golden bunny. (@tru321) -* Added filter in `GetDataHandlers.HandleCatchNpc` that stops unregistered and logged out players on SSC servers to catch critters. (@tru321) -* Fixed rejection check inside of `HandlePaintTile` to account for the Paint Sprayer (or Architect Gizmo Pack) being inside your inventory, rather than on an accessory slot. (@drunderscore) -* Added the lanterns night event to the `/worldevent` command. (@0x3fcf1bbd) -* Marked `TSPlayer.SendTileSquare` as deprecated, and created `TSPlayer.SendTileSquareCentered` that sends a tile square centered around the passed coordinates. (@0x3fcf1bbd) -* Added coordinates clamping to `TSPlayer.SendTileRect` so as to avoid OOBs. (@0x3fcf1bbd) -* Removed extraneous space causing build commands in README to fail. (@EtherTyper) - -## TShock 4.5.12 -* Fixed the ability to spawn Zenith projectile with non-original items. (@AgaSpace) -* Added hook `GetDataHandlers.OnNpcTalk` for NpcTalk and a handler for it that stops unregistered and logged out players from interacting with NPCs, preventing them from smuggling or duplicating items via NPC item slots. (@tru321) -* Fixed the ability to create custom messages with your death (or the death of another player) (@AgaSpace) -* Added the `OnSignRead` handler in `GetDataHandler`, and added the `SignRead` event. Added check to ensure the sign being read is within world bounds `(x >= 0 && y >= 0 && x < Main.maxTilesX && y < Main.maxTilesY)`. (@drunderscore) -* Added check to `HandleNpcTalk` to ensure the passed NPC index is within bounds (>= -1 && < `Main.maxNPCs`). (@drunderscore) - -## TShock 4.5.11 -* Add the new allowed buff TentacleSpike to NPC buff cheat detection bouncer. (@sgkoishi) -* Changed hook `GetDataHandlers.OnNewProjectile` so that it passes the projectile's AI (by updating `NewProjectileEventArgs` and parsing this during the TShock hook) to support processing projectile AI in bouncer. (@AgaSpace) -* Fixed an issue where certain projectiles could be sent to the server with uncapped size parameters, which resulted in large disruptive client artifacts that could be used to grief players. (@AgaSpace, @Arthri) -* Added the currently running value of `Main.GameMode` to `/worldmode` as "Mode". (@hakusaro) - -## TShock 4.5.10 -* Changed the server behavior when `SIGINT` is received. When `SIGINT` is trapped, the server will attempt to shut down safely. When it is trapped a second time in a session, it will immediately exit. (`SIGINT` is typically triggered via CTRL + C.) This means that it is possible to corrupt your world if you force shutdown at the wrong time (e.g., while the world is saving), but hopefully you expect this to happen if you hit CTRL + C twice in a session and you read the warning. (@hakusaro, @Onusai) - -## TShock 4.5.9 -* Added the ability to change a `TSPlayer`'s PVP mode. (@AgaSpace) -* Added protocol level support for Terraria 1.4.3.2. (@DeathCradle, @Patrikkk) - -## TShock 4.5.8 -* Removed `TShockAPI/DB/DBTools.cs`. This appears to have been dead code and not used by anything. (@hakusaro, @DeathCradle) -* Fixed the `/firework` command not sending fireworks when specified without a firework color. The firework command now correctly sends red fireworks to a target if a color is not specified. (@hakusaro, @Kojirremer) -* Fixed bad XML of TShock code documentation. (@Arthri) -* Fixed Bouncer exploits allowing for invalid tiles' placement. These tiles(specifically torches) caused clients to crash. The fixed exploits are listed below. (@Arthri, @QuiCM) - - [Biome Torch Correction](https://github.com/Pryaxis/TShock/blob/3ba1e7419d63535eeb8b5634ec668448499f71df/TShockAPI/Bouncer.cs#L310). Previously, it used unrelated values to validate biome torches, and unintentionally passed on invalid tiles. It's now fixed to use the correct values and block invalid torches. As well as a new right booster track correction/check, to allow right booster tracks to be placed. Right booster track is an extraneous place style because it depends on the direction the player is facing. The new check takes that into consideration so that the place style isn't considered mismatched and rejected. - - [Max Place Styles](https://github.com/Pryaxis/TShock/blob/3ba1e7419d63535eeb8b5634ec668448499f71df/TShockAPI/Bouncer.cs#L385). Previously, it rejects only if both `MaxPlaceStyles` and `ExtraneousPlaceStyles` contains an entry for a tile, and unintentionally passed on invalid tiles. `ExtraneousPlaceStyles` only contains special max placeStyles, not all placeables unlike `MaxPlaceStyles`. It's now corrected to take from `ExtraneousPlaceStyles` first, then fallback to `MaxPlaceStyles` if there's no entry for that tile, and then finally -1 if there's no entry in either. - -## TShock 4.5.7 -* Fixed the `/respawn` command to permit respawning players from the console. (@hakusaro, @Kojirremer) -* Removed the old password hashing system, which predated `bcrypt` hashes and allowed specifying the hash algorithm in the config file. This also removes the config option for setting the hash algorithm (`HashAlgorithm`). This is because it helps clear the way for .NET5/6 and OTAPI 3, and because `bcrypt` has been the default since TShock 4.3 in 2015. (@hakusaro) -* Updated to OTAPI 2.0.0.46, which adds support for Terraria Protocol 1.4.3.1. (@Patrikkk, @DeathCradle) -* **Change warning: a release of TShock for .NET 5 and OTAPI 3 may be imminent.** - -## TShock 4.5.6 -* Updated Linux guide. (@NezbednikSK) -* Fixed SendTileRectHandler not sending tile rect updates like Pylons/Mannequins to other clients. (@Stealownz) -* Introduced `SoftcoreOnly` config option to allow only softcore characters to connect. (@drunderscore) -* Fixed some typos that have been in the repository for over a lustrum. (@Killia0) -* Added a `tshock.npc.summonboss` permission check for Lunatic Cultist, players who do not have this permission will not be able to kill Cultist Archers/Devotees to summon the Lunatic Cultist. (@moisterrific) -* Added more usage examples for the `ban` command under `ban help examples` to explain how users can ban: offline players by account, offline players by IP, and online players by player index - useful for banning hard to type character names. (@moisterrific) -* Changed `/login` and `/register` to provide login help depending on if UUID login is enabled or disabled, and whether or not a player can login via any username or not. In addition, the message parameters will now be differentiated by colour instead of `<>` (@moisterrific, @hakusaro) -* Added a new `DisablePrimeBombs` config option (`false` by default). Highly recommended to set this to `true` in order to prevent griefing on servers doing a `for the worthy` play-through, since the prime bombs on this seed can destroy most tiles and bypass region protection. (@moisterrific) -* Added a new `/respawn` command that lets you respawn yourself or another player. Respawning yourself requires the `tshock.respawn` permission and respawning others requires the `tshock.respawn.other` permission. The full command syntax is `/respawn [player]`. (@moisterrific) -* Added a notification message and silent command support for permanently changing a target player's user group. Now players who received a group change will be notified of their new group if they are currently online. (@moisterrific, @QuiCM) -* Changed the TSPlayer IP method to return the loopback IP if RealPlayer is false. (@Rozen4334) -* Fixed a bug that caused sundials to be ignored all the time, instead of only when the player has no permission or time is frozen. (@Rozen4334) -* Added colours and usage examples (similiar to how the new ban system looks) for many more commands. (@moisterrific) -* Changed `RespawnSeconds` and `RespawnBossSeconds` from `10` to `0` to respect the game's default respawn timers. (@moisterrific) -* Updated Open Terraria API (OTAPI) and TSAPI for preliminary support of Terraria 1.4.3.0. This functionally changes OTAPI and points to 2.0.0.45 from 2.0.0.43 in previous versions. Developer note: `SendData` takes an extra arg in this version of Terraria but that's slated to be removed in a Terraria hotfix. This is vestigial and OTAPI "hacks that out" to preserve plugin compatibility. That's why it'll differ from the source code. (@Patrikkk, @DeathCradle, honorable mention: @Moneylover3246) -* Added Deerclops to `/spawnboss` command. (@hakusaro, @HiddenStriker) -* Fixed [GHSA-6w5v-hxr3-m2wx](https://github.com/Pryaxis/TShock/security/advisories/GHSA-6w5v-hxr3-m2wx). (@Yoraiz0r, @Arthri) -* Fixed an issue where player build permissions would reject gem lock changes, even if `RegionProtectGemLocks` was disabled in the config file. Now, players will be permitted to use gem locks if they don't have build permission in a region, but `RegionProtectGemLocks` is disabled. If `RegionProtectGemLocks` is enabled, players will be unable to use gem locks in a build region. (@hakusaro, @Kojirremer, @Arthri) -* Fixed an issue where `/god [player]` would tell `[player]` that they were in godmode regardless of whether or not they were or not. (@hakusaro, @Kojirremer) -* In `TSAPI`: Updated `PacketTypes` to support `SetMiscEventValues` (140), `RequestLucyPopup` (141), and `SyncProjectileTrackers` (142). (@hakusaro) -* Added `DisableDefaultIPBan` to the config file. If set to `true`, the server will not automatically IP ban players when banning them. This is useful if you run an intercepting proxy in front of TShock, and all players share the same IP. (@hakusaro, and Telegram user xmzzhh233) -* Blank passwords will be upgraded to `bcrypt` hashes automatically. Previously, blank passwords were not upgraded to bcrypt hashes. This is in preparation to remove the old password hashing system and related fallback components in the next release. Most users have been using bcrypt hashes for the past...few years. (@hakusaro) - -## 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) -* Fixed ridiculous typo in `Amethyst Gemtree` text. (@hakusaro) -* Fixed `CTRL + C` / interactive console interrupt not safely shutting down the server. Now, interrupts will cause a safe shutdown (saving the world and disconnecting all players before fully shutting down). Previously, interrupts caused an unsafe shutdown (not saving the world). (@hakusaro) -* Changed "success message" color to `Color.LimeGreen` instead of `Color.Green`. `Color.Green` looks ugly. `Color.LimeGreen` looks less ugly but isn't as offensively bright as pure green. (@hakusaro) -* Changed the default respawn timer to 10 seconds, so as to not desynchronize from the game by default. (@hakusaro) -* Fixed `/home` allowing players to bypass the respawn timer. (@hakusaro, @moisterrific, @Arthri) -* Added the config option `SuppressPermissionFailureNotices`. When set to `true`, the server will not send warning messages to players when they fail a build permission check from `TSPlayer.HasBuildPermission` (even if `shouldWarnPlayer` is set to true. (@hakusaro) -* Fixed `/warp send` failing a nullcheck if the warp didn't exist. The previous behavior may have always been buggy or broken. In other words, sending someone to a warp that doesn't exist should result in a nicer error. (@hakusaro, @punchready) -* Fixed `/group del` allowing server operators to delete the default group that guests are put into. This is a really critical group and the server doesn't behave correctly when it happens. As a result, it's better to prevent this from happening than not. Additionally, `GroupManagerException`s will be thrown if this is attempted programmatically. Finally, if the exception is thrown in response to `/group del` (or if any other exception is thrown that the command handler can handle), the stack trace will no longer be present. Fixes [#2165](https://github.com/Pryaxis/TShock/issues/2165). (@hakusaro, @DeveloperLuxo, @Rozen4334, @moisterrific, @bartico6, @Quinci135) -* Removed the old `ConfigFile` class. If you are updating a plugin, you should use `TShock.Config.Settings` instead of the accessor you were using. This is typically a really easy change. For most plugin authors, updating to the new config format is as simple as changing the reference to the old static config to point to the new location. If you were using this for your own configs, you should swap to using a `IConfigFile` (see `TShockAPI.Configuration.ConfigFile`). (@hakusaro, @bartico6) -* Added `Main.worldPathName` to `/worldinfo` command. Now, if you need to see what the location on disk for your world file is, you can simply run `/worldinfo` to find out. This is particularly helpful on Linux and macOS, where the world path isn't obvious. (@hakusaro) -* 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 Empress of Light. Players who do not have this permission will be unable to kill Prismatic Lacewings. 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/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. - * `OnPlaceItemFrame`: The check was newly added. - * `OnFoodPlatterTryPlacing`: The check was newly added. -* Fixed errors on startup not being reported to console. (@bartico6) -* The server now correctly disconnects players with missing groups instead of throwing an exception, stalling the connection (@bartico6) -* The server now rejects login attempts from players who would end up with a missing group. (@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) -* Fixed torchgod settings to include whether or not torchgod has been fought by the player before and respect `usingBiomeTorches` setting. (@Quinci135) -* Fixed /worldmode not synchronising data to players after updating the world state (@bartico6, @Arthri) -* Added `OnSendNetData` hook to TSAPI, which enables developers to intercept traffic being sent from the server to clients using the new NetPacket protocol. (@Stealownz) -* Fixed false positive `OnNPCAddBuff` detection when throwing rotten eggs at town NPCs while wearing Frost armor set. (@moisterrific) -* Moved the emoji player index check into a new class of handlers called `IllegalPerSe`, which is designed to help isolate parts of TShock and make it so that "protocol violations" are treated separately from heuristic based anti-cheat checks. (@hakusaro) -* Changed `TSPlayer.FindByNameOrID` so that it will continue searching for players and return a list of many players whem ambiguous matches exist in all cases. Specifically, this avoids a scenario where a griefer names themselves `1` and is difficult to enact justice on, because their name will not be found by the matching system used to kick players. To help with ambiguity, this method now processes requests with prefixes `tsi:` and `tsn:`. `tsi:[number]` will process the search as looking for an exact player by ID. `tsn:` will process the search as looking for an exact name, case sensitive. In both cases, the system will return an exact result in the "old-style" result, i.e., a `List` with exactly one result. For example, `/kick tsid:1` will match the player with the ID `1`. `/kick tsn:1` will match the username `1`. In addition, players who attempt to join the server with the name prefixes `tsn:` and `tsi:` will be rejected for having invalid names. (@hakusaro, @Onusai) -* Added warnings for conditions where a password is set at runtime but can be bypassed. The thinking is that if a user sets a password when they're booting the server, that's what they expect to be the password. The only thing is that sometimes, other config options can basically defeat this as a security feature. The goal is just to communicate more and make things clearer. The server also warns users when UUID login is enabled, because it can be confusing and insecure. (@hakusaro, @Onusai) -* Fixed Torch God's Favor biome torch placement being rejected by the server. (@moisterrific) -* Changed backups created by the backup manager to use ISO8601-style timestamps. I say "style" because it's impossible to implement ISO8601 or RFC3389 dates in a filename on most modern filesystems. So instead of the proper ISO separators, we've got dashes and dots. (@hakusaro, change sponsored by @drunderscore) -* Added hook for `OnDoorUse` (`DoorUse`) and associated `DoorUseEventArgs` fired when a door is used. Also added `GetDataHandlers.DoorAction` enum for determining the action of a door. (@hakusaro) -* Disallowed loading of the AutoRegister plugin version 1.2.0 or lower. Versions of this plugin at or equal to 1.2.0 use low entropy material to create passwords. This effectively means that it's possible for any user to be easily impersonated on a server running AutoRegister by simply convincing a user to join a malicious server, even when UUID login is disabled. This was assigned [GHSA-w3h6-j2gm-qf7q](https://github.com/Pryaxis/Plugins/security/advisories/GHSA-w3h6-j2gm-qf7q). (@hakusaro) -* Disallowed loading of another plugin due to [security issue GHSA-qj59-99v9-3gww](https://github.com/Pryaxis/Plugins/security/advisories/GHSA-qj59-99v9-3gww). Due to the importance of this issue and severity, information is not available in the changelog. Information will be available [June 8th, 2021, at 12:00 MDT](https://time.is/1200PM_8_June_2021_in_Littleton?GHSA-qj59-99v9-3gww_information_release). (@hakusaro) - -## TShock 4.5.3 -* Added permissions for using Teleportation Potions, Magic Conch, and Demon Conch. (@drunderscore) - * `tshock.tp.tppotion`, `tshock.tp.magicconch`, and `tshock.tp.demonconch` respectively. -* Updated HealOtherPlayer damage check to make more sense by respecting `ignoredamagecap` permission. (@moisterrific) -* Added preliminary support for Terraria 1.4.2.3 (@moisterrific, @Moneylover3246, @DeathCradle) -* Added celebration mk2 explosive to explosives ItemID set in TSAPI. Solves #2304. (@Quinci135) -* TShock now writes its log files to the `logs` folder inside the `tshock` folder by default, as opposed to just the `tshock` folder. (@QuiCM) -* The default MOTD is now prettier. The MOTD format can now contain `%specifier%` to send the command specifier. (@moisterrific) -* The buff commands now support `-1` as a time option to set buffs that last 415 days (the maximum buff time the game supports). (@moisterrific) -* TShock defaults to saving backups every 10 minutes, and defaults to keeping backups for 4 hours. (@hakusaro) -* Updated SSC bypass messaging. Now, when you connect, you're told if you're bypassing SSC. Console logging has been improved to warn when players are not being saved due to the bypass SSC permission. To turn this warning off, change `WarnPlayersAboutBypassPermission` to `false` in the `sscconfig.json` file. (@hakusaro) -* Fix oversight & exploit allowing specially crafted SendTileRectangle packets to perform large-scale world griefing. In addition, `NetTile.Slope` is now the native value (byte), and accessor methods `Slope1`, `Slope2`, and `Slope3` can be used to get the old style of values out. `HalfBrick` and `Actuator` were removed from `NetTile` because these were initialized to zero and never changed or used. (@bartico6) -* Warning: a bug introduced in a prior TShock release may cause your SSC config file to be reset after applying this update. Please backup your config file prior to installing TShock 4.5.3+ if you use SSC. (@cardinal-system) - -## TShock 4.5.2 -* Added preliminary support for Terraria 1.4.2.2. (@hakusaro) -* Removed `/ungodme` and godmode warning (no longer necessary). Also, godmode now supports silent commands. (@hakusaro) -* Added permission 'tshock.rest.broadcast' to the /v2/server/broadcast REST endpoint. (@TheBambino) - -## TShock 4.5.1 -* Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM, reported by @ATFGK) -* Added handling to the PlayerChat hook event. (@QuiCM - Thanks for the suggestion @Arthri) -* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev) -* Updated /godmode to use Journey Mode's Godmode power instead of healing on damage. (requested by @tlworks, backported by @bartico6, implemented preemptive bugfix for creative powers mentioned by @Stealownz) -* Fixed /r attempting to send messages to players that have since disconnected. (@bartico6, reported by @Arthri) -* Added ban ticket ID to ban messages (@QuiCM, suggested by @Bippity) -* Refactored /wallow command. /reply no longer bypasses /wallow (@QuiCM) - -## TShock 4.5.0.1 -* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK) -* Fixed wrong identifier used for UUID bans. (@DeathCradle, @ATFGK) -* Fixed conversion from sqlite bans due to locking issue. (@DeathCradle, @Kojirremer) - -## TShock 4.5.0 -* Updated OTAPI and TSAPI to Terraria 1.4.2.1. (@Stealownz, @DeathCradle) -* Updated TShock with preliminary protocol support for Terraria 1.4.2.1. (@Stealownz) - -## TShock 4.4.0 (Pre-release 16) -* Patched protocol issue. Thanks to Off (@tlworks) and @bartico6 for contributions, including packet captures, packet analysis, exploit proof-of-concept testing, patch testing, and detailed reproduction steps. (@hakusaro) -* Disabled debug by default. (@hakusaro) -* Changed "WinVer" field in `/serverinfo` to "Operating System". (@Terrabade) -* Rewritten `/grow`, added every default tree type & changed the default help response. (@Nova4334) - * Added a new permission: `tshock.world.growevil` to prevent players to grow evil biome trees, these trees spawn with evil biome blocks below them. -* Introduced `/wallow` to disable or enable recieving whispers from other players. (@Nova4334) -* Removed stoned & webbed from disabled status (@QuiCM) -* Fix -forceupdate flag not forcing updates (@Quake) - -## TShock 4.4.0 (Pre-release 15) -* Overhauled Bans system. Bans are now based on 'identifiers'. (@QuiCM) - * The old Bans table (`Bans`) has been deprecated. New bans will go in `PlayerBans`. Old bans will be converted automatically to the new system. - * All old ban routes in REST are now redirected. Please use `/v3/bans/*` for REST-based ban management. - * TShock recognizes and acts upon 4 main identifiers: UUID, IP, Player Name, Account name. This can be extended by plugins. New identifiers can be added to the `ban help identifiers` output by registering them in `TShockAPI.DB.Identifier.Register(string, string)` - * By default, bans are no longer removed upon expiry or 'deletion'. Instead, they remain in the system. A new ban for an indentifier can be added once an existing ban has expired. -* Server Console now understands Terraria color codes (e.g., `[c/FF00FF:Words]`) and prints the colored text to the console. Note that console colors are limited and thus only approximations. (@QuiCM) -* Fixed a bug in `/sudo` that prevented quoted arguments being forwarded properly. Example: `/sudo /user group "user name" "user group"` should now work correctly. (@QuiCM) -* Shutting down the server should now correctly display the shutdown message to players rather than 'Lost connection'. (@QuiCM) -* For developers: TShock now provides `IConfigFile` and `ConfigFile` under the `TShockAPI.Configuration` namespace. No more needing to copy/pasting the same Read/Write code for your plugin configs. (@QuiCM) - * `ConfigFile` implements `Read` and `Write` for you. - * Check `TShockConfig` and `ServerSideConfig` for examples on how to use. -* Added URI un-escaping on all inputs into REST. (@QuiCM) -* Attempt to fix platinum coin pickup dupe. (Thanks @Quinci135) - -## TShock 4.4.0 (Pre-release 14) -* Terraria v1.4.1.2 (Thanks @Patrikkk and @DeathCradle <3) -* Added Torch God's Favor support in SSC. (@Stealownz) -* SendTileSquare is now SendTileRect and can now send rectangles instead of squares. This is a breaking change (@QuiCM) -* Destroying protected tiles underneath a tile object no longer causes the tile object to disappear for the client (@QuiCM) -* 'RegionProtectGemLocks' config option now works correctly. Gems can now be placed in Gem Locks while this option is enabled (@QuiCM) - -## TShock 4.4.0 (Pre-release 13) -* Terraria v1.4.1.1 -* Added Gravedigger's Shovel support. (@Zennos) -* You can now start up multiple TShock servers at once without getting a startup error. (@ZakFahey) -* Updated bouncer to include new Magma Stone, Frost Armor, and Spinal Tap inflicted npc debuffs to bouncer. (@Quinci135) - -## TShock 4.4.0 (Pre-release 12) -* Fixed various bugs related to Snake Charmer's Flute. (@rustly) - * The entirety of the snake now places. - * The old snake now removes when placing a new snake. - * Players are no longer disabled for breaking TilePlace/TileKill thresholds when modifying snakes. -* Prevented players from seeing the npc spawnrate change permission error on join. (@rustly) -* Installed new sprinklers! -* Organized parameters by category and relevance in the `config.json` file. (@kubedzero) -* Fixed multiple holes in Bouncer OnTileData. (@Patrikkk, @hakusaro) - * Issue where players could replace tiles with banned tiles without permission. - * Including replace action in TilePlace threshold incrementation, so players cannot bypass the threshold while replacing tiles/walls. - * Including check for maxTileSets when player is replacing tiles, so players cannot send invalid tile data through the replace tile action. - * Including a check for ReplaceWall when the tile is a Breakable/CutTile. -* Adding checks in Bouncer OnNewProjectile (@Patrikkk): - * For valid golf club and golf ball creation. - * Renamed stabProjectile to directionalProjectile for a more accurate naming. - * Adding staff projectiles to the directionalProjectiles Dictionary to include staffs in the valid projectile creation check. - * Adding GolfBallItemIDs list in Handlers.LandGolfBallInCupHandler.cs -* Fixed an issue in the SendTileSquare handler that was rejecting valid tile objects. (@QuiCM) -* Fixed the issue where players were unable to place regular ropes because of the valid placement being caught in Bouncer OnTileEdit. (@Patrikkk) -* Added pet license usage permissions to `trustedadmin` and `owner` groups. Do note that this has a high network usage and can be easily be abused so it is not recommended to give out this permission to lower level groups. (@moisterrific) -* Removed checks that prevented people placing personal storage tiles in SSC as the personal storage is synced with the server. (@Patrikkk) -* Cleaned up a check in Bouner OnTileEdit where it checks for using the respective item when placing a tile to make it clearer. This change also fixed the issue in a previous commit where valid replace action was caught. Moved the check for max tile/wall types to the beginning of the method. (@Patrikkk) -* Improved clarity for insufficient permission related error messages. (@moisterrific) -* Removed redundant Boulder placement check that prevented placing chests on them, as it is no longer possible to place a chest on a boulder, so nothing crashes the server. "1.2.3: Boulders with Chests on them no longer crash the game if the boulder is hit." (@kevzhao2, @Patrikkk) -* `/itemban` - `/projban` - `/tileban` - Added a `default:` case to the commands so an invalid subcommand promts the player to enter the help subcommand to get more information on valid subcommands. (@Patrikkk) -* `/world` - Renamed to /worldinfo to be more accurate to it's function. Command now displays the world's `Seed`. Reformatted the world information so each line isn't repeatedly starting with "World". (@Patrikkk) -* `/who` - Changed the display format of the online players when the `-i` flag is used. From `PlayerName (ID: 0, ID: 0)` to `PlayerName (Index: 0, Account ID: 0)` for clarification. (@Patrikkk) -* Added DisplayDollItemSync event. An event that is called when a player modifies the slot of a DisplayDoll (Mannequin). This event provides information about the current item in the displaydoll, as well as the item that the player is about to set. (@Patrikkk) -* Added DisplayDollItemSyncHandler, which checks for building permissions of the player at the position of the DisplayDoll. (If they do not have permissions, it means they are hacking as they could not even open the doll in the first place.) (@Patrikkk) -* Added RequestTileEntity packet handling. (@Patrikkk) - * Implemented the OnRequestTileEntityInteraction even hook in GetDataHandler. (@Patrikkk) - * Created RequestTileEntityInteractionHandler which checks for building permissions when the player is attempting to open a display doll (Mannequin) or a Hat Rack. This now prevents players from opening a Mannequin or a Hat Rack if they have no building permissions at the position of these tile entities. As of 1.4.0.5, these are the only two items that use this packet. (@Patrikkk) - -## TShock 4.4.0 (Pre-release 11) -* Added new permission `tshock.tp.pylon` to enable teleporting via Teleportation Pylons (@QuiCM) -* Added new permission `tshock.journey.research` to enable sharing research via item sacrifice (@QuiCM) -* Add Emoji event to GetDataHandler. This packet is received when a player tries to display an emote. (@Patrikkk) - * Added EmojiHandler to handle an exploit. Adding `tshock.sendemoji` permission and checks. Added this permission to guest group by default. (@Patrikkk) -* Handled SyncCavernMonsterType packet to prevent an exploit where players could modify the server's cavern monster types and make the server spawn any NPCs - including bosses - onto other players. (@Patrikkk) -* Added LandGolfBallInCup event which is accessible for developers to work with, as well as LandGolfBallInCup handler to handle exploits where players could send direct packets to trigger and imitate golf ball cup landing anywhere in the game world. Added two public lists in Handlers.LandGolfBallInCupHandler: GolfBallProjectileIDs and GolfClubItemIDs. (@Patrikkk) -* Added SyncTilePicking event. This is called when a player damages a tile. Implementing SyncTilePickingHandler and patching tile damaging related exploits. (Preventing player sending invalid world position data which disconnects other players.) -* Fixed the issue where mobs could not be fished out during bloodmoon because of Bouncer checks. (@Patrikkk) - * Fixed the issue where certain fishing rods could not fish out NPCs due to a Bouncer check. (@Patrikkk) -* Update for OTAPI 2.0.0.37 and Terraria 1.4.0.5. (@hakusaro, @Patrikkk) -* Added additional config options for automatically kicking clients from the server upon breaking anti-cheat thresholds. (@moisterrific) -* Added pylon teleportation permission to default group, added `/spawn` permission to admin group, added the new journey mode research permission to trustedadmin, and moved all previous journey mode permissions from owner to trustedadmin. (@moisterrific) - -## TShock 4.4.0 (Pre-release 10) -* Fixed all rope coils. (@Olink) -* Fixed a longstanding issue with SendTileSquare that could result in desyncs and visual errors. (@QuiCM) -* Fixed placement issues with Item Frames, Teleportation Pylons, etc. (@QuiCM) -* Fixed doors, and they are good now for real probably. (@QuiCM, @Hakusaro, @Olink) -* Bumped default max damage received cap to 42,000 to accommodate the Empress of Light's instant kill death amount. (@hakusaro, @moisterrific, @Irethia, @Ayrawei) -* Updated `/spawnboss` command to include Empress of Light, Queen Slime, and other additional bosses that have a health bar. (@moisterrific) - -## TShock 4.4.0 (Pre-release 9) -* Fixed pet licenses. (@Olink) -* Added initial support for Journey mode in SSC worlds. (@Olink) -* Made TShock database MySQL 8 compatible by escaping column names in our IQueryBuilder code. (Name `Groups` is a reserved element in this version, which is used in our `Region` table.) (@Patrikkk) -* Reintroduced `-worldselectpath` per feedback from @fjfnaranjo. This command line argument should be used to specify the place where the interactive server startup will look for worlds to show on the world select screen. The original version of this argument, `-worldpath`, was removed because several game service providers have broken configurations that stop the server from running with an unhelpful error. This specific configuration was `-world` and `-worldpath`. In the new world, you can do the following: - * `-worldselectpath` should be used if you want to customize the server interactive boot world list (so that you can select from a number of worlds in non-standard locations). - * `-world` will behave as an absolute path to the world to load. This is the most common thing you want if you're starting the server and have a specific world in mind. - * `-worldselectpath` and `-worldname` should work together enabling you to select from a world from the list that you specify. This is *not* a world file name, but a world name as described by Terraria. - * `-worldselectpath` is identical to the old `-worldpath`. If you specify `-worldselectpath` and `-world` without specifying an absolute path the server will crash for sure. - * Thank you again to @fjfnaranjo for supplying a [detailed feature request](https://github.com/Pryaxis/TShock/issues/1914) explaining precisely why this option should be available. Without this, we would have had no context as to why this feature was useful or important. Thank you, @fjfnaranjo! - * This change was implemented by (@QuiCM, @hakusaro). -* Updated Bouncer to include Sparkle Slime debuff that can be applied to town NPCs. (@moisterrific) -* Updated `/spawnboss` command to include Empress of Light, Queen Slime, and other additional bosses that have a health bar. (@moisterrific) -* Added journey mode permissions to owner group by default. (@moisterrific) -* Fixed kick on hardcore death / kick on mediumcore death / ban on either from taking action against journey mode players. (@hakusaro) -* Attempted to fix the problem with the magic mirror spawn problems. You should be able to remove your spawn point in SSC by right clicking on a bed now. (@hakusaro, @AxeelAnder) -* Added HandleFoodPlatterTryPlacing event, which is called whenever a player places a food in a plate. Add antihack to bouncer, to prevent removing food from plates if the region is protected; To prevent placement if they are not in range; To prevent placement if the item is not placed from player hand. (@Patrikkk) -* Fixed an offset error in NetTile that impacted `SendTileSquare`. It was being read as a `byte` and not a `ushort`. (@QuiCM) -* Fixed coins not dropping after being picked up by npcs. The ExtraValue packet was not being read correctly. (@Olink) -* Removed packet monitoring from debug logs. To achieve the same results, install @QuiCM's packet monitor plugin (it does better things). (@hakusaro) -* Updated packet monitoring in send tile square handler for Bouncer debugging. (@hakusaro) -* Added `/sync`, activated with `tshock.synclocalarea`. This is a default guest permission. When the command is issued, the server will resync area around the player in the event of a desync issue. (@hakusaro) - * If your doors disappear, this command will allow a player to resync without having to disconnect from the server. - * The default group that gets this permission is `Guest` for the time being. - * To add this command to your guest group, give them `tshock.synclocalarea`, with `/group addperm guest tshock.synclocalarea`. - * This command may be removed at any time in the future (and will likely be removed when send tile square handling is fixed). -* Add FishOutNPC event handler, which is called whenever a player fishes out an NPC using a fishing rod. Added antihack to Bouncer, to prevent unathorized and invalid mob spawning, by checking player action, NPC IDs and range. (@Patrikkk, @moisterrific) -* Fixed smart door automatic door desync and deletion issue. (@hakusaro) - -## TShock 4.4.0 (Pre-release 8) -* Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle) -* Fixed /wind command. (@AxeelAnder) -* Fixed NPC debuff issue when attempting to fight bosses resulting in kicks. (@AxeelAnder) -* Fixed players are unable to remove an NPC. Change `byte NPCHomeChangeEventArgs.Homeless` to `HouseholdStatus NPCHomeChangeEventArgs.HouseholdStatus`. (@AxeelAnder) -* Fixed lava, wet, honey, and dry bombs; - and lava, wet, honey, and dry grenades; - and lava, wet, honey, and dry rockets; - and lava, wet, honey, and dry mines. (@Olink) -* Fix Bloody Tear displaying the wrong text when used. (@Olink) -* Fix the visibility toggle for the last two accessory slots. (@Olink) -* Adding Journey mode user account permissions. Journey mode must be enabled for these to have any effect. (@Patrikkk) - * `tshock.journey.time.freeze` - * `tshock.journey.time.set` - * `tshock.journey.time.setspeed` - * `tshock.journey.godmode` - * `tshock.journey.wind.strength` - * `tshock.journey.wind.freeze` - * `tshock.journey.rain.strength` - * `tshock.journey.rain.freeze` - * `tshock.journey.placementrange` - * `tshock.journey.setdifficulty` - * `tshock.journey.biomespreadfreeze` - * `tshock.journey.setspawnrate` -* Changed default thresholds for some changes in the config file to accommodate new items & changes to Terraria. (@hakusaro) -* Store projectile type in `ProjectileStruct RecentlyCreatedProjectiles` to identify the recently created projectiles by type. Make `RecentlyCreatedProjectiles` and `ProjectileStruct` public for developers to access from plugins. - -## TShock 4.4.0 (Pre-release 7 (Entangled)) -* Fixed bed spawn issues when trying to remove spawn point in SSC. (@Olink) -* Fixed Snake Flute. (@Olink) -* Fixed lava absorbant sponge not capturing lava. `LiquidSetEventArgs` now returns a `LiquidType` instead of a byte type. (@hakusaro) -* Fixed bottomless lava bucket from not being able to create lava. (@hakusaro) - * Ban a lava bucket to ban lava on the server entirely, until we figure out a better way to handle liquids. -* Fixed scarab bombs not detonating on pick style tiles. (@hakusaro) -* Fixed dirt bombs not creating dirt. (@hakusaro) -* Added a ridiculous amount of debug information. If you're experiencing any problems with 1.4 items being caught by the TShock anticheat system, please turn on DebugLogs in your config file and capture log data. It'll be extremely helpful in narrowing down precisely how to fix your problem. (@hakusaro) -* Released with entangled support for 1.4.0.4 based on @Patrikkk local build and latest snapshot gen-dev. (@hakusaro) - -## TShock 4.4.0 (Pre-release 6) -* Updates to OTAPI 2.0.0.35 (@DeathCradle). - -## TShock 4.4.0 (Pre-release 5) -* Update player spawn related things to 1.4. `Terraria.Player.Spawn` method now has a required argument, `PlayerSpawnContext context`. (@AxeelAnder) -* Make sqlite db path configurable. (@AxeelAnder) -* Terraria 1.4.0.3 experimental support. (@Patrikkk) -* Updated changelog. (@hakusaro) - -## TShock 4.4.0 (Pre-release 4) -* Debug logging now provides ConsoleDebug and ILog has been updated to support the concept of debug logs. Debug logs are now controlled by `config.json` instead of by preprocessor debug flag. (@hakusaro) -* Removed `/confuse` command and Terraria player data resync from @Zidonuke. (@hakusaro) -* Attempted to fix the player desync issue by changing `LastNetPosition` logic and disabling a check in Bouncer that would normally reject player update packets from players. (@QuiCM, @hakusaro) - -## TShock 4.4.0 (Pre-release 3) -* Fixed `/worldmode` command to correctly target world mode. (@Ristellise) -* The following commands have been removed: `tbloodmoon`, `invade`, `dropmeteor`. `fullmoon`, `sandstorm`, `rain`, `eclipse` -* The following command has been added to replace them: `worldevent`. This command requires the `tshock.world.events` permission. - * `worldevent` can be used as so: `worldevent [event type] [sub type] [wave (if invasion event)]` - * Valid event types are `meteor`, `fullmoon`, `bloodmoon`, `eclipse`, `invasion`, `sandstorm`, `rain` - * Valid sub types are `goblins`, `snowmen`, `pirates`, `pumpkinmoon`, `frostmoon` for invasions, and `slime` for rain. - -* A new set of permissions has been added under the node `tshock.world.events`: - * `tshock.world.events.bloodmoon`: Enables access to the `worldevent bloodmoon` command - * `tshock.world.events.fullmoon`: Enables access to the `worldevent fullmoon` command - * `tshock.world.events.invasion`: Enables access to the `worldevent invasion` command - * `tshock.world.events.eclipse`: Enables access to the `worldevent eclipse` command - * `tshock.world.events.sandstorm`: Enables access to the `worldevent sandstorm` command - * `tshock.world.events.rain`: Enables access to the `worldevent rain` command - * `tshock.world.events.meteor`: Enables access to the `worldevent meteor` command - -Please note that the permissions previously tied to the removed commands are also still used to confirm access to the new commands, so if you have existing configurations no one should have any new or lost access. - -## TShock 4.4.0 (Pre-release 2) -* Replaced `/expert` with `/worldmode` command. (@QuiCM) -* Fixed NPC buff anticheat issue conflicting with Terraria gameplay changes (whips). (@Patrikkk) - -## TShock 4.4.0 (Pre-release 1) -* Added confused debuff to Bouncer for confusion applied from Brain of Confusion -* API: Added return in OnNameCollision if hook has been handled. (@Patrikkk) -* API: Added hooks for item, projectile and tile bans (@deadsurgeon42) -* API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42) -* API: New WorldGrassSpread hook which shold allow corruption/crimson/hallow creep config options to work (@DeathCradle) -* Fixed a missing case in UserManager exception handling, which caused a rather cryptic console error instead of the intended error message (@deadsurgeon42) -* Fixed saving when one player is one the server and another one joins (@MarioE) -* Fixed /spawnmob not spawning negative IDs (@MarioE) -* Validated tile placement on PlaceObject; clients can no longer place frames, paintings etc with dirt blocks (@bartico6, @ProfessorXZ) -* Updated to new stat tracking system with more data so we can actually make informed software decisions (Jordan Coulam) -* Fixed /time display at the end of Terraria hours (@koneko-nyan) -* Added a warning notifying users of the minimum memory required to run TShock (@bartico6) -* Added /group rename to allow changing group names (@ColinBohn, @ProfessorXZ) -* Added /region rename and OnRegionRenamed hook (@koneko-nyan, @deadsurgeon42) -* Rebuilt /ban add. New syntax is /ban add [time] [reason] where target is the target online player, offline player, or IP; where time is the time format or 0 for permanent; and where [reason] is the reason. (@hakusaro) -* Removed /ban addip and /ban addtemp. Now covered under /ban add. (@hakusaro) -* Added /su, which temporarily elevates players with the tshock.su permission to super admin. In addition added, a new group, owner, that is suggested for new users to setup TShock with as opposed to superadmin. Finally, /su is implemented such that a 10 minute timeout will occur preventing people from just camping with it on. (@hakusaro) -* Added /sudo, which runs a command as the superadmin group. If a user fails to execute a command but can sudo, they'll be told that they can override the permission check with sudo. Much better than just telling them to run /su and then re-run the command. (@hakusaro) -* Fixed /savessc not bothering to save ssc data for people who bypass ssc. (@hakusaro) -* Default permission sets for new databases are more modern. (@hakusaro) -* Added the ability to ban by account name instead of just banning a character name assuming its an account name. (@hakusaro) -* Fixed a bug in the CommandLineParser which caused some command lines to fail (@QuicM) -* Renamed TShock.DB.User to TShock.DB.UserAccount, including all the related methods, classes and events. (@Ryozuki) -* Update OTAPI to 2.0.0.31, which also updates Newtonsoft.Json to 10.0.3 (@Ryozuki) -* Fixed DumpItems() from trying to dump older versions of certain items (negative item IDs). (@Zaicon) -* Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro) -* Added DateTime datatype support for both MySQL and SQLite. (@Ryozuki) -* Fixed builds to not require a specific version of OTAPI and to not fail when in Release mode (@bartico6) -* Update Assembly Company to Pryaxis (@Ryozuki) -* Removed `/restart` command. (@hakusaro) -* Removed `Permissions.updateplugins` permission. (@hakusaro) -* Removed REST `/v3/server/restart/` route and `/server/restart/` route. (@hakusaro) -* The "auth system" is now referred to as the initial setup system (what it actually is). This is better verbiage for basically all situations. Who really wants to turn off the "authentication system?" In addition, the system now makes it more clear what the point of it is, rather than that it grants permissions. (@hakusaro) -* `GetDataHandlers.SendTileSquare` hook now sends a `TSPlayer` and a `MemoryStream` of raw data. (@hakusaro) -* Added `GetDataHandlers.HealOtherPlayer` hook. (@hakusaro) -* Added `GetDataHandlers.PlaceObject` hook. (@hakusaro) -* `GetDataHandlers.KillMe` now sends a `TSPlayer` and a `PlayerDeathReason`. (@hakusaro) -* Added `GetDataHandlers.ProjectileKill` hook. (@hakusaro) -* Removed `TShock.CheckProjectilePermission`. (@hakusaro) -* Added `TSPlayer` object to `GetDataHandlers.LiquidSetEventArgs`. (@hakusaro) -* Removed `TShock.StartInvasion` for public use (moved to Utils and marked internal). (@hakusaro) -* Fixed invasions started by TShock not reporting size correctly and probably not working at all. (@hakusaro) -* Removed `GetDataHandlers.TileKill` and replaced it with `GetDataHandlers.PlaceChest` as the packet originally designated as tile kill is now only used for chests. (@hakusaro) -* Added `TSPlayer` to `GetDataHandlers.NPCHome`. (@hakusaro) -* Added `TSPlayer` to `GetDataHandlers.ChestItemChanged`. (@hakusaro) -* Fixed chest item changes not triggering any range checks, tile checks, or correct chest checks. (@hakusaro) -* Added `TSPlayer` to `GetDataHandlers.PlayerBuff`. (@hakusaro) -* Added `TSPlayer` and `PlayerDeathReason` to `GetDataHandlers.PlayerDamage`. (@hakusaro) -* Added `TSPlayer` to `GetDataHandlers.NPCStrike`. (@hakusaro) -* Added `TSPlayer` to `GetDataHandlers.PlayerAnimation`. (@hakusaro) -* Added `GetDataHandlers.MassWireOperation` hook and related arguments. (@hakusaro) -* Added `GetDataHandlers.PlaceTileEntity` hook and related arguments. (@hakusaro) -* Added `TSPlayer` to `GetDataHandlers.GemLockToggle`. (@hakusaro) -* Added `GetDataHandlers.PlaceItemFrame` hook and related arguments. (@hakusaro) -* Added `TSPlayer.IsBouncerThrottled()`. (@hakusaro) -* Added `TSPlayer.IsBeingDisabled()` and removed `TShock.CheckIgnores(TSPlayer)`. (@hakusaro) -* Added `TSPlayer.CheckIgnores()` and removed `TShock.CheckIgnores(TSPlayer)`. (@hakusaro) -* Hooks inside TShock can now be registered with their `Register` method and can be prioritized according to the TShock HandlerList system. (@hakusaro) -* Fix message requiring login not using the command specifier set in the config file. (@hakusaro) -* Move `TShock.CheckRangePermission()` to `TSPlayer.IsInRange` which **returns the opposite** of what the previous method did (see updated docs). (@hakusaro) -* Move `TShock.CheckSpawn` to `Utils.IsInSpawn`. (@hakusaro) -* Replace `TShock.CheckTilePermission` with `TSPlayer.HasBuildPermission`, `TSPlayer.HasPaintPermission`, and `TSPlayer.HasModifiedIceSuccessfully` respectively. (@hakusaro) -* Fix stack hack detection being inconsistent between two different check points. Moved `TShock.HackedInventory` to `TSPlayer.HasHackedItemStacks`. Added `GetDataHandlers.GetDataHandledEventArgs` which is where most hooks will inherit from in the future. (@hakusaro) -* All `GetDataHandlers` hooks now inherit from `GetDataHandledEventArgs` which includes a `TSPlayer` and a `MemoryStream` of raw data. (@hakusaro) -* Removed _all obsolete methods in TShock marked obsolete prior to this version (all of them)_ (@hakusaro). -* Removed broken noclip detection and attempted prevention. TShock wasn't doing a good job at stopping noclip. It's always worse to claim that you do something that you can't/don't do, so removing this is better than keeping broken detection in. (@hakusaro) -* Replaced `Utils.FindPlayer` with `TSPlayer.FindByNameOrID` to more appropriately be object orientated. (@hakusaro) -* Moved `Utils.Kick()` to `TSPlayer` since its first argument was a `TSPlayer` object. (@hakusaro) -* Removed `Utils.ForceKick()`. (@hakusaro) -* Removed `Utils.GetPlayerIP()`. (@hakusaro) -* Moved `Utils.Ban()` to `TSPlayer.Ban()`. (@hakusaro) -* Moved `Utils.SendMultipleMatchError()` to `TSPlayer.SendMultipleMatchError`. (@hakusaro) -* Removed `Utils.GetPlayers()`. Iterate over the TSPlayers on the server and make your own list. -* Removed `Utils.HasBanExpired()` and replaced with `Bans.RemoveBanIfExpired()`. (@hakusaro) -* Removed `Utils.SendFileToUser()` and replaced with `TSPlayer.SendFileTextAsMessage()`. (@hakusaro) -* Removed `Utils.GetGroup()` also have you seen `Groups.GetGroupByName()`? (@hakusaro) -* `Utils.MaxChests()` is now `Utils.HasWorldReachedMaxChests()`. (@hakusaro) -* `Utils.GetIPv4Address()` is now `Utils.GetIPv4AddressFromHostname()`. (@hakusaro) -* Fixed the disappearing problem when placing tile entities. (@mistzzt) -* Removed the stat tracking system. (@hakusaro) -* Fixed erroneous kicks and bans when using `KickOnMediumcoreDeath` and `BanOnMediumcoreDeath` options. (@DankRank) -* Removed `TSPlayer.InitSpawn` field. (@DankRank) -* `OnPlayerSpawn`'s player ID field is now `PlayerId`. (@DankRank) -* Fixed null reference console spam in non-SSC mode (@QuiCM) -* `Utils.TryParseTime` can now take spaces (e.g., `3d 5h 2m 3s`) (@QuiCM) -* Enabled banning unregistered users (@QuiCM) -* Added filtering and validation on packet 96 (Teleport player through portal) (@QuiCM) -* Update tracker now uses TLS (@pandabear41) -* When deleting an user account, any player logged in to that account is now logged out properly (@Enerdy) -* Add NPCAddBuff data handler and bouncer (@AxeelAnder) -* Improved config file documentation (@Enerdy) -* Add PlayerZone data handler and bouncer (@AxeelAnder) -* Update sqlite binaries to 32bit 3.27.2 for Windows (@hakusaro) -* Fix banned armour checks not clearing properly (thanks @tysonstrange) -* Added warning message on invalid group comand (@hakusaro, thanks to IcyPhoenix, nuLLzy & Cy on Discord) -* Moved item bans subsystem to isolated file/contained mini-plugin & reorganized codebase accordingly. (@hakusaro) -* Moved bouncer checks for item bans in OnTileEdit to item bans subsystem. (@hakusaro) -* Compatibility with Terraria 1.4.0.2 (@AxeelAnder, @Patrikkk) - * Multiple fields got slightly renamed. - * Modifying ToggleExpert command. Main.expertMode is no longer settable. Using a Main.GameMode int property comparsion. - * GameCulture no longer has static fields to get local language. Using methods to return/compare language. - * Added permission "tshock.npc.spawnpets" which restricts pet spawns. This can cause high network load, so it's restricted. (@hakusaro) - * Updated OnTeleport to support new args per protocol changes. (@hakusaro) - * Disabled anticheat checks for projectile updates due to issues with game changes. (@hakusaro) - * This update has been brought to you by: Patrikkk, Icy, Chris, Death, Axeel, Zaicon, hakusaro, and Yoraiz0r! <3 - -## TShock 4.3.26 -* Removed the stat tracking system. (@hakusaro) -* Updated SQLite binaries. (@hakusaro) -* Removed server-sided healing when disabled. (@QuiCM) -* Patched an exploit that allowed users to kill town NPCs (@QuiCM) -* [API] Added a patch for the 0-length crash (@QuiCM) - -## 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. - -## TShock 4.3.24 -* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) -* Updated Terraria Server API to 1.3.5.3 (@QuiCM, @hakusaro) -* Updated TShock core components to 1.3.5.3 (@hakusaro) -* Terraria Server API version tick: 2.1 -* Added OnNpcKilled hook to Server API: 2.2 (@tylerjwatson) -* Added CreateCombatTextExtended to PacketTypes. This packet allows for the same functionality that packet 82 (CreateCombatText) used to have. (@QuiCM) -* Updated ServerBroadcast hook to provide a NetworkText object. (@tylerjwatson) -* Fixed levers and things not updating properly. (@deathcradle) -* Deprecated PacketTypes.ChatText. Chat is now handled using the NetTextModule and packet 82. (@QuiCM, @Hakusaro) -* Removed the -lang command-line flag from TShock. It is now a vanilla feature. (@hakusaro) - -## TShock 4.3.23 -* Added evil type option during world creation (@mistzzt) -* Bans can be sorted. TShock's default sorting will retrieve bans sorted from newest to oldest based on the date the ban was added (@QuiCM) -* Resolved issues with mob and item spawning. Thanks to @OnsenManju for your investigative work :) (@QuiCM) -* Patched a crashing exploit (@Simon311) - -## TShock 4.3.22 -* Compatibility with Terraria 1.3.4.4 -* API: Version tick 2.0 -* API: Reduced RAM usage by ~80MB (Large server) (@deathcradle) -* API: Added TSPlayer.KillPlayer() (@QuiCM) -* API: Added TSPlayer.Logout() (@ProfessorXZ) -* Fixed connections after max slot is reached (@DeathCradle) -* Fixed server crashes caused by client disconnections when attempting to read closed sockets (@Enerdy) -* Added some code to make trapdoors work better (@DogooFalchion) -* AllowCutTilesAndBreakables config option now correctly allows flowers/vines/herbs to be cut in regions without breaking walls (@QuiCM) -* REST: `/v3/players/read` now includes a `muted` field (@QuiCM) -* REST: Token creation is now more secure (Thanks to @Plazmaz for reporting the issue!) -* REST: Deprecated the RestRequestEvent. If you use this event, please let us know. -* REST: ALL endpoints now have a base route (eg you can use `/server/motd` instead of `/v3/server/motd`). These base routes will never change, but will provide an `upgrade` field describing any newer routes -* REST: Added `/v3/world/autosave` and `/v3/world/bloodmoon` which use GET parameter style arguments. I.e., `/v3/world/autosave?state=[true|false]` & `/v3/world/bloodmoon?state=[true|false]`. The state argument is optional -* Fixed fishing quests not saving/loading correctly when login before join, UUID login, and SSC were enabled together (@DogooFalchion) - -## TShock 4.3.21 -* Compatibility with Terraria 1.3.4.3 (@Patrikkk, @Zaicon). -* API: Version tick 1.26. -* API: Deprecated PlayerDamage and PlayerKillMe packets (now uses PlayerHurtV2 and PlayerDeathV2). -* API: Main.rand now uses UnifiedRandom instead of Random. This WILL break any existing plugin that uses Main.rand. -* Fixed HealOtherPlayer packet exploit (@Simon311). -* Added associated config option for HealOtherPlayer exploit prevention (@Simon311). -* Added `/accountinfo` command to get account information for a given TShock account (@Simon311). -* Removed TShock color parsing from MOTDs (@QuiCM). -* Fixed butterfly statues spawning catchable butterflies (@DogooFalchion). -* Implemented some missing balance changes lost in prior version patches (@DogooFalchion). -* Added alias for server shutdown command: stop (@nicatronTg). -* Removed the old REST model. This includes the following endpoints: - * `/status` - * `/v2/players/read` - * `/v2/server/rawcmd` (@QuiCM). -* Fixed `/user group` always giving an unhelpful error messaging telling you to check the console, even if we knew exactly why it failed (@nicatronTg). -* Removed _all obsolete methods in TShock marked obsolete prior to this version (all of them)_ (@nicatronTg). -* Fixed issue where registration + login would fail because KnownIps had 0 items and .Last() doesn't work on collections with 0 items (@DogooFalchion, @nicatronTg, @Simon311). -* Added `/uploadssc [player]` which allows someone to upload SSC data for [player] and store it on the server. Adds `tshock.ssc.upload` and `tshock.ssc.upload.others` permission nodes to match (@DogooFalchion). -* Added hardened stone to the whitelist of tiles editable by players (@DogooFalchion). -* Added conversion system to send convert old MOTD format into smart text, while preserving initial line starting values to keep byte optimization for background colors Thanks to (@QuiCM, @Simon311, and especially @DogooFalchion) for the hard work on this issue. - -## TShock 4.3.20 -* Security improvement: The auth system is now automatically disabled if a superadmin exists in the database (@Enerdy). -* Removed the `auth-verify` command since `auth` now serves its purpose when necessary (@Enerdy). -* Security: `/"` exploit can no longer break chat mute filters (@Simon311). -* Fixed an issue where sometimes players could connect briefly during server shutdown, leading to errors (@Simon311). -* Fixed wyverns despawning & not behaving like normal (@QuiCM). -* Fixed major security issue where InvokeClientConnect could be exploited to do terrible, terrible things (@Simon311, @nicatronTg, @popstarfreas, @ProfessorXZ, @QuiCM). - -## TShock 4.3.19 -* Compatibility with Terraria 1.3.3.3 (@Simon311) -* API: Version tick 1.25 -* API: Resolved some issues with the ItemForceIntoChest hook (@QuiCM, @Patrikkk) -* API: Resolved some shonky code that caused Vitamins and other Ankh Shield related items to drop at strange rates or not at all (@ProfessorXZ, @QuiCM, @nicatronTg) -* Fixed magical ice blocks not working correctly (@ProfessorXZ) - -## TShock 4.3.18 - -* Compatibility with Terraria 1.3.3.2 -* API: Version tick 1.24 -* API: Fixed chat line breaks when using chat tags and long strings of text (@ProfessorXZ) -* API: Added ItemForceIntoChest hook (@QuiCM) -* API: Included the player's registration date in REST's players/read endpoints (@ProfessorXZ) -* The setdungeon command correctly uses tshock.world.setdungeon as its permission (@OnsenManju) -* Fixed clients being able to "Catch" and remove NPCs (@ProfessorXZ) -* Fixed clients being able to remove other players' portals (@ProfessorXZ) -* Fixed possible client crashes caused by invalid item netIDs (@ProfessorXZ) -* Fixed players being able to bypass permission checks when placing Tile Entities (@ProfessorXZ) -* Fixed players being able to bypass permission checks when placing items in Item Frames (@ProfessorXZ) -* Fixed a bug involving Item Frames which allowed players to duplicate items (@ProfessorXZ) -* Fixed an issue allowing clients to teleport NPCs to arbitrary locations (@ProfessorXZ) -* Fixed a bug where players would get teleported to their previous location after dismounting the Unicorn Mount (@ProfessorXZ) -* Players can no longer quick stack items into region protected chests (@ProfessorXZ) -* Rope placement is no longer blocked by range checks (@ProfessorXZ) -* The Drill Containment Unit breaks blocks properly now (@ProfessorXZ) -* Fixed item duplications caused by range checks and invalid netIDs (@ProfessorXZ) -* Fixed Expert mode coin duplication (@ProfessorXZ) -* Players are no longer able to place liquids using LoadNetModule packet (@ProfessorXZ) -* Explosives are no longer blocked by range checks (@ProfessorXZ) -* Players can no longer bypass tile checks by using the Tile packet (@ProfessorXZ) -* Fixed a bug where players couldn't hammer a Junction Box without "allowclientsideworldedit" permission (@Patrikkk) -* Fixed the client's UI not being draw when setting wind speed to abnormal values (@ProfessorXZ) -* Added a command to start and stop sandstorms (@QuiCM) - -## TShock 4.3.17 - -* Compatibility with Terraria 1.3.2.1 -* Updated superadmin behaviour to conform to expected behaviour (@QuiCM, @Patrikk) -* Fixed a crash involving teleporters and dressers (@QuiCM) -* Fixed pressure plates (@Enerdy, @Patrikk) -* Fixed a deadlock in wiring (@Wolfje) -* Fixed a crash in wiring (@Patrikk) -* Improved network syncing on client joins (@Patrikk) -* The Presserator can now place actuators (@ProfessorXZ) -* Resolved a region error when removing unlisted users from regions (@QuiCM) -* Added a `SetDungeon` command to set the dungeon position (@webmilio) -* The currently running world name is now part of the server application's title (@webmilio) -* Gem locks can now be region protected (@mistzzt) -* Players can now place sensors (@mistzzt) -* Repackaged GeoIP with TShock so that GeoIP works (@Enerdy) -* Added permissions to use sundials and start/stop parties (@Patrikk) -* Added an announcement box hook (@mistzzt) -* Added the ability to choose what type of world (crimson/corruption) you generate (@NoNiMad) - -## TShock 4.3.16 - -* Terraria 1.3.1 wiring bugfixes -* Terraria 1.3.1.1 compatibility - -## TShock 4.3.15 - -* This release is actually 4.3.14, but was ticked extra due to a version issue on gen-dev prior to master push. -* Update to 1.3.1 - -## TShock 4.3.13 - -* Fixed an issue preventing TShock from starting on certain mono versions (@Wolfje) -* Fixed a deadlock in Wiring (@Wolfje) -* Fixed character styles/gender not being saved properly on first login while SSC is on (@QuiCM) -* Added a PlayerPermission hook fired whenever a permission check involving said player occurs (when the new TSPlayer.HasPermission method is called) (@Enerdy) -* Resolved an issue where martian invasions and eclipses would have empty messages if AnonymousBossInvasions was set to true (@QuiCM) -* Added an optional `slime` parameter to the `rain` command, allowing slime rain to be started and stopped. New syntax is `rain [slime] ` (@QuiCM) -* Fixed performance issues due to concurrent dictionary access in TSPlayer (@CoderCow) -* Added an ID property to Regions (@QuiCM) -* Fixed an issue where region sizes were calculated incorrectly (@QuiCM) -* Fixed a bug in RegionManager preventing regions adding correctly (@pink_panther) -* Fixed another bug in RegionManager preventing regions adding correctly (@QuiCM) -* Fixed a routing issue with the `/v2/token/create` REST endpoint -* Removed the `/token/create` REST endpoint. `/v2/token/create` should be used instead. - -## TShock 4.3.12 - -* Fixed issues with TSPlayer.SetTeam not working (@QuiCM) -* Fixed /butcher not killing bosses in expert difficulty (@QuiCM) -* API: Deprecated PacketBufferer (now obviated by SendQ) (@QuiCM) -* API: Building on Windows no longer breaks traps (@Wolfje) -* Fixed bombs, dynamite, and sticky bombs (@Wolfje) -* Removed spammy messages from OnSecondUpdate that confused some server owners (@Wolfje) -* Rewrote some stat tracker code to send actually relevant data to the stats server (@Cleant / George from Multiplay UK) -* Added an opt-out command line switch to disable the stat tracker (--stats-optout) (@Cleant / George from Multiplay UK) -* Added a unique provider token which can be passed to the stat tracker (--provider-token [token]) for tracking servers from the same GSP. (@Cleant / George from Multiplay UK) - -## TShock 4.3.11 - -* This release is actually 4.3.10, but was ticked extra due to a version issue on gen-dev prior to master push. - -## TShock 4.3.10 - -This version features a drop-in tile replacement system by @Wolfje that reduces RAM requirements -by up to 70% on all worlds and CPU requirements up to 10% in the running process. - -* Large worlds: from 700MB-1GB -> ~325MB -* Medium worlds: from 500MB -> ~200MB -* Small worlds: from 400MB -> ~125MB - -Other notable changes include: - -* API: **Drop-in tile storage replacement system** (@Wolfje) -* API: Fixed some possible packet leaks in sendq (@Wolfje) -* API: APIVersion 1.22 -* API: Added crash protection around malicious and/or invalid packets (@Wolfje) -* API: Fixed worlds not loading sometimes (@tysonstrange) -* API: Fixed living leaf walls not working as housing -* Fixed an issue preventing some players from joining when the world is saving (@Wolfje) -* Fixed an issue adding a ban on a player who has previously been banned (@Wolfje) -* Fixed /invade martian (@Wolfje) -* Fixed target dummies not working properly (@QuiCM) -* Added a config option (DisableSecondUpdateLogs) to prevent log spam from OnSecondUpdate() (@QuiCM) -* Added RESTful API login rate limiting (@George) -* Added config options (MaximumRequestsPerInterval, RequestBucketDecreaseIntervalMinutes, LimitOnlyFailedLoginRequests) for rate limiting (@George) -* **DEPRECATION**: Deprecated Disable(string, bool) and added Disable(string, DisableFlags). Please update your plugins accordingly (@QuiCM) -* Fixed Halloween and Christmas events not working properly (@TomyLobo) -* Fixed the demon heart's extra accessory slot not working correctly in SSC (@QuiCM) -* Fixed gender-changing potions not working correctly in SSC (@hastinbe) -* Fixed IP bans not working correctly (@hastinbe) -* Fixed /reload not using the correct permission (@QuiCM) -* Fixed TSPlayer.ActiveChest not being tracked correctly resulting in item dupes while disabled (@QuiCM) -* /reload now reloads tile and projectile bans - -## TShock 4.3.8 -* API: Update to Terraria 1.3.0.8 (@Patrikkk) -* **API: Added a crash reporter which collects memory dumps on Windows** (@Wolfje) -* API: New commandline param: `-crashdir` - Writes crash reports to the specified directory (@Wolfje) -* API: Sendq now doesn't disconnect people when it cant send a packet (@Wolfje) -* API: Fixed more crashes on disconnect in sendq (@Wolfje) -* API: Now ignores unknown server packets (@Wolfje) -* API: Potentially removed arithmetic overflows in server (@Wolfje) - -### Using the Crash Reporter - -TShock now has a crash reporter built in which writes crash logs to the `crashes` directory -in the event of a catastrophic failure. **To change where TShock writes its crash logs, -specify the `-crashdir` parameter on the command line**. - -1. In the event of a crash, look for a file called `crash_xxxx.zip` in the `crashes` directory -2. Upload the file somewhere, beware the crash file may be quite large (>100MB), anywhere like google drive, dropbox or mega will be fine -3. Post a link to the crash with reproduction steps in the TShock support forum - -Alternatively, if you do not want to report the crash, just delete the file. - -## TShock 4.3.7 - -* Auth system kicks players if system is disabled. (@nicatronTg) -* Fixed /login permitting multiple logins without a logout in between. (@nicatronTg) -* Allow[Hallow/Corruption/Crimson]Creep in config now work. (@QuiCM) -* API: Treasure bags are now named properly. (@QuiCM) -* API: Clients no longer close on disconnect. (@Wolfje) -* API: Add server broadcast hook. (@Patrikk) -* API: Fixed pressure plate hook triggering multiple times. (@Patrikk) -* API: Fixed issues with SendQ writes failing. (@Wolfje) -* API: Version tick to 1.21 - -## TShock 4.3.6 - -* API: NPCs shoot the right way (@QuiCM) -* API: The server config file works correctly with priority and port (@Patrikkk) -* API: Removed support for favorites and removed JSON dependencies. (@Enerdy) -* API: Removed support for clouds. (@Enerdy) -* API: Fixed a whole lot of bugs with wiring, and in general re-wrote some core bits that were bugged. (@QuiCM) -* API: Fixed projectile AI bugs. (@AndrioCelos) -* API: Fixed world saving problems. (WhiteXZ) -* API: Fixed server not accepting more connections once max slots was filled. (@QuiCM) -* API: Removed startup parameters and moved them to TShock. (@Cleant) -* API: Item.SetDefaults() no longer kills some tools. (@Enerdy) -* API: Restored chat bubbles. (@QuiCM) -* API: Updated to 1.3.0.6. (@Enerdy & @Patrikkk) -* API: Lots and I mean lots of network improvements in the SendQ department. (@tylerjwatson) -* API: Added NpcLootDrop and DropBossBag hooks. (@Patrikkk) -* API: Fixed hook: NpcTriggerPressurePlate (@Patrikkk) -* API: Fixed hook: ProjectileTriggerPressurePlate (@Patrikkk) -* API: Fixed hook: ItemSetDefaultsString (@Patrikkk) -* API: Fixed hook: ItemSetDefaultsInt (@Patrikkk) -* API: Fixed hook: ItemNetDefaults (@Patrikkk) -* API: Fixed hook: GameStatueSpawn (@Patrikkk) -* API: Fixed hook: NpcNetDefaults (@Patrikkk) -* API: Fixed hook: NpcNetSetDefaultsString (@Patrikkk) -* API: Fixed hook: NpcNetSetDefaultsInt (@Patrikkk) -* API: Fixed hook: NpcSpawn (@Patrikkk) -* API: Fixed hook: NpcTransformation (@Patrikkk) -* API: Fixed hook: NpcStrike (@Patrikkk) -* API: Updated AssemblyInfo to 1.3.0.6. (@nicatronTg) -* API: Moved to .NET Framework 4.5. (@tylerjwatson) -* API: Dedicated server input thread doesn't run if input is redirected/piped. (@tylerjwatson) -* API: Wiring.cs methods are now public. (@Stealownz) -* API: Added PlayerTriggerPressurePlate hook. (@Patrikkk) -* API: API Version Tick to 1.20. -* The config option disabling the DCU has been deprecated and will be removed in a future release. (@nicatronTg) -* Fixed bubble tile triggering noclip checks. (@Enerdy) -* Updated projectile handling in GetDataHandlers. (@QuiCM) -* Fixed issue #992. (@QuiCM) -* Teleport handler now handles wormholes. (@QuiCM) -* Fixed tall gates and trap doors (issue #998). (@QuiCM) -* Added monoliths to orientable tiles (issue #999). (@QuiCM) -* Fixed vortex stealth armor (issue #964). (@QuiCM) -* Added moon lord to spawn boss. (@QuiCM) -* Fixed serverpassword syntax error error message. (@JordyMoos) -* Fixed issue #1019. (@QuiCM) -* Fix: Region protection prevents placement of objects. (@Patrikkk) -* Moved all startup parameters to TShock. (@Cleant) -* Fix: Target dummies are no longer butchered. (@Denway) -* Added projectile 465 to the ignore list, which fixes some other issues. (@Enerdy) -* Fix: Logging out is now safe with SSC (/logout) (issue #1037). (@QuiCM) -* API/TShock: Removed -world parameter from TShock, put it back in the API. (@tylerjwatson) - -## TShock 4.3.5 - -* Fix HandleSpawnBoss, and as a result the spawnboss command and boss spawning items. (@Ijwu) -* Rewrite SendQ for more network stack improvements (@tylerjwatson) -* Update to Terraria 1.3.0.5 (@Patrikkk) - -## TShock 4.3.4 - -* Fix invasion progress messages (@QuiCM) -* Completely rewrite SendQ to have less deadlocks (@tylerjwatson) - -## TShock 4.3.3 - -* Fix dihydrogen monoxide (@tylerjwatson) -* Whitelist another boss projectile (@Patrikkk, @QuiCM) - -## TShock 4.3.2 - -* Fixed the issue where using the Super Absorbent Sponge would disable users (@QuiCM) -* Fixed an issue in NetGetData where e.Length - 1 would be -1 (@QuiCM) -* Fixed /who -i and /userinfo (@Enerdy) -* API: OnRegionEntered hook now returns the region entered (@Patrikkk) -* Support for Terraria 1.3.0.4 (@nicatronTg) -* Fixed dressers being unbreakable. (@nicatronTg) -* Fixed wall placement mechanics (@nicatronTg, @Ijwu, @QuiCM) -* Fixed Moon Lord projectiles disabling players (@k0rd, @nicatronTg) -* Fixed several potential crashes in server (@Patrikkk) -* Fixed -autocreate command line argument (@QuiCM, @nicatronTg) -* Added more world data to world load menu (@QuiCM) -* Moved server password to TShock config (@Enerdy) -* Fixed world delete in server (@benjiro) -* Fixed disappearing NPCs (@QuiCM) -* Added much more performant code, SendQ, to server module. Reduces downstream network overhead by at least 40% (@tylerjwatson) -* API: Updated TSPlayer.Disable to use new buffs (@Enerdy) -* Updated default max damage & projectile damage to 1,175 (based on 625 people) -* Fixed support for SSC (@QuiCM) - -## TShock 4.3.1 - -* Fixed a bug where /user group failing would output no error. (@nicatronTg) -* Fixed a bug where /user group would fail. @(Enerdy) -* Added the ability to disable backup autosave messages. (@nicatronTg) -* Fixed /buff malfunctioning when entering an invalid buff name. (@Enerdy) -* Fixed projectiles 435-438 (martian invasion) freezing everyone under certain conditions. (@Enerdy) -* DisableTombstones now works properly with the new golden gravestones. (@Enerdy) -* REST module now properly catches exceptions during Start(). (@Patrikkk) -* Added /expert command to toggle expert mode. (@QuiCM) -* Fixed pirate invasions. (@patrik) -* Fixed worldinfo packet. (@QuiCM) -* Fixed server passwords. (@Enerdy) - -## TShock 4.3.0.0 - -* API: Modifed NetItem so that it's actually useful. (@MarioE) -* Updated prebuilts (SQLite, JSON, MySQL) to latest versions. (@nicatronTg) -* Added a minimum password length to prevent blank passwords. (@nicatronTg) -* Modified item ban checks to provide which item is disabling a player in the logs. (@Enerdy) -* API: Modified TSPlayer to store a user, and deprecated calls to TSPlayer.User.ID. (@QuiCM) -* Modified chat color specs in config file to be int arrays rather than floats. (@nicatronTg) -* Modified verbiage for ```/auth``` and ```/auth-verify``` to make it clearer how they operate. (@nicatronTg) -* API: Added fuzzy name searching for users. (@QuiCM) -* API: Fixed ```OnPlayerLogout``` not being fired when a player disconnects. (@nicatronTg) -* API: Deprecated ```ValidString``` and ```SanitizeString``` methods in Utils. (@nicatronTg) -* Added BCrypt password hashing and related systems for it. BCrypt replaces the old system using non-password hashing algorithms for storing passwords. It breaks implementations of the login code that were manually recreated, but is otherwise seamless in transition. (@nicatronTg) -* API: Added ```User.VerifyPassword(string password)``` which verifies if the user's password matches their stored hash. It automatically upgrades a users' password to BCrypt if called and the password stored is not a BCrypt hash. (@nicatronTg) -* API: Deprecated ```Utils.HashPassword``` and related password hashing functions as those are no longer needed for plugin access. (@nicatronTg) -* Fixed ```UseServerName``` config option so that it correctly sends the config server name any time that Main.WorldName is used. (@Olink) -* Fixed a bug where people could ban themselves. (@nicatronTg) -* Fixed a bug where banning a player who never logged in caused problems. (@nicatronTg) -* Terraria 1.3.0.3 support. +The changelog has moved to the wiki. In lieu of this, please put the text you want in the changelog in your PR description. It will be added to the wiki after we merge your PR. From de30678153574f11f9e159f4e0e1f80605bb2f7e Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 12 Mar 2025 06:03:35 +0900 Subject: [PATCH 35/45] Update PR template to remove changelog --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 473130c4..c742723a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,3 @@ - + From 4e26051869b0e4350f043ae6022f9c885f658008 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sat, 15 Mar 2025 14:09:00 +0900 Subject: [PATCH 36/45] Fix some confusion introduced by 98eed42 and b184133 --- TShockAPI/DB/CharacterManager.cs | 2 +- TShockAPI/GetDataHandlers.cs | 16 ++++++++++++---- TShockAPI/Permissions.cs | 4 ++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs index e9e1974a..c0551b65 100644 --- a/TShockAPI/DB/CharacterManager.cs +++ b/TShockAPI/DB/CharacterManager.cs @@ -79,7 +79,7 @@ namespace TShockAPI.DB public PlayerData GetPlayerData(TSPlayer player, int acctid) { - PlayerData playerData = new PlayerData(false); + PlayerData playerData = new PlayerData(true); try { diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index f4b04954..a4969cf0 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3619,8 +3619,9 @@ namespace TShockAPI return false; } - private static readonly int[] invasions = { -1, -2, -3, -4, -5, -6, -7, -8, -10, -11 }; + private static readonly int[] invasions = { -1, -2, -3, -4, -5, -6, -7, -8, -10 }; private static readonly int[] pets = { -12, -13, -14, -15 }; + private static readonly int[] upgrades = { -11, -17, -18 }; private static bool HandleSpawnBoss(GetDataHandlerArgs args) { if (args.Player.IsBouncerThrottled()) @@ -3632,8 +3633,8 @@ namespace TShockAPI var plr = args.Data.ReadInt16(); var thingType = args.Data.ReadInt16(); - var isKnownBoss = thingType > 0 && thingType < Terraria.ID.NPCID.Count && NPCID.Sets.MPAllowedEnemies[thingType]; - if ((isKnownBoss || thingType == -16) && !args.Player.HasPermission(Permissions.summonboss)) + var isKnownBoss = (thingType > 0 && thingType < Terraria.ID.NPCID.Count && NPCID.Sets.MPAllowedEnemies[thingType]) || thingType == -16; + if (isKnownBoss && !args.Player.HasPermission(Permissions.summonboss)) { TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawnBoss rejected boss {0} {1}", args.Player.Name, thingType)); args.Player.SendErrorMessage(GetString("You do not have permission to summon bosses.")); @@ -3654,6 +3655,13 @@ namespace TShockAPI return true; } + if (upgrades.Contains(thingType) && !args.Player.HasPermission(Permissions.worldupgrades)) + { + TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawnBoss rejected upgrade {0} {1}", args.Player.Name, thingType)); + args.Player.SendErrorMessage(GetString("You do not have permission to use permanent boosters.")); + return true; + } + if (plr != args.Player.Index) return true; @@ -3720,7 +3728,7 @@ namespace TShockAPI break; } - if (NPCID.Sets.MPAllowedEnemies[thingType]) + if (thingType < 0 || isKnownBoss) { if (TShock.Config.Settings.AnonymousBossInvasions) TShock.Utils.SendLogs(thing, Color.PaleVioletRed, args.Player); diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 4dd84c67..59df7182 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -346,9 +346,13 @@ namespace TShockAPI [Description("User can change the homes of NPCs.")] public static readonly string movenpc = "tshock.world.movenpc"; + [Obsolete("Feature no longer available.")] [Description("User can convert hallow into corruption and vice-versa.")] public static readonly string converthardmode = "tshock.world.converthardmode"; + [Description("User can use world-based permanent boosters like Advanced Combat Techniques")] + public static readonly string worldupgrades = "tshock.world.worldupgrades"; + [Description("User can force the server to Halloween mode.")] public static readonly string halloween = "tshock.world.sethalloween"; From ea5c274279f2f7b93aad06e968a39489c6f4a231 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Sat, 15 Mar 2025 14:21:28 +0900 Subject: [PATCH 37/45] Add default permissions --- TShockAPI/DB/GroupManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index ed90a11a..4a9f8afb 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -74,6 +74,7 @@ namespace TShockAPI.DB Permissions.canchangepassword, Permissions.canlogout, Permissions.summonboss, + Permissions.worldupgrades, Permissions.whisper, Permissions.wormhole, Permissions.canpaint, From 29477ab305446bfed28e6a8e3e4df82ffdb336db Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 15 Mar 2025 17:33:04 +0900 Subject: [PATCH 38/45] Update version codename --- TShockAPI/TShock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 8e467973..bd2a113e 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -63,7 +63,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 = "Better late than never!"; + public static readonly string VersionCodename = "Stargazer"; /// 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 988042e6c1473f4b2451ce0cd35fb16845127e8d Mon Sep 17 00:00:00 2001 From: LaoSparrow Date: Mon, 17 Mar 2025 22:12:54 +0800 Subject: [PATCH 39/45] fix(Bouncer/SendTileRectHandler): two typos which causes incorrect validating range --- TShockAPI/Handlers/SendTileRectHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs index d66c3ef6..089d74f2 100644 --- a/TShockAPI/Handlers/SendTileRectHandler.cs +++ b/TShockAPI/Handlers/SendTileRectHandler.cs @@ -269,7 +269,7 @@ namespace TShockAPI.Handlers private MatchResult MatchPlacement(TSPlayer player, TileRect rect) { - for (int x = rect.X; x < rect.Y + rect.Width; x++) + for (int x = rect.X; x < rect.X + rect.Width; x++) { for (int y = rect.Y; y < rect.Y + rect.Height; y++) { @@ -303,7 +303,7 @@ namespace TShockAPI.Handlers private MatchResult MatchStateChange(TSPlayer player, TileRect rect) { - for (int x = rect.X; x < rect.Y + rect.Width; x++) + for (int x = rect.X; x < rect.X + rect.Width; x++) { for (int y = rect.Y; y < rect.Y + rect.Height; y++) { From 413a2b91e3cfd9600cdca0272696ae316c720f41 Mon Sep 17 00:00:00 2001 From: SGKoishi Date: Tue, 18 Mar 2025 17:17:45 +0900 Subject: [PATCH 40/45] Fix Pryaxis/TShock#3073 --- TShockAPI/Bouncer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index bfcd1836..89ccf7bc 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -1199,18 +1199,18 @@ namespace TShockAPI int index = args.Index; float[] ai = args.Ai; + // Clients do send NaN values so we can't just kick them + // See https://github.com/Pryaxis/TShock/issues/3076 if (!float.IsFinite(pos.X) || !float.IsFinite(pos.Y)) { - TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile force kicked (attempted to set position to infinity or NaN) from {0}", args.Player.Name)); - args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile rejected set position to infinity or NaN from {0}", args.Player.Name)); args.Handled = true; return; } if (!float.IsFinite(vel.X) || !float.IsFinite(vel.Y)) { - TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile force kicked (attempted to set velocity to infinity or NaN) from {0}", args.Player.Name)); - args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true); + TShock.Log.ConsoleInfo(GetString("Bouncer / OnNewProjectile rejected set velocity to infinity or NaN from {0}", args.Player.Name)); args.Handled = true; return; } From 57a3173a4d577cf50c6fe9577188ad6ae2a0be52 Mon Sep 17 00:00:00 2001 From: Cai <13110818005@qq.com> Date: Fri, 4 Apr 2025 01:58:55 +0800 Subject: [PATCH 41/45] fix(SpawnHandler): player "break" after respawning --- TShockAPI/GetDataHandlers.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index a4969cf0..6ed0f8de 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2778,6 +2778,9 @@ namespace TShockAPI return false; } + // spawn the player before teleporting + NetMessage.SendData((int)PacketTypes.PlayerSpawn, -1, args.Player.Index, null, args.Player.Index, (int)PlayerSpawnContext.ReviveFromDeath); + // the player has not changed his spawnpoint yet, so we assert the server-saved spawnpoint // by teleporting the player instead of letting the game use the client's incorrect spawnpoint. TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpawn force ssc teleport for {0} at ({1},{2})", args.Player.Name, args.TPlayer.SpawnX, args.TPlayer.SpawnY)); From 76b6f56a8fe44962112e9a2be801ad0fa7a7c0ba Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Tue, 6 May 2025 11:51:59 +0200 Subject: [PATCH 42/45] feat: Add spawning pets perm to default group Add permission for users to spawn pets for default usergroup. --- TShockAPI/DB/GroupManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 4a9f8afb..44f0c994 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -74,6 +74,7 @@ namespace TShockAPI.DB Permissions.canchangepassword, Permissions.canlogout, Permissions.summonboss, + Permissions.spawnpets, Permissions.worldupgrades, Permissions.whisper, Permissions.wormhole, From bd2aafe01a99e1a682074ec5989647735e88a433 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 7 May 2025 15:25:49 +0200 Subject: [PATCH 43/45] Fix console title not updating and world not saving when the last player disconnects --- TShockAPI/TShock.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index bd2a113e..e2dd3aa1 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1469,8 +1469,8 @@ namespace TShockAPI Hooks.PlayerHooks.OnPlayerLogout(tsplr); } - // The last player will leave after this hook is executed. - if (Utils.GetActivePlayerCount() == 1) + // If this is the last player online, update the console title and save the world if needed + if (Utils.GetActivePlayerCount() == 0) { if (Config.Settings.SaveWorldOnLastPlayerExit) SaveManager.Instance.SaveWorld(); From e12950b50e5a2fb557df57a75a3989cffc576f2e Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Thu, 8 May 2025 09:00:49 +0900 Subject: [PATCH 44/45] Add workflow for notifying discord for wiki changes --- .github/workflows/wiki-notify.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/wiki-notify.yml diff --git a/.github/workflows/wiki-notify.yml b/.github/workflows/wiki-notify.yml new file mode 100644 index 00000000..835c5b40 --- /dev/null +++ b/.github/workflows/wiki-notify.yml @@ -0,0 +1,13 @@ +name: Wiki Changed Discord Notification + +on: + gollum + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - uses: 'oznu/gh-wiki-edit-discord-notification@dfc866fd048f04c239ad113eef3c6c73504d333e' + with: + discord-webhook-url: ${{ secrets.DISCORD_WEBHOOK_WIKI_EDIT }} + ignore-collaborators: false From 952a6685b10e61a61264f452cdfd8330667448e0 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 9 May 2025 16:28:53 +0900 Subject: [PATCH 45/45] Version tick: 5.2.4 --- TShockAPI/TShock.cs | 2 +- TShockAPI/TShockAPI.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e2dd3aa1..0771bbfe 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -63,7 +63,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 = "Stargazer"; + public static readonly string VersionCodename = "Hopefully SSC works somewhat correctly now edition"; /// 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"; diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index a01bb022..eb7894b7 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -18,11 +18,11 @@ 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) --> - 5.2.3 + 5.2.4 TShock for Terraria Pryaxis & TShock Contributors TShockAPI - Copyright © Pryaxis & TShock Contributors 2011-2023 + Copyright © Pryaxis & TShock Contributors 2011-2025 True GPL-3.0-or-later