From 0f42b42d8772171af80c0cc32270bc8fdb225acf Mon Sep 17 00:00:00 2001 From: Terrabade Date: Sun, 7 Feb 2021 21:19:16 +0000 Subject: [PATCH 01/40] Change serverinfo "WinVer" to "Operating system" --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 82aa71dd..8d1217cf 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1148,7 +1148,7 @@ namespace TShockAPI args.Player.SendInfoMessage("Memory usage: " + Process.GetCurrentProcess().WorkingSet64); args.Player.SendInfoMessage("Allocated memory: " + Process.GetCurrentProcess().VirtualMemorySize64); args.Player.SendInfoMessage("Total processor time: " + Process.GetCurrentProcess().TotalProcessorTime); - args.Player.SendInfoMessage("WinVer: " + Environment.OSVersion); + args.Player.SendInfoMessage("Operating system: " + Environment.OSVersion); args.Player.SendInfoMessage("Proc count: " + Environment.ProcessorCount); args.Player.SendInfoMessage("Machine name: " + Environment.MachineName); } From e707ced801ce35e98f855e1f4c399e3e7928eb81 Mon Sep 17 00:00:00 2001 From: Bade <57917043+Terrabade@users.noreply.github.com> Date: Sun, 21 Feb 2021 10:10:29 +0000 Subject: [PATCH 02/40] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index abffc6c8..1f34631c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## 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) ## TShock 4.4.0 (Pre-release 15) * Overhauled Bans system. Bans are now based on 'identifiers'. (@QuiCM) From 709997b72830487c32566a84d6b38b9bff9630c4 Mon Sep 17 00:00:00 2001 From: Nova4334 <68127614+Nova4334@users.noreply.github.com> Date: Sun, 21 Mar 2021 01:59:44 +0100 Subject: [PATCH 03/40] Rewriting /grow; Adding /wallow --- TShockAPI/Commands.cs | 359 ++++++++++++++++++++++++++++++++++++--- TShockAPI/Permissions.cs | 3 + 2 files changed, 336 insertions(+), 26 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 8d1217cf..6e8b1b95 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -585,6 +585,11 @@ namespace TShockAPI { HelpText = "Sends a PM to a player." }); + add(new Command(Permissions.whisper, Wallow, "wallow") + { + AllowServer = false, + HelpText = "Toggles to either ignore or recieve whispers from other players." + }); add(new Command(Permissions.createdumps, CreateDumps, "dump-reference-data") { HelpText = "Creates a reference tables for Terraria data types and the TShock permission system in the server folder." @@ -5283,14 +5288,15 @@ namespace TShockAPI args.Player.SendFileTextAsMessage(FileTools.RulesPath); } - private static void Whisper(CommandArgs args) + public static bool[] WDisabled { get; set; } = new bool[256]; + + public static void Whisper(CommandArgs args) { if (args.Parameters.Count < 2) { - args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}whisper ", Specifier); + args.Player.SendErrorMessage("Invalid syntax! Proper usage: /whisper "); return; } - var players = TSPlayer.FindByNameOrID(args.Parameters[0]); if (players.Count == 0) { @@ -5308,6 +5314,11 @@ namespace TShockAPI { var plr = players[0]; var msg = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1); + if (WDisabled[players[0].Index]) + { + args.Player.SendErrorMessage("This player has disabled people from sending whispers!"); + return; + } 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; @@ -5315,6 +5326,19 @@ namespace TShockAPI } } + public 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!"); + } + private static void Reply(CommandArgs args) { if (args.Player.mute) @@ -6010,13 +6034,11 @@ namespace TShockAPI } } - private static void Grow(CommandArgs args) + public static void Grow(CommandArgs args) { - if (args.Parameters.Count != 1) - { - args.Player.SendErrorMessage("Invalid syntax! Proper syntax: {0}grow ", Specifier); - return; - } + bool growevilAmb = args.Player.HasPermission(Permissions.growevil); + string subcmd = args.Parameters.Count == 0 ? "help" : args.Parameters[0].ToLower(); + var name = "Fail"; var x = args.Player.TileX; var y = args.Player.TileY + 3; @@ -6027,10 +6049,37 @@ namespace TShockAPI return; } - switch (args.Parameters[0].ToLower()) + switch (subcmd) { - case "tree": - for (int i = x - 1; i < x + 2; i++) + case "help": + { + if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, args.Player, out int pageNumber)) + return; + + var lines = new List + { + "- Default trees :", + " 'basic', 'sakura', 'willow', 'boreal', 'mahogany', 'ebonwood', 'shadewood', 'pearlwood'.", + "- Palm trees :", + " 'palm', 'corruptpalm', 'crimsonpalm', 'hallowpalm'.", + "- Gem trees :", + " 'topaz', 'amethyst', 'sapphire', 'emerald', 'ruby', 'diamond', 'amber'.", + "- Misc :", + " 'cactus', 'herb', 'mushroom'." + }; + + PaginationTools.SendPage(args.Player, pageNumber, lines, + new PaginationTools.Settings + { + HeaderFormat = "Trees types & misc available to use. ({0}/{1}):", + FooterFormat = "Type {0}grow help {{0}} for more sub-commands.".SFormat(Commands.Specifier) + } + ); + } + break; + + case "basic": + for (int i = x - 2; i < x + 3; i++) { Main.tile[i, y].active(true); Main.tile[i, y].type = 2; @@ -6038,37 +6087,279 @@ namespace TShockAPI } Main.tile[x, y - 1].wall = 0; WorldGen.GrowTree(x, y); - name = "Tree"; + name = "Basic Tree"; break; - case "epictree": - for (int i = x - 1; i < x + 2; i++) + + case "boreal": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 147; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowTree(x, y); + name = "Boreal Tree"; + break; + + case "mahogany": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 60; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowTree(x, y); + name = "Rich Mahogany"; + break; + + case "sakura": + for (int i = x - 2; i < x + 3; i++) { Main.tile[i, y].active(true); Main.tile[i, y].type = 2; Main.tile[i, y].wall = 0; } Main.tile[x, y - 1].wall = 0; - Main.tile[x, y - 1].liquid = 0; - Main.tile[x, y - 1].active(true); - WorldGen.GrowEpicTree(x, y); - name = "Epic Tree"; + WorldGen.TryGrowingTreeByType(596, x, y); + name = "Sakura Tree"; break; - case "mushroom": - for (int i = x - 1; i < x + 2; i++) + + case "willow": + for (int i = x - 2; i < x + 3; i++) { Main.tile[i, y].active(true); - Main.tile[i, y].type = 70; + Main.tile[i, y].type = 2; Main.tile[i, y].wall = 0; } Main.tile[x, y - 1].wall = 0; - WorldGen.GrowShroom(x, y); - name = "Mushroom"; + WorldGen.TryGrowingTreeByType(616, x, y); + name = "Willow Tree"; break; + + case "shadewood": + if (growevilAmb) + { + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 199; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowTree(x, y); + name = "Shadewood tree"; + } + else args.Player.SendErrorMessage("You do not have permission to grow this tree type"); + break; + + case "ebonwood": + if (growevilAmb) + { + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 23; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowTree(x, y); + name = "Ebonwood Tree"; + } + else args.Player.SendErrorMessage("You do not have permission to grow this tree type"); + break; + + case "pearlwood": + if (growevilAmb) + { + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 109; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowTree(x, y); + name = "Pearlwood Tree"; + } + else args.Player.SendErrorMessage("You do not have permission to grow this tree type"); + break; + + case "palm": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 53; + Main.tile[i, y].wall = 0; + } + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y + 1].active(true); + Main.tile[i, y + 1].type = 397; + Main.tile[i, y + 1].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowPalmTree(x, y); + name = "Desert Palm"; + break; + + case "hallowpalm": + if (growevilAmb) + { + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 116; + Main.tile[i, y].wall = 0; + } + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y + 1].active(true); + Main.tile[i, y + 1].type = 402; + Main.tile[i, y + 1].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowPalmTree(x, y); + name = "Hallow Palm"; + } + else args.Player.SendErrorMessage("You do not have permission to grow this tree type"); + break; + + case "crimsonpalm": + if (growevilAmb) + { + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 234; + Main.tile[i, y].wall = 0; + } + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y + 1].active(true); + Main.tile[i, y + 1].type = 399; + Main.tile[i, y + 1].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowPalmTree(x, y); + name = "Crimson Palm"; + } + else args.Player.SendErrorMessage("You do not have permission to grow this tree type"); + break; + + case "corruptpalm": + if (growevilAmb) + { + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 112; + Main.tile[i, y].wall = 0; + } + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y + 1].active(true); + Main.tile[i, y + 1].type = 398; + Main.tile[i, y + 1].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowPalmTree(x, y); + name = "Corruption Palm"; + } + else args.Player.SendErrorMessage("You do not have permission to grow this tree type"); + break; + + case "topaz": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(583, x, y); + name = "Topaz Gemtree"; + break; + + case "amethyst": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(584, x, y); + name = "Amethust Gemtree"; + break; + + case "sapphire": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(585, x, y); + name = "Sapphire Gemtree"; + break; + + case "emerald": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(586, x, y); + name = "Emerald Gemtree"; + break; + + case "ruby": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(587, x, y); + name = "Ruby Gemtree"; + break; + + case "diamond": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(588, x, y); + name = "Diamond Gemtree"; + break; + + case "amber": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 1; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.TryGrowingTreeByType(589, x, y); + name = "Amber Gemtree"; + break; + case "cactus": Main.tile[x, y].type = 53; WorldGen.GrowCactus(x, y); name = "Cactus"; break; + case "herb": Main.tile[x, y].active(true); Main.tile[x, y].frameX = 36; @@ -6076,12 +6367,28 @@ namespace TShockAPI WorldGen.GrowAlch(x, y); name = "Herb"; break; + + case "mushroom": + for (int i = x - 2; i < x + 3; i++) + { + Main.tile[i, y].active(true); + Main.tile[i, y].type = 70; + Main.tile[i, y].wall = 0; + } + Main.tile[x, y - 1].wall = 0; + WorldGen.GrowShroom(x, y); + name = "Glowing Mushroom Tree"; + break; + default: args.Player.SendErrorMessage("Unknown plant!"); return; } - args.Player.SendTileSquare(x, y); - args.Player.SendSuccessMessage("Tried to grow a " + name + "."); + if (args.Parameters.Count == 1) + { + args.Player.SendTileSquare(x - 2, y - 20, 25); + args.Player.SendSuccessMessage("Tried to grow a " + name + "."); + } } private static void ToggleGodMode(CommandArgs args) diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index 600974a1..eb6b6925 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -319,6 +319,9 @@ namespace TShockAPI [Description("User can grow plants.")] public static readonly string grow = "tshock.world.grow"; + [Description("User can grow evil biome plants.")] + public static readonly string growevil = "tshock.world.growevil"; + [Description("User can change hardmode state.")] public static readonly string hardmode = "tshock.world.hardmode"; From 0edab1de834faf32a888c9ab6ffac55fa1ef39d1 Mon Sep 17 00:00:00 2001 From: Rozen / Nova <68127614+Nova4334@users.noreply.github.com> Date: Sun, 21 Mar 2021 02:08:53 +0100 Subject: [PATCH 04/40] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f34631c..d1a91f5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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. (@Nova4334) +* Introduced `/wallow` to disable or enable recieving whispers from other players. (@Nova4334) ## TShock 4.4.0 (Pre-release 15) * Overhauled Bans system. Bans are now based on 'identifiers'. (@QuiCM) From 2b3b0273e3b7c2b7b99fd7fcdc03f3fe0718b81a Mon Sep 17 00:00:00 2001 From: Rozen / Nova <68127614+Nova4334@users.noreply.github.com> Date: Sun, 21 Mar 2021 02:09:23 +0100 Subject: [PATCH 05/40] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1a91f5b..a46e2ab5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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. (@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) ## TShock 4.4.0 (Pre-release 15) From 85fbf593c9522c363eca090ca4a81784f2f6478e Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Mon, 22 Mar 2021 10:29:09 +1030 Subject: [PATCH 06/40] Implement place style checks, courtesy of @AgaSpace --- TShockAPI/Bouncer.cs | 37 +++++++++++++++++++++++++++++------- TShockAPI/GetDataHandlers.cs | 11 ++++++++--- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index b5dae813..c2ea252e 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -303,11 +303,20 @@ namespace TShockAPI args.Handled = true; return; } + + if (selectedItem.placeStyle != style) + { + TShock.Log.ConsoleError(string.Format("Bouncer / OnTileEdit rejected from (placestyle) {0} {1} {2} placeStyle: {3} expectedStyle: {4}", + args.Player.Name, action, editData, style, selectedItem.placeStyle)); + args.Player.SendTileSquare(tileX, tileY, 1); + args.Handled = true; + return; + } } if (action == EditAction.KillTile && !Main.tileCut[tile.type] && !breakableTiles.Contains(tile.type)) { - //TPlayer.mount.Type 8 => Drill Containment Unit. + // TPlayer.mount.Type 8 => Drill Containment Unit. // If the tile is an axe tile and they aren't selecting an axe, they're hacking. if (Main.tileAxe[tile.type] && ((args.Player.TPlayer.mount.Type != 8 && selectedItem.axe == 0) && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0)) @@ -327,7 +336,7 @@ namespace TShockAPI } // If the tile is a pickaxe tile and they aren't selecting a pickaxe, they're hacking. // Item frames can be modified without pickaxe tile. - //also add an exception for snake coils, they can be removed when the player places a new one or after x amount of time + // also add an exception for snake coils, they can be removed when the player places a new one or after x amount of time else if (tile.type != TileID.ItemFrame && tile.type != TileID.MysticSnakeRope && !Main.tileAxe[tile.type] && !Main.tileHammer[tile.type] && tile.wall == 0 && args.Player.TPlayer.mount.Type != 8 && selectedItem.pick == 0 && selectedItem.type != ItemID.GravediggerShovel && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0) { @@ -354,9 +363,9 @@ namespace TShockAPI } else if (CoilTileIds.Contains(editData)) { - /// Handle placement if the user is placing rope that comes from a ropecoil, - /// but have not created the ropecoil projectile recently or the projectile was not at the correct coordinate, or the tile that the projectile places does not match the rope it is suposed to place - /// projectile should be the same X coordinate as all tile places (Note by @Olink) + // Handle placement if the user is placing rope that comes from a ropecoil, + // but have not created the ropecoil projectile recently or the projectile was not at the correct coordinate, or the tile that the projectile places does not match the rope it is suposed to place + // projectile should be the same X coordinate as all tile places (Note by @Olink) if (ropeCoilPlacements.ContainsKey(selectedItem.netID) && !args.Player.RecentlyCreatedProjectiles.Any(p => GetDataHandlers.projectileCreatesTile.ContainsKey(p.Type) && GetDataHandlers.projectileCreatesTile[p.Type] == editData && !p.Killed && Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X))) @@ -1106,6 +1115,7 @@ namespace TShockAPI int tileX = args.TileX; int tileY = args.TileY; int flag = args.Flag; + short style = args.Style; if (!TShock.Utils.TilePlacementValid(tileX, tileY) || (args.Player.Dead && TShock.Config.Settings.PreventDeadModification)) { @@ -1122,6 +1132,14 @@ namespace TShockAPI return; } + if (args.Player.SelectedItem.placeStyle != style) + { + TShock.Log.ConsoleError(string.Format("Bouncer / OnPlaceChest / rejected from invalid place style from {0}", args.Player.Name)); + args.Player.SendTileSquare(tileX, tileY, 3); + args.Handled = true; + return; + } + if (flag != 0 && flag != 4 // if no container or container2 placement && Main.tile[tileX, tileY].type != TileID.Containers && Main.tile[tileX, tileY].type != TileID.Dressers @@ -1630,8 +1648,6 @@ namespace TShockAPI short y = args.Y; short type = args.Type; short style = args.Style; - byte alternate = args.Alternate; - bool direction = args.Direction; if (type < 0 || type >= Main.maxTileSets) { @@ -1654,6 +1670,13 @@ namespace TShockAPI return; } + if (args.Player.SelectedItem.placeStyle != style) + { + TShock.Log.ConsoleError(string.Format("Bouncer / OnPlaceObject rejected object placement with invalid style from {0}", args.Player.Name)); + args.Handled = true; + return; + } + //style 52 and 53 are used by ItemID.Fake_newchest1 and ItemID.Fake_newchest2 //These two items cause localised lag and rendering issues if (type == TileID.FakeContainers && (style == 52 || style == 53)) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 55ddaa05..ccb16468 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -939,12 +939,16 @@ namespace TShockAPI /// The Y coordinate /// public int TileY { get; set; } + /// + /// Place style used + /// + public short Style { get; set; } } /// /// When a chest is added or removed from the world. /// public static HandlerList PlaceChest = new HandlerList(); - private static bool OnPlaceChest(TSPlayer player, MemoryStream data, int flag, int tilex, int tiley) + private static bool OnPlaceChest(TSPlayer player, MemoryStream data, int flag, int tilex, int tiley, short style) { if (PlaceChest == null) return false; @@ -956,6 +960,7 @@ namespace TShockAPI Flag = flag, TileX = tilex, TileY = tiley, + Style = style }; PlaceChest.Invoke(null, args); return args.Handled; @@ -2884,9 +2889,9 @@ namespace TShockAPI int flag = args.Data.ReadByte(); int tileX = args.Data.ReadInt16(); int tileY = args.Data.ReadInt16(); - args.Data.ReadInt16(); // Ignore style + short style = args.Data.ReadInt16(); - if (OnPlaceChest(args.Player, args.Data, flag, tileX, tileY)) + if (OnPlaceChest(args.Player, args.Data, flag, tileX, tileY, style)) return true; return false; From e23509de75dcbad34ed376395a74606651b796eb Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:35:26 +1030 Subject: [PATCH 07/40] Removed stoned and frozen from disable --- TShockAPI/TSPlayer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 20977c8e..dc76e94c 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1557,8 +1557,6 @@ namespace TShockAPI public virtual void Disable(string reason = "", DisableFlags flags = DisableFlags.WriteToLog) { LastThreat = DateTime.UtcNow; - SetBuff(BuffID.Frozen, 330, true); - SetBuff(BuffID.Stoned, 330, true); SetBuff(BuffID.Webbed, 330, true); if (ActiveChest != -1) From 36b5d4e9f7decf889eceb89de5a676fc21b1f42b Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:37:05 +1030 Subject: [PATCH 08/40] Updated changelog for stoned & webbed --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a46e2ab5..1e95cab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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) ## TShock 4.4.0 (Pre-release 15) * Overhauled Bans system. Bans are now based on 'identifiers'. (@QuiCM) From b4789607f60bf20b593ff7efa354f725b3956e78 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:44:24 +1030 Subject: [PATCH 09/40] Implement suggestion for fixing forceupdate flag --- CHANGELOG.md | 1 + TShockAPI/TShock.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e95cab2..434c7ab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * 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) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 5f774f95..48fa7461 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -890,6 +890,13 @@ namespace TShockAPI /// args - EventArgs args private void OnUpdate(EventArgs args) { + // This forces Terraria to actually continue to update + // even if there are no clients connected + if (ServerApi.ForceUpdate) + { + Netplay.HasClients = true; + } + if (Backups.IsBackupTime) Backups.Backup(); //call these every second, not every update From 4159f6c1861311f4e06e13f4594d51df0142ceca Mon Sep 17 00:00:00 2001 From: Stealownz Date: Mon, 5 Apr 2021 09:45:39 +0800 Subject: [PATCH 10/40] Update firework command to include extra parameter in NewProjectile --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 6e8b1b95..cd2e6b2d 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -5434,7 +5434,7 @@ namespace TShockAPI type = 170; } var ply = players[0]; - int p = Projectile.NewProjectile(ply.TPlayer.position.X, ply.TPlayer.position.Y - 64f, 0f, -8f, type, 0, (float)0); + int p = Projectile.NewProjectile(Projectile.GetNoneSource(), ply.TPlayer.position.X, ply.TPlayer.position.Y - 64f, 0f, -8f, type, 0, (float)0); Main.projectile[p].Kill(); args.Player.SendSuccessMessage("Launched Firework on {0}.", ply.Name); } From bc32eab4c82a00fe4295f30e20ba7627a343a9d2 Mon Sep 17 00:00:00 2001 From: Stealownz Date: Mon, 5 Apr 2021 10:45:41 +0800 Subject: [PATCH 11/40] Update GetDataHandler.HandleProjectileNew to include HasBannerIdToRespondTo --- TShockAPI/GetDataHandlers.cs | 1 + TShockAPI/Models/Projectiles/NewProjectileData.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 55ddaa05..deac632f 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2699,6 +2699,7 @@ namespace TShockAPI float[] ai = new float[Projectile.maxAI]; for (int i = 0; i < Projectile.maxAI; ++i) ai[i] = !bits.AI[i] ? 0.0f : args.Data.ReadSingle(); + ushort bannerId = bits.HasBannerIdToRespondTo ? args.Data.ReadUInt16() : (ushort)0; short dmg = bits.HasDamage ? args.Data.ReadInt16() : (short)0; float knockback = bits.HasKnockback ? args.Data.ReadSingle() : 0.0f; short origDmg = bits.HasOriginalDamage ? args.Data.ReadInt16() : (short)0; diff --git a/TShockAPI/Models/Projectiles/NewProjectileData.cs b/TShockAPI/Models/Projectiles/NewProjectileData.cs index 7caa057e..c76dbc65 100644 --- a/TShockAPI/Models/Projectiles/NewProjectileData.cs +++ b/TShockAPI/Models/Projectiles/NewProjectileData.cs @@ -38,6 +38,12 @@ namespace TShockAPI.Models.Projectiles } } + public bool HasBannerIdToRespondTo + { + get => bitsbyte[3]; + set => bitsbyte[3] = value; + } + /// /// Gets or Sets the Damage flag on the backing field /// From 5e64ecc45c4bfaff7870af97b04b04d086f518df Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 10 Apr 2021 19:54:21 -0700 Subject: [PATCH 12/40] Update submodule for 1.4.2.1 --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 2a0b338a..e0302513 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 2a0b338a3c4fb82e05946082ab31def771b783fb +Subproject commit e0302513009220a8d92ba12c867a401e7731d28a From 07a555eab9f53c6305ccc0ea7415533e15f8314e Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 10 Apr 2021 20:30:40 -0700 Subject: [PATCH 13/40] Update to TShock 4.5.0 --- TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index bf337820..11981016 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.4.0")] -[assembly: AssemblyFileVersion("4.4.0")] +[assembly: AssemblyVersion("4.5.0")] +[assembly: AssemblyFileVersion("4.5.0")] From 67a1a669a4c3a2b0cba984436d2aa16fb5d7ec89 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 10 Apr 2021 20:31:33 -0700 Subject: [PATCH 14/40] 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 48fa7461..6b0e36ad 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -57,7 +57,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 = "Now with less velocity, thanks to Off + Quake. Usual thanks to Chris/White <3"; + public static readonly string VersionCodename = "Stealownz + DeathCradle 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 c8bed97a21b0e5bae546329b1434d91cbd9e7b77 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 10 Apr 2021 20:34:39 -0700 Subject: [PATCH 15/40] Update changelog with latest changes --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 434c7ab1..19b4675b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * This could be you! +## 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) From 78eab01904c00f892fd487730c5bcb1c4129c2ba Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 10 Apr 2021 23:59:47 -0700 Subject: [PATCH 16/40] Fix ban system conversion issue with MySQL DeathCradle spotted a typo in the ban converter and identified that the issue is likely because we used table_name in some, but not all, of the conversion SQL. Co-authored-by: DeathCradle --- CHANGELOG.md | 3 +++ TShockAPI/DB/BanManager.cs | 2 +- TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b4675b..bf48f1aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * This could be you! +## TShock 4.5.0.1 +* Fixed typo in conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle) + ## 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) diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 0edea2d0..7bbe013d 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -107,7 +107,7 @@ namespace TShockAPI.DB int res; if (database.GetSqlType() == SqlType.Mysql) { - res = database.QueryScalar("SELECT COUNT(name) FROM information_schema.tables WHERE table_schema = @0 and table_name = 'Bans'", TShock.Config.Settings.MySqlDbName); + res = database.QueryScalar("SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema = @0 and table_name = 'Bans'", TShock.Config.Settings.MySqlDbName); } else { diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 11981016..1e1ba3db 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")] -[assembly: AssemblyFileVersion("4.5.0")] +[assembly: AssemblyVersion("4.5.0.1")] +[assembly: AssemblyFileVersion("4.5.0.1")] From 81b6872d6e2572e5f4343a8dbd2c35ddc3a3030b Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 11 Apr 2021 21:00:28 +1000 Subject: [PATCH 17/40] Fix OTAPI reference This now allows MonoDevelop to compile without receiving error while starting a build: System.IO.FileLoadException: The assembly name is invalid --- TShockAPI/TShockAPI.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index cde1f86e..add34f1e 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -70,7 +70,7 @@ ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - + False ..\TerrariaServerAPI\TerrariaServerAPI\bin\$(ConfigurationName)\OTAPI.dll From d0ce5746ea8d2c4d8ef7d5d289aa2ca4acbb12bd Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 11 Apr 2021 21:18:37 +1000 Subject: [PATCH 18/40] Fix mysql & sqlite ban manager migration during init Tested with existing bans in both sqlite & mysql environments. This is in addition to the syntax fix from earlier. --- TShockAPI/DB/BanManager.cs | 75 ++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 20 deletions(-) diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs index 7bbe013d..5777e84c 100644 --- a/TShockAPI/DB/BanManager.cs +++ b/TShockAPI/DB/BanManager.cs @@ -37,18 +37,7 @@ namespace TShockAPI.DB /// /// Readonly dictionary of Bans, keyed on ban ticket number. /// - public ReadOnlyDictionary Bans - { - get - { - if (_bans == null) - { - _bans = RetrieveAllBans().ToDictionary(b => b.TicketNumber); - } - - return new ReadOnlyDictionary(_bans); - } - } + public ReadOnlyDictionary Bans => new ReadOnlyDictionary(_bans); /// /// Event invoked when a ban is checked for validity @@ -93,12 +82,24 @@ namespace TShockAPI.DB throw new Exception("Could not find a database library (probably Sqlite3.dll)"); } + EnsureBansCollection(); TryConvertBans(); OnBanValidate += BanValidateCheck; OnBanPreAdd += BanAddedCheck; } + /// + /// Ensures the collection is ready to use. + /// + private void EnsureBansCollection() + { + if (_bans == null) + { + _bans = RetrieveAllBans().ToDictionary(b => b.TicketNumber); + } + } + /// /// Converts bans from the old ban system to the new. /// @@ -116,6 +117,7 @@ namespace TShockAPI.DB if (res != 0) { + var bans = new List(); using (var reader = database.QueryReader("SELECT * FROM Bans")) { while (reader.Read()) @@ -140,22 +142,46 @@ namespace TShockAPI.DB if (!string.IsNullOrWhiteSpace(ip)) { - InsertBan($"{Identifier.IP}{ip}", reason, banningUser, start, end); + bans.Add(new BanPreAddEventArgs + { + Identifier = $"{Identifier.IP}{ip}", + Reason = reason, + BanningUser = banningUser, + BanDateTime = start, + ExpirationDateTime = end + }); } if (!string.IsNullOrWhiteSpace(account)) { - InsertBan($"{Identifier.Account}{account}", reason, banningUser, start, end); + bans.Add(new BanPreAddEventArgs + { + Identifier = $"{Identifier.Account}{account}", + Reason = reason, + BanningUser = banningUser, + BanDateTime = start, + ExpirationDateTime = end + }); } if (!string.IsNullOrWhiteSpace(uuid)) { - InsertBan($"{Identifier.UUID}{uuid}", reason, banningUser, start, end); + bans.Add(new BanPreAddEventArgs + { + Identifier = $"{Identifier.UUID}{uuid}", + Reason = reason, + BanningUser = banningUser, + BanDateTime = start, + ExpirationDateTime = end + }); } } } - database.Query("DROP TABLE 'Bans'"); + foreach (var ban in bans) + InsertBan(ban); + + database.Query("DROP TABLE Bans"); } } @@ -232,7 +258,7 @@ namespace TShockAPI.DB args.Message = args.Valid ? null : "a current ban for this identifier already exists."; } } - + /// /// Adds a new ban for the given identifier. Returns a Ban object if the ban was added, else null /// @@ -252,7 +278,16 @@ namespace TShockAPI.DB BanDateTime = fromDate, ExpirationDateTime = toDate }; + return InsertBan(args); + } + /// + /// Adds a new ban for the given data. Returns a Ban object if the ban was added, else null + /// + /// A predefined instance of + /// + public AddBanResult InsertBan(BanPreAddEventArgs args) + { OnBanPreAdd?.Invoke(this, args); if (!args.Valid) @@ -265,21 +300,21 @@ namespace TShockAPI.DB if (database.GetSqlType() == SqlType.Mysql) { - query += "SELECT CAST(LAST_INSERT_ID() as INT);"; + query += "SELECT LAST_INSERT_ID();"; } else { query += "SELECT CAST(last_insert_rowid() as INT);"; } - int ticketId = database.QueryScalar(query, identifier, reason, banningUser, fromDate.Ticks, toDate.Ticks); + int ticketId = database.QueryScalar(query, args.Identifier, args.Reason, args.BanningUser, args.BanDateTime.Ticks, args.ExpirationDateTime.Ticks); if (ticketId == 0) { return new AddBanResult { Message = "Database insert failed." }; } - Ban b = new Ban(ticketId, identifier, reason, banningUser, fromDate, toDate); + Ban b = new Ban(ticketId, args.Identifier, args.Reason, args.BanningUser, args.BanDateTime, args.ExpirationDateTime); _bans.Add(ticketId, b); OnBanPostAdd?.Invoke(this, new BanEventArgs { Ban = b }); From 29e55a866d178cf4903bd14f42d5a03f17bd4662 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 11 Apr 2021 21:18:52 +1000 Subject: [PATCH 19/40] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf48f1aa..9a70062b 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 * This could be you! ## TShock 4.5.0.1 -* Fixed typo in conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle) +* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle) ## TShock 4.5.0 * Updated OTAPI and TSAPI to Terraria 1.4.2.1. (@Stealownz, @DeathCradle) From 71e2ae1b316300da144a7cfd6a90bdbfe1bdce7c Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 12 Apr 2021 17:35:46 +1000 Subject: [PATCH 20/40] Corrected UUID InsertBan in TSPlayer Pointed out thanks to this discussion: https://github.com/Pryaxis/TShock/discussions/2268#discussioncomment-598331 --- TShockAPI/TSPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index dc76e94c..4c24468b 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -1637,7 +1637,7 @@ namespace TShockAPI if (force) { TShock.Bans.InsertBan($"{Identifier.IP}{IP}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue); - TShock.Bans.InsertBan($"{Identifier.IP}{UUID}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue); + TShock.Bans.InsertBan($"{Identifier.UUID}{UUID}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue); if (Account != null) { TShock.Bans.InsertBan($"{Identifier.Account}{Account.Name}", reason, adminUserName, DateTime.UtcNow, DateTime.MaxValue); From 099256bdba2ffdb6da52d7aa6c256b48de82bfc6 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 12 Apr 2021 11:09:58 -0700 Subject: [PATCH 21/40] Normalize changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a70062b..db4fd0d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,9 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * This could be you! ## TShock 4.5.0.1 -* Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle) +* 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) From 32a0e2f1b6474632daaba3ccef757760c6e54576 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 13 Apr 2021 13:06:18 +0930 Subject: [PATCH 22/40] Resolve /v2/players/list generating a stack overflow --- TShockAPI/Rest/Rest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs index 51d783f5..40a908ef 100644 --- a/TShockAPI/Rest/Rest.cs +++ b/TShockAPI/Rest/Rest.cs @@ -94,17 +94,17 @@ namespace Rests /// /// public IEnumerator GetEnumerator() - { - return GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() { foreach (IParameter param in _collection) { yield return new EscapedParameter(param); } } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } } /// From 784a75b7c5e85e2f2945ffa743db16030a18904b Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 13 Apr 2021 13:14:56 +0930 Subject: [PATCH 23/40] Implement handled pattern on the PlayerChat hook --- TShockAPI/Hooks/PlayerHooks.cs | 6 ++++-- TShockAPI/TShock.cs | 20 +++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs index 9056fe55..3114020b 100644 --- a/TShockAPI/Hooks/PlayerHooks.cs +++ b/TShockAPI/Hooks/PlayerHooks.cs @@ -449,14 +449,16 @@ namespace TShockAPI.Hooks /// The player firing the event. /// The raw chat text sent by the player. /// The chat text after being formatted. - public static void OnPlayerChat(TSPlayer ply, string rawtext, ref string tshockText) + public static bool OnPlayerChat(TSPlayer ply, string rawtext, ref string tshockText) { if (PlayerChat == null) - return; + return false; var args = new PlayerChatEventArgs {Player = ply, RawText = rawtext, TShockFormattedText = tshockText}; PlayerChat(args); tshockText = args.TShockFormattedText; + + return args.Handled; } /// diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 6b0e36ad..52bef011 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1330,9 +1330,17 @@ namespace TShockAPI { text = String.Format(Config.Settings.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix, args.Text); - Hooks.PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text); - Utils.Broadcast(text, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B); + + //Invoke the PlayerChat hook. If this hook event is handled then we need to prevent sending the chat message + bool cancelChat = PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text); args.Handled = true; + + if (cancelChat) + { + return; + } + + Utils.Broadcast(text, tsplr.Group.R, tsplr.Group.G, tsplr.Group.B); } else { @@ -1344,7 +1352,13 @@ namespace TShockAPI //Give that poor player their name back :'c ply.name = name; - PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text); + + bool cancelChat = PlayerHooks.OnPlayerChat(tsplr, args.Text, ref text); + if (cancelChat) + { + args.Handled = true; + return; + } //This netpacket is used to send chat text from the server to clients, in this case on behalf of a client Terraria.Net.NetPacket packet = Terraria.GameContent.NetModules.NetTextModule.SerializeServerMessage( From 196a16c3210b817815af25e132b0d7012c4b4b69 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 13 Apr 2021 13:59:56 +0930 Subject: [PATCH 24/40] Changelog update --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db4fd0d1..9dac4b32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +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 -* This could be you! +* Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM) +* Added handling to the PlayerChat hook event. (@QuiCM - Thanks for the suggestion @Arthri) ## TShock 4.5.0.1 * Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK) From c72e64fa5ee4ac35e21962d152517b2fe00b01f6 Mon Sep 17 00:00:00 2001 From: Chris <2648373+QuiCM@users.noreply.github.com> Date: Tue, 13 Apr 2021 15:15:49 +0930 Subject: [PATCH 25/40] Add silent command support to spawnboss --- TShockAPI/Commands.cs | 135 +++++++++++++++++++++++------------------- 1 file changed, 75 insertions(+), 60 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index cd2e6b2d..20c21f26 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -2426,6 +2426,8 @@ namespace TShockAPI return; } + string message = "{0} spawned {1} {2} time(s)"; + string spawnName; NPC npc = new NPC(); switch (args.Parameters[0].ToLower()) { @@ -2438,87 +2440,89 @@ namespace TShockAPI npc.SetDefaults(i); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); } - TSPlayer.All.SendSuccessMessage("{0} has spawned all bosses {1} time(s).", args.Player.Name, amount); - return; + spawnName = "all bosses"; + break; + case "brain": case "brain of cthulhu": case "boc": npc.SetDefaults(266); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Brain of Cthulhu {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Brain of Cthulhu"; + break; + case "destroyer": npc.SetDefaults(134); TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Destroyer {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Destroyer"; + break; case "duke": case "duke fishron": case "fishron": npc.SetDefaults(370); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Duke Fishron {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Duke Fishron"; + break; case "eater": case "eater of worlds": case "eow": npc.SetDefaults(13); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Eater of Worlds {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Eater of Worlds"; + break; case "eye": case "eye of cthulhu": case "eoc": npc.SetDefaults(4); TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Eye of Cthulhu {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Eye of Cthulhu"; + break; case "golem": npc.SetDefaults(245); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Golem {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Golem"; + break; case "king": case "king slime": case "ks": npc.SetDefaults(50); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned King Slime {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the King Slime"; + break; case "plantera": npc.SetDefaults(262); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Plantera {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Plantera"; + break; case "prime": case "skeletron prime": npc.SetDefaults(127); TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron Prime {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Skeletron Prime"; + break; case "queen bee": case "qb": npc.SetDefaults(222); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Queen Bee {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Queen Bee"; + break; case "skeletron": npc.SetDefaults(35); TSPlayer.Server.SetTime(false, 0.0); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Skeletron {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Skeletron"; + break; case "twins": TSPlayer.Server.SetTime(false, 0.0); npc.SetDefaults(125); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); npc.SetDefaults(126); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Twins {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Twins"; + break; case "wof": case "wall of flesh": if (Main.wofNPCIndex != -1) @@ -2532,103 +2536,114 @@ namespace TShockAPI return; } NPC.SpawnWOF(new Vector2(args.Player.X, args.Player.Y)); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Wall of Flesh.", args.Player.Name); - return; + spawnName = "the Wall of Flesh"; + break; case "moon": case "moon lord": case "ml": npc.SetDefaults(398); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Moon Lord {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Moon Lord"; + break; case "empress": case "empress of light": case "eol": npc.SetDefaults(636); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Empress of Light {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Empress of Light"; + break; case "queen slime": case "qs": npc.SetDefaults(657); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Queen Slime {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Queen Slime"; + break; case "lunatic": case "lunatic cultist": case "cultist": case "lc": npc.SetDefaults(439); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Lunatic Cultist {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Lunatic Cultist"; + break; case "betsy": npc.SetDefaults(551); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Betsy {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Betsy"; + break; case "flying dutchman": case "flying": case "dutchman": npc.SetDefaults(491); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Flying Dutchman {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Flying Dutchman"; + break; case "mourning wood": npc.SetDefaults(325); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Mourning Wood {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Mourning Wood"; + break; case "pumpking": npc.SetDefaults(327); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Pumpking {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Pumpking"; + break; case "everscream": npc.SetDefaults(344); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Everscream {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Everscream"; + break; case "santa-nk1": case "santa": npc.SetDefaults(346); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned Santa-NK1 {1} time(s).", args.Player.Name, amount); - return; + spawnName = "Santa-NK1"; + break; case "ice queen": npc.SetDefaults(345); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Ice Queen {1} time(s).", args.Player.Name, amount); - return; + spawnName = "the Ice Queen"; + break; case "martian saucer": npc.SetDefaults(392); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Martian Saucer {1} time(s).", args.Player.Name, amount); - return; + spawnName = "a Martian Saucer"; + break; case "solar pillar": npc.SetDefaults(517); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Solar Pillar {1} time(s).", args.Player.Name, amount); - return; + spawnName = "a Solar Pillar"; + break; case "nebula pillar": npc.SetDefaults(507); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Nebula Pillar {1} time(s).", args.Player.Name, amount); - return; + spawnName = "a Nebula Pillar"; + break; case "vortex pillar": npc.SetDefaults(422); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Vortex Pillar {1} time(s).", args.Player.Name, amount); - return; + spawnName = "a Vortex Pillar"; + break; case "stardust pillar": npc.SetDefaults(493); TSPlayer.Server.SpawnNPC(npc.type, npc.FullName, amount, args.Player.TileX, args.Player.TileY); - TSPlayer.All.SendSuccessMessage("{0} has spawned the Stardust Pillar {1} time(s).", args.Player.Name, amount); - return; + spawnName = "a Stardust Pillar"; + break; default: args.Player.SendErrorMessage("Invalid boss type!"); return; } + + if (args.Silent) + { + //"You spawned time(s)" + args.Player.SendSuccessMessage(message, "You", spawnName, amount); + } + else + { + //" spawned time(s)" + TSPlayer.All.SendSuccessMessage(message, args.Player.Name, spawnName, amount); + } } private static void SpawnMob(CommandArgs args) From 00b4eb677424715976062ebdbef0a3bbdf49a729 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 12 Apr 2021 23:20:10 -0700 Subject: [PATCH 26/40] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dac4b32..826059e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM) * 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). ## TShock 4.5.0.1 * Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK) From 173d6f71f5eac97eebe653f63b588b5d1b5399a0 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 12 Apr 2021 23:21:51 -0700 Subject: [PATCH 27/40] Update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 826059e3..743141af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +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 -* Fixed server crash from `/v2/players/list` & other parameterised REST endpoints. (@QuiCM) +* 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). +* Changed the spawnboss command to support silent command specifiers. (@QuiCM, suggested by @nojomyth-dev) ## TShock 4.5.0.1 * Fixed conversion from old to new ban system for MySQL hosted ban databases. (@DeathCradle, @ATFGK) 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 28/40] 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 29/40] 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 30/40] 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 31/40] 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 32/40] 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 33/40] 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 34/40] 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 35/40] 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 36/40] 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 37/40] 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 38/40] 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 39/40] 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 40/40] 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)