Improved email hiding method

This commit is contained in:
HexelDev 2017-08-11 17:58:13 +02:00
parent 67b4efa4ab
commit cb60d7bd81

View File

@ -34,10 +34,11 @@ public class ShowEmailCommand extends PlayerCommand {
private String emailMask(String email){
String[] frag = email.split("@"); //Split id and domain
int sid = frag[0].length() / 3 + 1; //Define the id view
int sdomain = frag[1].length() / 3 + 1; //Define the domain view
int sid = frag[0].length() / 3 + 1; //Define the id view (must be a value >= 1)
String[] dom = frag[1].split("."); //Domain substrings
int sdomain = dom[0].length() / 3; //Define the domain view (must be a value >= 0)
String id = frag[0].substring(0, sid) + "*****"; //Build the id
String domain = "***" + frag[1].substring(sdomain); //Build the domain
String domain = "***" + dom[0].substring(sdomain) + "." + dom[1]; //Build the domain
return id + "@" + domain;
}
}