From 207b43e77217c25e520a3fe56b4f4a82f614061b Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Fri, 16 Apr 2021 06:11:26 +0200 Subject: [PATCH 01/13] Update /godmode to use JourneyMode Godmode power. - Previous Bouncer checks for GodMode (namely, Hurt) were removed. - The command now uses the GodmodePower from core Terraria - The toggle powers (which this command will now make use of) are now reset on disconnect to prevent accidentally "gifting" godmode to an unsuspecting player. --- TShockAPI/Commands.cs | 6 ++++++ TShockAPI/GetDataHandlers.cs | 10 ---------- TShockAPI/TShock.cs | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 20c21f26..d1b1f32c 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -37,6 +37,8 @@ using OTAPI.Tile; using TShockAPI.Localization; using System.Text.RegularExpressions; using Terraria.DataStructures; +using Terraria.GameContent.Creative; +using static Terraria.GameContent.Creative.CreativePowers; namespace TShockAPI { @@ -6445,6 +6447,10 @@ namespace TShockAPI playerToGod.GodMode = !playerToGod.GodMode; + var god_power = CreativePowerManager.Instance.GetPower(); + + god_power.SetEnabledState(playerToGod.Index, playerToGod.GodMode); + if (playerToGod == args.Player) { args.Player.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer")); diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index deac632f..879e02ce 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2571,10 +2571,6 @@ namespace TShockAPI args.Player.PlayerData.maxHealth = max; } - if (args.Player.GodMode && (cur < max)) - { - args.Player.Heal(args.TPlayer.statLifeMax2); - } return false; } @@ -3733,12 +3729,6 @@ namespace TShockAPI if (OnPlayerDamage(args.Player, args.Data, id, direction, dmg, pvp, crit, playerDeathReason)) return true; - if (TShock.Players[id].GodMode) - { - TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerDamageV2 rejected (god mode on) {0}", args.Player.Name); - TShock.Players[id].Heal(args.TPlayer.statLifeMax); - } - return false; } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 52bef011..211efbc5 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -44,6 +44,7 @@ using TShockAPI.Sockets; using TShockAPI.CLI; using TShockAPI.Localization; using TShockAPI.Configuration; +using Terraria.GameContent.Creative; namespace TShockAPI { @@ -1216,6 +1217,23 @@ namespace TShockAPI Players[args.Who] = null; + //Reset toggle creative powers to default, preventing potential power transfer & desync on another user occupying this slot later. + + foreach(var kv in CreativePowerManager.Instance._powersById) + { + var power = kv.Value; + + //No need to reset sliders - those are reset manually by the game, most likely an oversight that toggles don't receive this treatment. + + if (power is CreativePowers.APerPlayerTogglePower toggle) + { + if (toggle._perPlayerIsEnabled[args.Who] == toggle._defaultToggleState) + continue; + + toggle.SetEnabledState(args.Who, toggle._defaultToggleState); + } + } + if (tsplr.ReceivedInfo) { if (!tsplr.SilentKickInProgress && tsplr.State >= 3) From 3b58b0ad1610ef57f9439d1f5de5114f3ac47263 Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Fri, 16 Apr 2021 06:30:12 +0200 Subject: [PATCH 02/13] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 743141af..31bb1005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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) ## TShock 4.5.0.1 * Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK) From 4a28d6779fa720a3782b2184e7522aa80bcf2167 Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Fri, 16 Apr 2021 07:01:11 +0200 Subject: [PATCH 03/13] Update casing & remove using static - god_power -> godPower - Remove using static on GameContent.CreativePowers, instead fully qualify the nested class. --- TShockAPI/Commands.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index d1b1f32c..c59c4962 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -38,7 +38,6 @@ using TShockAPI.Localization; using System.Text.RegularExpressions; using Terraria.DataStructures; using Terraria.GameContent.Creative; -using static Terraria.GameContent.Creative.CreativePowers; namespace TShockAPI { @@ -6447,9 +6446,9 @@ namespace TShockAPI playerToGod.GodMode = !playerToGod.GodMode; - var god_power = CreativePowerManager.Instance.GetPower(); + var godPower = CreativePowerManager.Instance.GetPower(); - god_power.SetEnabledState(playerToGod.Index, playerToGod.GodMode); + godPower.SetEnabledState(playerToGod.Index, playerToGod.GodMode); if (playerToGod == args.Player) { From 78b72df79d2333b58589093d5b1b6457526d39fb Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Fri, 16 Apr 2021 10:14:46 +0200 Subject: [PATCH 04/13] Address JourneyMode Godmode issues - Add /ungodme to allow unstucking godmode for involuntarily godmodded characters - Warn player about disabling Godmode before disconnecting - Minor change to command format to reduce code copypaste. --- TShockAPI/Commands.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index c59c4962..d10ec1c3 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -545,6 +545,11 @@ namespace TShockAPI { HelpText = "Toggles godmode on a player." }); + add(new Command("", ForceUngod, "ungodme") + { + HelpText = "Removes godmode from your character.", + AllowServer = false + }); add(new Command(Permissions.heal, Heal, "heal") { HelpText = "Heals a player in HP and MP." @@ -6450,15 +6455,20 @@ namespace TShockAPI godPower.SetEnabledState(playerToGod.Index, playerToGod.GodMode); - if (playerToGod == args.Player) - { - args.Player.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer")); - } - else + if (playerToGod != args.Player) { args.Player.SendSuccessMessage(string.Format("{0} is {1} in god mode.", playerToGod.Name, playerToGod.GodMode ? "now" : "no longer")); - playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", playerToGod.GodMode ? "now" : "no longer")); } + + playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer")); + playerToGod.SendInfoMessage("Please make sure to disable godmode using /ungodme before disconnecting, otherwise your character may remain in godmode indefinitely, including singleplayer."); + } + + private static void ForceUngod(CommandArgs args) + { + var godPower = CreativePowerManager.Instance.GetPower(); + + godPower.SetEnabledState(args.Player.Index, false); } #endregion Cheat Comamnds From 3e40ade0ca2c6a391801baad31afb4e7108b081b Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Fri, 16 Apr 2021 10:18:40 +0200 Subject: [PATCH 05/13] Added feedback to /ungodme - The command now tells the user that the operation succeeded. Previously it would be a silent command, potentially leaving the user wondering if it worked --- TShockAPI/Commands.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index d10ec1c3..3bff1f2b 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -6469,6 +6469,8 @@ namespace TShockAPI var godPower = CreativePowerManager.Instance.GetPower(); godPower.SetEnabledState(args.Player.Index, false); + + args.Player.SendSuccessMessage("Journey Godmode has been disabled on your character."); } #endregion Cheat Comamnds From 663041e8b06446dc0afe0e6dcefdf0535b0b31af Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Sat, 17 Apr 2021 10:07:48 +0200 Subject: [PATCH 06/13] Fix /r against offline players. - Offline players will no longer be valid /r targets. --- CHANGELOG.md | 1 + TShockAPI/Commands.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31bb1005..86dc96b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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) ## TShock 4.5.0.1 * Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 3bff1f2b..7d2a42d2 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5366,12 +5366,16 @@ namespace TShockAPI { args.Player.SendErrorMessage("You are muted."); } - else if (args.Player.LastWhisper != null) + else if (args.Player.LastWhisper != null && args.Player.LastWhisper.Active) { var msg = string.Join(" ", args.Parameters); args.Player.LastWhisper.SendMessage(String.Format(" {1}", args.Player.Name, msg), Color.MediumPurple); args.Player.SendMessage(String.Format(" {1}", args.Player.LastWhisper.Name, msg), Color.MediumPurple); } + else if (args.Player.LastWhisper != null) + { + args.Player.SendErrorMessage("The player you're attempting to reply to is no longer online."); + } else { args.Player.SendErrorMessage("You haven't previously received any whispers. Please use {0}whisper to whisper to other people.", Specifier); From e80f0bfda5ea8e846517ee1f295ac18bcac3fb0c Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Mon, 19 Apr 2021 21:48:34 +0930 Subject: [PATCH 07/13] Add ban ticket ID to ban messages --- TShockAPI/Commands.cs | 2 +- TShockAPI/DB/BanManager.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 20c21f26..37b950e7 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1522,7 +1522,7 @@ namespace TShockAPI if (banResult?.Ban != null) { - player.Disconnect($"You have been banned: {banResult.Ban.Reason}."); + player.Disconnect($"#{banResult.Ban.TicketNumber} - You have been banned: {banResult.Ban.Reason}."); } } diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 5777e84c..220d778e 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -205,12 +205,12 @@ namespace TShockAPI.DB { if (ban.ExpirationDateTime == DateTime.MaxValue) { - player.Disconnect("You are banned: " + ban.Reason); + player.Disconnect($"#{ban.TicketNumber} - You are banned: {ban.Reason}"); return true; } TimeSpan ts = ban.ExpirationDateTime - DateTime.UtcNow; - player.Disconnect($"You are banned: {ban.Reason} ({ban.GetPrettyExpirationString()} remaining)"); + player.Disconnect($"#{ban.TicketNumber} - You are banned: {ban.Reason} ({ban.GetPrettyExpirationString()} remaining)"); return true; } From 01fc41968d730ad0d62afbd9b14442e3fc8db8a5 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Mon, 19 Apr 2021 22:04:41 +0930 Subject: [PATCH 08/13] Refactor `wallow` command & update changelog --- CHANGELOG.md | 2 ++ TShockAPI/Commands.cs | 27 ++++++++++++--------------- TShockAPI/TSPlayer.cs | 5 +++++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86dc96b9..7d10dc45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index d7a6350d..e71d604c 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5309,8 +5309,6 @@ namespace TShockAPI args.Player.SendFileTextAsMessage(FileTools.RulesPath); } - public static bool[] WDisabled { get; set; } = new bool[256]; - public static void Whisper(CommandArgs args) { if (args.Parameters.Count < 2) @@ -5334,12 +5332,12 @@ namespace TShockAPI else { var plr = players[0]; - var msg = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1); - if (WDisabled[players[0].Index]) + if (!plr.AcceptingWhispers) { - args.Player.SendErrorMessage("This player has disabled people from sending whispers!"); + args.Player.SendErrorMessage("This player is not accepting whispers."); return; } + var msg = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1); plr.SendMessage(String.Format(" {1}", args.Player.Name, msg), Color.MediumPurple); args.Player.SendMessage(String.Format(" {1}", plr.Name, msg), Color.MediumPurple); plr.LastWhisper = args.Player; @@ -5347,17 +5345,11 @@ namespace TShockAPI } } - public static void Wallow(CommandArgs args) + private static void Wallow(CommandArgs args) { - int index = args.Player.Index; - if (WDisabled[index]) - { - args.Player.SendSuccessMessage("You will now recieve whispers from other players!"); - WDisabled[index] = !WDisabled[index]; - return; - } - WDisabled[index] = !WDisabled[index]; - args.Player.SendSuccessMessage("You will now not recieve whispers from other players, type '/wallow' to recieve them again!"); + args.Player.AcceptingWhispers = !args.Player.AcceptingWhispers; + args.Player.SendSuccessMessage($"You {(args.Player.AcceptingWhispers ? "may now" : "will no longer")} receive whispers from other players."); + args.Player.SendSuccessMessage($"You can toggle this with the '{Specifier}wallow' command."); } private static void Reply(CommandArgs args) @@ -5368,6 +5360,11 @@ namespace TShockAPI } else if (args.Player.LastWhisper != null && args.Player.LastWhisper.Active) { + if (!args.Player.LastWhisper.AcceptingWhispers) + { + args.Player.SendErrorMessage("This player is not accepting whispers."); + return; + } var msg = string.Join(" ", args.Parameters); args.Player.LastWhisper.SendMessage(String.Format(" {1}", args.Player.Name, msg), Color.MediumPurple); args.Player.SendMessage(String.Format(" {1}", args.Player.LastWhisper.Name, msg), Color.MediumPurple); diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 4c24468b..68d8e306 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -599,6 +599,11 @@ namespace TShockAPI public bool SilentJoinInProgress; + /// + /// Whether the player is accepting whispers from other users + /// + public bool AcceptingWhispers = true; + /// Checks if a player is in range of a given tile if range checks are enabled. /// The x coordinate of the tile. /// The y coordinate of the tile. From f8c265d74cd6431f810c492051ab2479ee3eb6ed Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 19 Apr 2021 10:54:12 -0700 Subject: [PATCH 09/13] Version tick: 4.5.1 --- CHANGELOG.md | 3 +++ TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d10dc45..a8092a6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes +* This could be you! + +## TShock 4.5.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) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 1e1ba3db..56449c50 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -53,5 +53,5 @@ using System.Runtime.InteropServices; // Also, be sure to release on github with the exact assembly version tag as below // so that the update manager works correctly (via the Github releases api and mimic) -[assembly: AssemblyVersion("4.5.0.1")] -[assembly: AssemblyFileVersion("4.5.0.1")] +[assembly: AssemblyVersion("4.5.1")] +[assembly: AssemblyFileVersion("4.5.1")] From fb62110b76d3b81c3264676fb965462ab45d0d94 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Apr 2021 19:43:35 -0700 Subject: [PATCH 10/13] Add preliminary support for Terraria 1.4.2.2 --- CHANGELOG.md | 2 +- TerrariaServerAPI | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8092a6a..7b4b877e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes -* This could be you! +* Added preliminary support for Terraria 1.4.2.2. (@hakusaro) ## TShock 4.5.1 * Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM, reported by @ATFGK) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index e0302513..96c1bc95 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit e0302513009220a8d92ba12c867a401e7731d28a +Subproject commit 96c1bc95fe7526b294f65dc711a1494b5869c9ea From 4668ab86a03525c4121ae4110376b9ae0aeaf8e2 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Apr 2021 19:52:37 -0700 Subject: [PATCH 11/13] Version tick: 4.5.2 --- CHANGELOG.md | 2 ++ TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- TShockAPI/TShock.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4b877e..8ea08860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change. ## Upcoming changes + +## TShock 4.5.2 * Added preliminary support for Terraria 1.4.2.2. (@hakusaro) ## TShock 4.5.1 diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 56449c50..b8a1fbb0 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -53,5 +53,5 @@ using System.Runtime.InteropServices; // Also, be sure to release on github with the exact assembly version tag as below // so that the update manager works correctly (via the Github releases api and mimic) -[assembly: AssemblyVersion("4.5.1")] -[assembly: AssemblyFileVersion("4.5.1")] +[assembly: AssemblyVersion("4.5.2")] +[assembly: AssemblyFileVersion("4.5.2")] diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 211efbc5..c60e5961 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -58,7 +58,7 @@ namespace TShockAPI /// VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info. public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version; /// VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions. - public static readonly string VersionCodename = "Stealownz + DeathCradle edition"; + public static readonly string VersionCodename = "April Lyrids 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"; From 6bb4230bc3d3b5d811649f19790f68baf2c8ed51 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Apr 2021 20:10:24 -0700 Subject: [PATCH 12/13] Remove /ungodme With 1.4.2.2, we no longer need to offer an escape hatch due to the underlying bug involving godmode being permanently applied to local players now having been fixed. --- CHANGELOG.md | 1 + TShockAPI/Commands.cs | 20 ++++---------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ea08860..b73ffbe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## TShock 4.5.2 * Added preliminary support for Terraria 1.4.2.2. (@hakusaro) +* Removed `/ungodmode` and godmode warning (no longer necessary). Also, godmode now supports silent commands. (@hakusaro) ## TShock 4.5.1 * Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM, reported by @ATFGK) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index e71d604c..601c2591 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -545,11 +545,6 @@ namespace TShockAPI { HelpText = "Toggles godmode on a player." }); - add(new Command("", ForceUngod, "ungodme") - { - HelpText = "Removes godmode from your character.", - AllowServer = false - }); add(new Command(Permissions.heal, Heal, "heal") { HelpText = "Heals a player in HP and MP." @@ -6461,17 +6456,10 @@ namespace TShockAPI args.Player.SendSuccessMessage(string.Format("{0} is {1} in god mode.", playerToGod.Name, playerToGod.GodMode ? "now" : "no longer")); } - playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer")); - playerToGod.SendInfoMessage("Please make sure to disable godmode using /ungodme before disconnecting, otherwise your character may remain in godmode indefinitely, including singleplayer."); - } - - private static void ForceUngod(CommandArgs args) - { - var godPower = CreativePowerManager.Instance.GetPower(); - - godPower.SetEnabledState(args.Player.Index, false); - - args.Player.SendSuccessMessage("Journey Godmode has been disabled on your character."); + if (!args.Silent || (playerToGod == args.Player)) + { + playerToGod.SendSuccessMessage(string.Format("You are {0} in god mode.", args.Player.GodMode ? "now" : "no longer")); + } } #endregion Cheat Comamnds From 8a3a339976ebbf053e818f101521491e17906006 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 21 Apr 2021 20:22:11 -0700 Subject: [PATCH 13/13] Fix silly changelog typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b73ffbe5..31049680 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## TShock 4.5.2 * Added preliminary support for Terraria 1.4.2.2. (@hakusaro) -* Removed `/ungodmode` and godmode warning (no longer necessary). Also, godmode now supports silent commands. (@hakusaro) +* Removed `/ungodme` and godmode warning (no longer necessary). Also, godmode now supports silent commands. (@hakusaro) ## TShock 4.5.1 * Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM, reported by @ATFGK)