public override void Use(Player p, string message) { string Owner = Server.server_owner; if (Server.server_owner == "Notch") { Owner = "the owner"; } if (p.group.Permission < Server.verifyadminsrank) { Player.SendMessage(p, "You do not have the &crequired rank to use this command!"); return; } if (Server.verifyadmins == false) { Player.SendMessage(p, "Verification of admins is &cdisabled!"); return; } if (p.adminpen == false) { { Player.SendMessage(p, "You have &calready verified" + Server.DefaultColor + ", why are you using this?"); Player.SendMessage(p, "To set a new password use &a/setpass [Pass]!"); return; } } if (p.passtries == 3) { p.Kick("Did you really think you could keep on guessing?"); return; } int foundone = 0; if (message == "") { Help(p); return; } int number = message.Split(' ').Length; if (number > 1) { Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!"); return; } if (!Directory.Exists("extra/passwords")) { Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } DirectoryInfo di = new DirectoryInfo("extra/passwords/"); FileInfo[] fi = di.GetFiles("*.xml"); Thread.Sleep(10); try { foreach (FileInfo file in fi) { if (file.Name.Replace(".xml", "") == p.name) { foundone++; } } } catch { Player.SendMessage(p, "An Error Occurred! Try again soon!"); return; } if (foundone < 0) { Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } if (foundone > 1) { Player.SendMessage(p, "&cAn error has occurred!"); return; } if (!File.Exists("extra/passwords/" + p.name + ".xml")) { Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } Crypto.DecryptStringAES(File.ReadAllText("extra/passwords/" + p.name + ".xml"), "MCForgeEncryption", p, message); if (message == password) { Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!"); if (p.adminpen == true) { p.adminpen = false; } password = ""; p.passtries = 0; return; } p.passtries++; Player.SendMessage(p, "&cIncorrect Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!"); Player.SendMessage(p, "If you have &cforgotten your password, " + Server.DefaultColor + "contact " + Owner + " and they can reset it! &cIncorrect " + Server.DefaultColor + "Tries: &b" + p.passtries); return; }
public override void Use(Player p, string message) { if ( p.group.Permission < Server.verifyadminsrank ) { Player.SendMessage(p, "You do not have the &crequired rank to use this command!"); return; } if ( !Server.verifyadmins ) { Player.SendMessage(p, "Verification of admins is &cdisabled!"); return; } if ( !p.adminpen ) { Player.SendMessage(p, "You have &calready verified."); return; } if ( p.passtries >= 3 ) { p.Kick("Did you really think you could keep on guessing?"); return; } if ( String.IsNullOrEmpty(message.Trim()) ) { Help(p); return; } int number = message.Split(' ').Length; if ( number > 1 ) { Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!"); return; } if ( !Directory.Exists("extra/passwords") ) { Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } DirectoryInfo di = new DirectoryInfo("extra/passwords/"); FileInfo[] fi = di.GetFiles("*.dat"); if ( !File.Exists("extra/passwords/" + p.name + ".dat") ) { Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!"); return; } if ( PasswordHasher.MatchesPass(p.name, message) ) { Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!"); if ( p.adminpen ) { p.adminpen = false; } return; } p.passtries++; Player.SendMessage(p, "&cWrong Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!"); Player.SendMessage(p, "Forgot your password? " + Server.DefaultColor + "Contact the owner so they can reset it!"); }