diff --git a/CHANGELOG.md b/CHANGELOG.md index 2567e3e4..97492839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin ## Upcoming changes * Fixed SendTileRectHandler not sending tile rect updates like Pylons/Mannequins to other clients. (@Stealownz) +* Introduced `SoftcoreOnly` config option to allow only softcore characters to connect. (@drunderscore) * Fix some typos that have been in the repository for over a lustrum. (@Killia0) * Added a `tshock.npc.summonboss` permission check for Lunatic Cultist, players who do not have this permission will not be able to kill Cultist Archers/Devotees to summon the Lunatic Cultist. (@moisterrific) * Added more usage examples for the `ban` command under `ban help examples` to explain how users can ban: offline players by account, offline players by IP, and online players by player index - useful for banning hard to type character names. (@moisterrific) diff --git a/TShockAPI/Configuration/TShockConfig.cs b/TShockAPI/Configuration/TShockConfig.cs index 7fe74884..14e56cb6 100644 --- a/TShockAPI/Configuration/TShockConfig.cs +++ b/TShockAPI/Configuration/TShockConfig.cs @@ -133,6 +133,10 @@ namespace TShockAPI.Configuration [Description("Prevents softcore players from connecting.")] public bool MediumcoreOnly; + /// Prevents non-softcore players from connecting. + [Description("Prevents non-softcore players from connecting.")] + public bool SoftcoreOnly; + /// Disables any placing, or removal of blocks. [Description("Disables any placing, or removal of blocks.")] public bool DisableBuild; diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 486f891f..3bed28b2 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2364,6 +2364,12 @@ namespace TShockAPI NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, NetworkText.FromLiteral(args.Player.Name), args.Player.Index); return true; } + if (TShock.Config.Settings.SoftcoreOnly && difficulty != 0) + { + TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerInfo rejected softcore required"); + args.Player.Kick("You need to join with a softcore player.", true, true); + return true; + } if (TShock.Config.Settings.MediumcoreOnly && difficulty < 1) { TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerInfo rejected mediumcore required");