From 32c764579559e8791ab5a742e298735f58e0583c Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 21 Feb 2015 17:36:32 -0700 Subject: [PATCH] /user del now responds appropriately if the user doesn't exist --- TShockAPI/Commands.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 6d04e914..da190a88 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -954,13 +954,18 @@ namespace TShockAPI args.Player.SendSuccessMessage("Account removed successfully."); Log.ConsoleInfo(args.Player.Name + " successfully deleted account: " + args.Parameters[1] + "."); } + catch (UserNotExistException e) + { + args.Player.SendErrorMessage("The user " + user.Name + " does not exist! Deleted nobody!"); + } catch (UserManagerException ex) { args.Player.SendMessage(ex.Message, Color.Red); Log.ConsoleError(ex.ToString()); } } - // Password changing requires a username, and a new password to set + + // Password changing requires a username, and a new password to set else if (subcmd == "password") { var user = new User(); @@ -985,11 +990,11 @@ namespace TShockAPI Log.ConsoleError(ex.ToString()); } } - // Group changing requires a username or IP address, and a new group to set + // Group changing requires a username or IP address, and a new group to set else if (subcmd == "group") { - var user = new User(); - user.Name = args.Parameters[1]; + var user = new User(); + user.Name = args.Parameters[1]; try {