From 236cf6b42b1925d0900417a3c99466bebbb04bf7 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 12 Jul 2011 00:54:03 -0600 Subject: [PATCH] Added /user del - Which removes a user/ip from the database. (Or, if I did the SQL wrong, will remove every row from the database) --- TShockAPI/Commands.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 5a44ea12..10e750e9 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -326,7 +326,7 @@ namespace TShockAPI { if (args.Parameters.Count < 3) { - args.Player.SendMessage("Syntax: /user add [group]"); + args.Player.SendMessage("Syntax: /user [group]"); args.Player.SendMessage("Note: Passwords are stored with SHA512 hashing. To reset a user's password, remove and re-add them."); return; } @@ -362,7 +362,28 @@ namespace TShockAPI args.Player.SendMessage("Invalid syntax. Try /user help.", Color.Red); } else if (args.Parameters[0] == "del") { - + if (args.Parameters[1].Contains(".")) + { + //If this isn't an IP, well... + if (TShock.Users.RemoveUser(args.Parameters[1], true) == 1) + { + args.Player.SendMessage("IP removed successfully.", Color.Green); + } + else + { + args.Player.SendMessage("IP wasn't removed. Was it invalid?", Color.Red); + } + } else + { + if (TShock.Users.RemoveUser(args.Parameters[1], false) == 1) + { + args.Player.SendMessage("Account removed successfully.", Color.Green); + } + else + { + args.Player.SendMessage("Account wasn't removed. Was it invalid?", Color.Red); + } + } } } }