diff --git a/CHANGELOG.md b/CHANGELOG.md index f4bc853d..d8a7890a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ Putting this stuff down here so things don't conflict as often. * Added `GetDataHandlers.ProjectileKill` hook. (@hakusaro) * Removed `TShock.CheckProjectilePermission` and replaced it with `TSPlayer.HasProjectilePermission` and `TSPlayer.LacksProjectilePermission` respectively. (@hakusaro) * Added `TSPlayer` object to `GetDataHandlers.LiquidSetEventArgs`. (@hakusaro) +* Removed `TShock.StartInvasion` for public use (moved to Utils and marked internal). (@hakusaro) ## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 1d8545ca..039d14b3 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -2044,19 +2044,19 @@ namespace TShockAPI case "goblin": case "goblins": TSPlayer.All.SendInfoMessage("{0} has started a goblin army invasion.", args.Player.Name); - TShock.StartInvasion(1); + TShock.Utils.StartInvasion(1); break; case "snowman": case "snowmen": TSPlayer.All.SendInfoMessage("{0} has started a snow legion invasion.", args.Player.Name); - TShock.StartInvasion(2); + TShock.Utils.StartInvasion(2); break; case "pirate": case "pirates": TSPlayer.All.SendInfoMessage("{0} has started a pirate invasion.", args.Player.Name); - TShock.StartInvasion(3); + TShock.Utils.StartInvasion(3); break; case "pumpkin": @@ -2098,7 +2098,7 @@ namespace TShockAPI case "martian": case "martians": TSPlayer.All.SendInfoMessage("{0} has started a martian invasion.", args.Player.Name); - TShock.StartInvasion(4); + TShock.Utils.StartInvasion(4); break; } } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 8ad27859..232d9e36 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1755,27 +1755,7 @@ namespace TShockAPI } - /// StartInvasion - Starts an invasion on the server. - /// type - The invasion type id. - //TODO: Why is this in TShock's main class? - public static void StartInvasion(int type) - { - int invasionSize = 0; - if (Config.InfiniteInvasion) - { - invasionSize = 20000000; - } - else - { - invasionSize = 100 + (Config.InvasionMultiplier * Utils.ActivePlayers()); - } - - // Note: This is a workaround to previously providing the size as a parameter in StartInvasion - Main.invasionSize = invasionSize; - - Main.StartInvasion(type); - } /// CheckRangePermission - Checks if a player has permission to modify a tile dependent on range checks. /// player - The TSPlayer object. diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 2cd87e9c..f831a249 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -1457,6 +1457,27 @@ namespace TShockAPI } } + /// Starts an invasion on the server. + /// The invasion type id. + internal void StartInvasion(int type) + { + int invasionSize = 0; + + if (TShock.Config.InfiniteInvasion) + { + invasionSize = 20000000; + } + else + { + invasionSize = 100 + (TShock.Config.InvasionMultiplier * ActivePlayers()); + } + + // Note: This is a workaround to previously providing the size as a parameter in StartInvasion + Main.invasionSize = invasionSize; + + Main.StartInvasion(type); + } + /// Verifies that each stack in each chest is valid and not over the max stack count. internal void FixChestStacks() {