Introduce SoftcoreOnly config option to allow only softcore characters

to connect.
This commit is contained in:
James Puleo 2021-07-13 21:49:22 -04:00
parent dcf1f07ff9
commit a40effd55e
No known key found for this signature in database
GPG key ID: 3E16C7EFA34FB15D
3 changed files with 11 additions and 0 deletions

View file

@ -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)
## TShock 4.5.5
* Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro)

View file

@ -133,6 +133,10 @@ namespace TShockAPI.Configuration
[Description("Prevents softcore players from connecting.")]
public bool MediumcoreOnly;
/// <summary>Prevents non-softcore players from connecting.</summary>
[Description("Prevents non-softcore players from connecting.")]
public bool SoftcoreOnly;
/// <summary>Disables any placing, or removal of blocks.</summary>
[Description("Disables any placing, or removal of blocks.")]
public bool DisableBuild;

View file

@ -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");