-
-
Save matthijs110/f34f45a8e41a1e1150f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static EconomyMain m; | |
public Register(EconomyMain instance) { | |
m = instance; | |
} | |
@Override | |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | |
// /account register <email> <verfiy> | |
Player p = (Player) sender; | |
if (sender instanceof Player) { | |
if (cmd.getName().equalsIgnoreCase("account")) { | |
if (args.length == 3) { | |
if (args[0].equalsIgnoreCase("register")) { | |
if (p.hasPermission("server.register")) { | |
String email = args[1].toString(); | |
String verify = args[2].toString(); | |
if (email.contains("@")) { | |
if(AccountController.getExistingEmail(m, email)){ | |
if (verify.equals(email) && email.equals(verify)) { | |
String smpthost = "smtp.live.com"; // //Address of gmail | |
String mailsender = "test@outlook.com"; //Your email | |
String password = "Test"; //Your password (Will be send encrypted to the server)" | |
String receiver = p.getName(); //Name of the recipient | |
String receiveremail = email; //Email of the recipient | |
String content = "Hello " + p.getName() + "!"; | |
SMTP.Email mail = SMTP.createEmptyEmail(); | |
email.add("Content-Type", "text/html"); | |
email.from("You", mailsender); | |
email.to(receiver, receiveremail); | |
email.subject("A subject"); | |
email.body("<b>Test</b>"); | |
SMTP.sendEmail(smpthost, mailsender, password, mail, false); | |
p.sendMessage(EconomyMain.Prefix + ChatColor.YELLOW + "Email sendt " + ChatColor.RED + mail); | |
AccountController.register(m, p.getUniqueId(), p.getName(), receiveremail); | |
} else { | |
p.sendMessage(EconomyMain.Prefix + ChatColor.RED + "Email does not equal!"); | |
} | |
} else { | |
p.sendMessage(EconomyMain.Prefix + ChatColor.RED + "Email is in use!"); | |
} | |
} else { | |
p.sendMessage(EconomyMain.Prefix + ChatColor.RED + "Invalid email"); | |
} | |
} | |
} | |
} | |
} | |
} else { | |
sender.sendMessage(EconomyMain.Console_Error); | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment