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] 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); }