From 1521c8b28e271272813bcde6f70187fb332d18d4 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Mon, 19 Jul 2021 20:03:39 -0400 Subject: [PATCH 1/9] Improved login error messages and onboarding process Added config based checks so error messages only tell what is relevant to the user. Doesn't make any sense to tell them you can do /login when UUID is set to false because they will just get the same error message again. Also added an additional info message to the onboarding/password registration process so the next steps will be more obvious for first time users. --- TShockAPI/Commands.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index b6ba179f..a8a287b0 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -807,9 +807,17 @@ namespace TShockAPI } else { - args.Player.SendErrorMessage("Syntax: {0}login - Logs in using your UUID and character name", Specifier); - args.Player.SendErrorMessage(" {0}login - Logs in using your password and character name", Specifier); - args.Player.SendErrorMessage(" {0}login - Logs in using your username and password", Specifier); + if (TShock.Config.Settings.DisableUUIDLogin && !TShock.Config.Settings.AllowLoginAnyUsername) + args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); + else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername) + { + args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); + args.Player.SendErrorMessage($" {Specifier}login - Logs in using your username and password"); + } + else + { + args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your UUID and character name"); + } args.Player.SendErrorMessage("If you forgot your password, there is no way to recover it."); return; } @@ -991,6 +999,14 @@ 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 && !TShock.Config.Settings.AllowLoginAnyUsername) + args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); + else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername) + args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); + else + { + args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); + } TShock.UserAccounts.AddUserAccount(account); TShock.Log.ConsoleInfo("{0} registered an account: \"{1}\".", args.Player.Name, account.Name); } From cdafad1d5ab30404cca407e72ef02eaaae518432 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Mon, 19 Jul 2021 20:10:11 -0400 Subject: [PATCH 2/9] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55df643..53ffbb74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added `summonboss` permission check for Prismatic Lacewing. Players who do not have said permission will be unable to kill this critter, as it will summon the Empress of Light. Also added support for the `AnonymousBossInvasions` config option, if this is set to `false` it will now broadcast the name of the player who summoned her. (@moisterrific) * Added `ForceTime` config setting check for Enchanted Sundial usage. If `ForceTime` is set to anything other than `normal`, Sundial use will be rejected as this would lead to very janky game behavior. Additionally, players with `cfgreload` permission will be advised to change it back to `normal` in order to use sundial. (@moisterrific, @bartico6) * Added `%onlineplayers%` and `%serverslots%` placeholders for MOTD. The default MOTD message was also updated to use this. (@moisterrific, @bartico6) +* Improved `/login` related error messages and made the `/register` process more friendly for players new to TShock. (@moisterrific) ## TShock 4.5.4 * Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri) From 640c4ebdb50b601913d74d932bda7413ecf97809 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Mon, 19 Jul 2021 20:25:20 -0400 Subject: [PATCH 3/9] Slightly even better idea I just realized --- TShockAPI/Commands.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index a8a287b0..280c1cfb 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -1000,9 +1000,9 @@ 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 && !TShock.Config.Settings.AllowLoginAnyUsername) - args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); + args.Player.SendInfoMessage($"Type {Specifier}login {echoPassword} to sign in to your account."); else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername) - args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); + args.Player.SendInfoMessage($"Type {Specifier}login \"{account.Name}\" {echoPassword} to sign in to your account."); else { args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); From 5bce3b3492ff60526e3575d96444edeb5e35cbfd Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:13:11 -0400 Subject: [PATCH 4/9] Update CHANGELOG.md with suggested change Co-authored-by: Lucas Nicodemus --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff0dc50..e33eaf01 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 -* Improved `/login` related error messages and made the `/register` process more friendly for players new to TShock. (@moisterrific) +* Changed `/login` and `/register` 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. (@moisterrific) ## TShock 4.5.5 * Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro) From 86b5454854f44409cd872be97227ccaee6874290 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:37:09 -0400 Subject: [PATCH 5/9] Refactor for readability --- TShockAPI/Commands.cs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 280c1cfb..d2659c97 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -807,17 +807,18 @@ namespace TShockAPI } else { - if (TShock.Config.Settings.DisableUUIDLogin && !TShock.Config.Settings.AllowLoginAnyUsername) - args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); - else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername) + if (TShock.Config.Settings.DisableUUIDLogin) { - args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); - args.Player.SendErrorMessage($" {Specifier}login - Logs in using your username and password"); + if (TShock.Config.Settings.AllowLoginAnyUsername) + { + args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); + args.Player.SendErrorMessage($" {Specifier}login - Logs in using your username and password"); + } + else + args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); } else - { args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your UUID and character name"); - } args.Player.SendErrorMessage("If you forgot your password, there is no way to recover it."); return; } @@ -999,14 +1000,17 @@ 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 && !TShock.Config.Settings.AllowLoginAnyUsername) - args.Player.SendInfoMessage($"Type {Specifier}login {echoPassword} to sign in to your account."); - else if (TShock.Config.Settings.DisableUUIDLogin && TShock.Config.Settings.AllowLoginAnyUsername) - args.Player.SendInfoMessage($"Type {Specifier}login \"{account.Name}\" {echoPassword} to sign in to your account."); - else + + if (TShock.Config.Settings.DisableUUIDLogin) { - args.Player.SendInfoMessage($"Type {Specifier}login to sign in to your account."); + if (TShock.Config.Settings.AllowLoginAnyUsername) + args.Player.SendInfoMessage($"Type {Specifier}login \"{account.Name}\" {echoPassword} to sign in to your account."); + else + args.Player.SendInfoMessage($"Type {Specifier}login {echoPassword} to sign in to your account."); } + else + args.Player.SendSuccessMessage($"Type {Specifier}login to sign in to your account."); + TShock.UserAccounts.AddUserAccount(account); TShock.Log.ConsoleInfo("{0} registered an account: \"{1}\".", args.Player.Name, account.Name); } From fc2330458e81fb871271b47336a3a6eac5471018 Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sat, 24 Jul 2021 22:47:28 -0400 Subject: [PATCH 6/9] Change to independent checks and use colour differentiation --- TShockAPI/Commands.cs | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 8ebea2b9..178c64b7 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -807,19 +807,15 @@ namespace TShockAPI } else { - if (TShock.Config.Settings.DisableUUIDLogin) - { - if (TShock.Config.Settings.AllowLoginAnyUsername) - { - args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); - args.Player.SendErrorMessage($" {Specifier}login - Logs in using your username and password"); - } - else - args.Player.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your password and character name"); - } + 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.SendErrorMessage($"Syntax: {Specifier}login - Logs in using your UUID and character name"); - args.Player.SendErrorMessage("If you forgot your password, there is no way to recover it."); + 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 @@ -1001,15 +997,13 @@ 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) - { - if (TShock.Config.Settings.AllowLoginAnyUsername) - args.Player.SendInfoMessage($"Type {Specifier}login \"{account.Name}\" {echoPassword} to sign in to your account."); - else - args.Player.SendInfoMessage($"Type {Specifier}login {echoPassword} to sign in to your account."); - } + if (!TShock.Config.Settings.DisableUUIDLogin) + args.Player.SendMessage($"Type {Specifier}login to sign in to your account.", 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.SendSuccessMessage($"Type {Specifier}login to sign in to your account."); + 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); From ec4b21e78d431c0c13d30691bc7bbd4861420ccb Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sat, 24 Jul 2021 22:51:38 -0400 Subject: [PATCH 7/9] Fix grammar typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27c710e6..5d634545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +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` 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. (@moisterrific) +* 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. (@moisterrific) ## TShock 4.5.5 * Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro) From 838c03ce3f7f676d4ad8c37c95d91d5f11b840fc Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sun, 25 Jul 2021 15:45:43 -0400 Subject: [PATCH 8/9] Make UUID login help more descriptive Co-authored-by: Lucas Nicodemus --- TShockAPI/Commands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 178c64b7..2633d237 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -998,7 +998,7 @@ namespace TShockAPI 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.", Color.White); + 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); From 46865d2ad4ba5aa1c7727a34cc75ca632faafece Mon Sep 17 00:00:00 2001 From: stacey <57187883+moisterrific@users.noreply.github.com> Date: Sun, 25 Jul 2021 16:10:31 -0400 Subject: [PATCH 9/9] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d634545..54ef2466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +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. (@moisterrific) +* 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) ## TShock 4.5.5 * Changed the world autosave message so that it no longer warns of a "potential lag spike." (@hakusaro)