mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-31 07:39:42 +01:00
implement async change email into management class.
This commit is contained in:
parent
f6a91085bd
commit
4eb94787ac
@ -19,75 +19,92 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||
*/
|
||||
public class Management {
|
||||
|
||||
private final AuthMe pl;
|
||||
private final AuthMe plugin;
|
||||
private final BukkitScheduler sched;
|
||||
public static RandomString rdm = new RandomString(Settings.captchaLength);
|
||||
|
||||
public Management(AuthMe plugin) {
|
||||
this.pl = plugin;
|
||||
this.sched = pl.getServer().getScheduler();
|
||||
this.plugin = plugin;
|
||||
this.sched = this.plugin.getServer().getScheduler();
|
||||
}
|
||||
|
||||
public void performLogin(final Player player, final String password, final boolean forceLogin) {
|
||||
sched.runTaskAsynchronously(pl, new Runnable() {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogin(player, password, forceLogin, pl, pl.database).process();
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void performLogout(final Player player) {
|
||||
sched.runTaskAsynchronously(pl, new Runnable() {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogout(player, pl, pl.database).process();
|
||||
new AsyncronousLogout(player, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void performRegister(final Player player, final String password, final String email) {
|
||||
sched.runTaskAsynchronously(pl, new Runnable() {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncRegister(player, password, email, pl, pl.database).process();
|
||||
new AsyncRegister(player, password, email, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void performUnregister(final Player player, final String password, final boolean force) {
|
||||
sched.runTaskAsynchronously(pl, new Runnable() {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousUnregister(player, password, force, pl).process();
|
||||
new AsyncronousUnregister(player, password, force, plugin).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void performJoin(final Player player) {
|
||||
sched.runTaskAsynchronously(pl, new Runnable() {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousJoin(player, pl, pl.database).process();
|
||||
new AsyncronousJoin(player, plugin, plugin.database).process();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void performQuit(final Player player, final boolean isKick) {
|
||||
sched.runTaskAsynchronously(pl, new Runnable() {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousQuit(player, pl, pl.database, isKick).process();
|
||||
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void performAddEmail(final Player player, final String newEmail, final String newEmailVerify) {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncChangeEmail(player, plugin, null, newEmail, newEmailVerify).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void performChangeEmail(final Player player, final String oldEmail, final String newEmail) {
|
||||
sched.runTaskAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncChangeEmail(player, plugin, oldEmail, newEmail).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,12 @@ public class AsyncChangeEmail {
|
||||
PlayerCache.getInstance().updatePlayer(auth);
|
||||
m.send(player, "email_changed");
|
||||
player.sendMessage(Arrays.toString(m.send("email_defined")) + auth.getEmail());
|
||||
} else {
|
||||
if (!plugin.database.isAuthAvailable(playerName)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
m.send(player, "reg_email_msg");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user