Merge pull request #2406 from moisterrific/patch-31

Improve login error messages and post-register process
This commit is contained in:
Chris 2021-08-02 19:02:22 +09:30 committed by GitHub
commit 245e885a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View file

@ -15,6 +15,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)
* Fix some typos that have been in the repository for over a lustrum. (@Killia0)
* Changed `/login` and `/register` to provide login help depending on if UUID login is enabled or disabled, and whether or not a player can login via any username or not. In addition, the message parameters will now be differentiated by colour instead of `<>` (@moisterrific, @hakusaro)
* Added a new `DisablePrimeBombs` config option (`false` by default). Highly recommended to set this to `true` in order to prevent griefing on servers doing a `for the worthy` play-through, since the prime bombs on this seed can destroy most tiles and bypass region protection. (@moisterrific)
## TShock 4.5.5

View file

@ -807,10 +807,15 @@ namespace TShockAPI
}
else
{
args.Player.SendErrorMessage("Syntax: {0}login - Logs in using your UUID and character name", Specifier);
args.Player.SendErrorMessage(" {0}login <password> - Logs in using your password and character name", Specifier);
args.Player.SendErrorMessage(" {0}login <username> <password> - Logs in using your username and password", Specifier);
args.Player.SendErrorMessage("If you forgot your password, there is no way to recover it.");
if (!TShock.Config.Settings.DisableUUIDLogin)
args.Player.SendMessage($"{Specifier}login - Logs in using your UUID and character name.", Color.White);
if (TShock.Config.Settings.AllowLoginAnyUsername)
args.Player.SendMessage($"{Specifier}login {"username".Color(Utils.GreenHighlight)} {"password".Color(Utils.BoldHighlight)} - Logs in using your username and password.", Color.White);
else
args.Player.SendMessage($"{Specifier}login {"password".Color(Utils.BoldHighlight)} - Logs in using your password and character name.", Color.White);
args.Player.SendWarningMessage("If you forgot your password, there is no way to recover it.");
return;
}
try
@ -991,6 +996,15 @@ namespace TShockAPI
{
args.Player.SendSuccessMessage("Account \"{0}\" has been registered.", account.Name);
args.Player.SendSuccessMessage("Your password is {0}.", echoPassword);
if (!TShock.Config.Settings.DisableUUIDLogin)
args.Player.SendMessage($"Type {Specifier}login to sign in to your account using your UUID.", Color.White);
if (TShock.Config.Settings.AllowLoginAnyUsername)
args.Player.SendMessage($"Type {Specifier}login \"{account.Name.Color(Utils.GreenHighlight)}\" {echoPassword.Color(Utils.BoldHighlight)} to sign in to your account.", Color.White);
else
args.Player.SendMessage($"Type {Specifier}login {echoPassword.Color(Utils.BoldHighlight)} to sign in to your account.", Color.White);
TShock.UserAccounts.AddUserAccount(account);
TShock.Log.ConsoleInfo("{0} registered an account: \"{1}\".", args.Player.Name, account.Name);
}