79 lines
2.3 KiB
Java
79 lines
2.3 KiB
Java
package cn.citycraft.AuthMe.process;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.plugin.PluginManager;
|
|
|
|
import cn.citycraft.AuthMe.AuthMe;
|
|
import cn.citycraft.AuthMe.process.join.AsyncronousJoin;
|
|
import cn.citycraft.AuthMe.process.login.AsyncronousLogin;
|
|
import cn.citycraft.AuthMe.process.logout.AsyncronousLogout;
|
|
import cn.citycraft.AuthMe.process.quit.AsyncronousQuit;
|
|
import cn.citycraft.AuthMe.process.register.AsyncronousRegister;
|
|
import cn.citycraft.AuthMe.security.RandomString;
|
|
import cn.citycraft.AuthMe.settings.Settings;
|
|
|
|
/**
|
|
*
|
|
* @authors Xephi59,
|
|
* <a href="http://dev.bukkit.org/profiles/Possible/">Possible</a>
|
|
*
|
|
*/
|
|
public class Management {
|
|
|
|
public static RandomString rdm = new RandomString(Settings.captchaLength);
|
|
public AuthMe plugin;
|
|
public PluginManager pm;
|
|
|
|
public Management(final AuthMe plugin) {
|
|
this.plugin = plugin;
|
|
this.pm = plugin.getServer().getPluginManager();
|
|
}
|
|
|
|
public void performJoin(final Player player) {
|
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
new AsyncronousJoin(player, plugin, plugin.database).process();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void performLogin(final Player player, final String password, final boolean forceLogin) {
|
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void performLogout(final Player player) {
|
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
new AsyncronousLogout(player, plugin, plugin.database).process();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void performQuit(final Player player, final boolean isKick) {
|
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
public void performRegister(final Player player, final String password, final String email) {
|
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
new AsyncronousRegister(player, password, email, plugin, plugin.database).process();
|
|
}
|
|
});
|
|
}
|
|
}
|