fix: #178 mail sending lags server
This commit is contained in:
parent
18ce05d07d
commit
92741daaa8
@ -22,6 +22,8 @@ import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static fr.xephi.authme.AuthMe.getScheduler;
|
||||
|
||||
public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
|
||||
private final EmailService emailService;
|
||||
@ -133,17 +135,19 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
||||
* @param name the name of the player to generate a code for
|
||||
*/
|
||||
private void generateCode(String name) {
|
||||
DataSourceValue<String> emailResult = dataSource.getEmail(name);
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
if (emailResult.rowExists()) {
|
||||
final String email = emailResult.getValue();
|
||||
if (!Utils.isEmailEmpty(email)) {
|
||||
String code = RandomStringUtils.generateNum(6); // 6 digits code
|
||||
verificationCodes.put(name.toLowerCase(Locale.ROOT), code);
|
||||
emailService.sendVerificationMail(name, email, code, dateFormat.format(date));
|
||||
getScheduler().runTaskAsynchronously(() -> {
|
||||
DataSourceValue<String> emailResult = dataSource.getEmail(name);
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'-'MM'-'dd'-' HH:mm:ss");
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
if (emailResult.rowExists()) {
|
||||
final String email = emailResult.getValue();
|
||||
if (!Utils.isEmailEmpty(email)) {
|
||||
String code = RandomStringUtils.generateNum(6); // 6 digits code
|
||||
verificationCodes.put(name.toLowerCase(Locale.ROOT), code);
|
||||
emailService.sendVerificationMail(name, email, code, dateFormat.format(date));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -144,7 +144,7 @@ public class TeleportationService implements Reloadable {
|
||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
Location location = buildLocationFromAuth(player, auth);
|
||||
Location playerLoc = player.getLocation();
|
||||
if (location.getX() == playerLoc.getX() && location.getY() == location.getY() && location.getZ() == playerLoc.getZ()
|
||||
if (location.getX() == playerLoc.getX() && location.getY() == playerLoc.getY() && location.getZ() == playerLoc.getZ()
|
||||
&& location.getWorld() == playerLoc.getWorld()) return;
|
||||
logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
|
||||
teleportBackFromSpawn(player, location);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user