mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-24 00:21:34 +01:00
Set classes to use Messages getter in plugin instance.
This commit is contained in:
parent
0601ab0e40
commit
2de0e0e819
@ -221,7 +221,7 @@ public class AuthMe extends JavaPlugin {
|
||||
this.otherAccounts = OtherAccounts.getInstance();
|
||||
|
||||
// Setup messages
|
||||
this.messages = Messages.getInstance();
|
||||
this.messages = new Messages(Settings.messageFile, Settings.messagesLanguage);
|
||||
|
||||
// Set up Metrics
|
||||
setupMetrics();
|
||||
@ -902,7 +902,7 @@ public class AuthMe extends JavaPlugin {
|
||||
*
|
||||
* @return The real IP of the player.
|
||||
*/
|
||||
// TODO: Cache the result
|
||||
// TODO: Cache the result or run it async, it can cause trouble if verygames server isn't responding.
|
||||
@Deprecated
|
||||
public String getVeryGamesIp(Player player) {
|
||||
String realIP = player.getAddress().getAddress().getHostAddress();
|
||||
|
@ -21,7 +21,7 @@ public class AccountsCommand extends ExecutableCommand {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the player query
|
||||
String playerQuery = sender.getName();
|
||||
|
@ -20,8 +20,9 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
|
||||
@Override
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the player and password
|
||||
String playerName = commandArguments.get(0);
|
||||
@ -47,9 +48,7 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the password
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final String playerNameLowerCase = playerName.toLowerCase();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class GetEmailCommand extends ExecutableCommand {
|
||||
|
||||
// Get the authenticated user
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
Messages m = Messages.getInstance();
|
||||
Messages m = plugin.getMessages();
|
||||
PlayerAuth auth = plugin.database.getAuth(playerName.toLowerCase());
|
||||
if (auth == null) {
|
||||
m.send(sender, "unknown_user");
|
||||
|
@ -22,7 +22,7 @@ public class LastLoginCommand extends ExecutableCommand {
|
||||
|
||||
// Validate the player
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
Messages m = Messages.getInstance();
|
||||
Messages m = plugin.getMessages();
|
||||
|
||||
PlayerAuth auth;
|
||||
try {
|
||||
|
@ -28,7 +28,7 @@ public class PurgeLastPositionCommand extends ExecutableCommand {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the player
|
||||
String playerName = sender.getName();
|
||||
|
@ -32,7 +32,7 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the player name and password
|
||||
final String playerName = commandArguments.get(0);
|
||||
|
@ -33,15 +33,15 @@ public class ReloadCommand extends ExecutableCommand {
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
Messages m = Messages.getInstance();
|
||||
Messages m = plugin.getMessages();
|
||||
|
||||
// Show a status message
|
||||
// sender.sendMessage(ChatColor.YELLOW + "Reloading AuthMeReloaded...");
|
||||
|
||||
try {
|
||||
Settings.reload();
|
||||
plugin.setMessages(new Messages(Settings.messageFile, Settings.messagesLanguage));
|
||||
plugin.getModuleManager().reloadModules();
|
||||
Messages.getInstance().reloadMessages();
|
||||
plugin.setupDatabase();
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError("Fatal error occurred! AuthMe instance ABORTED!");
|
||||
|
@ -28,7 +28,7 @@ public class SetEmailCommand extends ExecutableCommand {
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
Messages m = Messages.getInstance();
|
||||
Messages m = plugin.getMessages();
|
||||
|
||||
// Get the player name and email address
|
||||
String playerName = commandArguments.get(0);
|
||||
|
@ -39,7 +39,7 @@ public class UnregisterCommand extends ExecutableCommand {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the player name
|
||||
String playerName = commandArguments.get(0);
|
||||
|
@ -29,8 +29,11 @@ public class CaptchaCommand extends ExecutableCommand {
|
||||
// Get the parameter values
|
||||
String captcha = commandArguments.get(0);
|
||||
|
||||
// AuthMe plugin instance
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Command logic
|
||||
if (PlayerCache.getInstance().isAuthenticated(playerNameLowerCase)) {
|
||||
@ -43,8 +46,6 @@ public class CaptchaCommand extends ExecutableCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
// AuthMe plugin instance
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
if (!plugin.cap.containsKey(playerNameLowerCase)) {
|
||||
m.send(player, MessageKey.USAGE_LOGIN);
|
||||
|
@ -16,7 +16,8 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
final Messages m = Messages.getInstance();
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the passwords
|
||||
String playerPass = commandArguments.get(0);
|
||||
@ -37,7 +38,11 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
|
||||
// Make sure the password is allowed
|
||||
String playerPassLowerCase = playerPass.toLowerCase();
|
||||
if (playerPassLowerCase.contains("delete") || playerPassLowerCase.contains("where") || playerPassLowerCase.contains("insert") || playerPassLowerCase.contains("modify") || playerPassLowerCase.contains("from") || playerPassLowerCase.contains("select") || playerPassLowerCase.contains(";") || playerPassLowerCase.contains("null") || !playerPassLowerCase.matches(Settings.getPassRegex)) {
|
||||
if (playerPassLowerCase.contains("delete") || playerPassLowerCase.contains("where")
|
||||
|| playerPassLowerCase.contains("insert") || playerPassLowerCase.contains("modify")
|
||||
|| playerPassLowerCase.contains("from") || playerPassLowerCase.contains("select")
|
||||
|| playerPassLowerCase.contains(";") || playerPassLowerCase.contains("null")
|
||||
|| !playerPassLowerCase.matches(Settings.getPassRegex)) {
|
||||
m.send(player, "password_error");
|
||||
return true;
|
||||
}
|
||||
@ -45,7 +50,8 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
m.send(player, "password_error_nick");
|
||||
return true;
|
||||
}
|
||||
if (playerPassLowerCase.length() < Settings.getPasswordMinLen || playerPassLowerCase.length() > Settings.passwordMaxLength) {
|
||||
if (playerPassLowerCase.length() < Settings.getPasswordMinLen
|
||||
|| playerPassLowerCase.length() > Settings.passwordMaxLength) {
|
||||
m.send(player, "pass_len");
|
||||
return true;
|
||||
}
|
||||
@ -57,8 +63,8 @@ public class ChangePasswordCommand extends ExecutableCommand {
|
||||
}
|
||||
|
||||
// Set the password
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, playerPass, playerPassVerify));
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin,
|
||||
new ChangePasswordTask(plugin, player, playerPass, playerPassVerify));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class ConverterCommand extends ExecutableCommand {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Get the conversion job
|
||||
String job = commandArguments.get(0);
|
||||
|
@ -35,7 +35,7 @@ public class RecoverEmailCommand extends ExecutableCommand {
|
||||
|
||||
// Command logic
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
if (plugin.mail == null) {
|
||||
m.send(player, "error");
|
||||
|
@ -16,7 +16,6 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
final Messages m = Messages.getInstance();
|
||||
|
||||
// Make sure the sender is a player
|
||||
if (!(sender instanceof Player)) {
|
||||
@ -24,6 +23,9 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Make sure the command arguments are valid
|
||||
final Player player = (Player) sender;
|
||||
if (commandArguments.getCount() == 0 || (Settings.getEnablePasswordVerifier && commandArguments.getCount() < 2)) {
|
||||
@ -31,7 +33,7 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Management management = AuthMe.getInstance().getManagement();
|
||||
final Management management = plugin.getManagement();
|
||||
if (Settings.emailRegistration && !Settings.getmailAccount.isEmpty()) {
|
||||
if (Settings.doubleEmailCheck) {
|
||||
if (commandArguments.getCount() < 2 || !commandArguments.get(0).equals(commandArguments.get(1))) {
|
||||
@ -44,16 +46,16 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
m.send(player, "email_invalid");
|
||||
return true;
|
||||
}
|
||||
RandomString rand = new RandomString(Settings.getRecoveryPassLength);
|
||||
final String thePass = rand.nextString();
|
||||
final String thePass = new RandomString(Settings.getRecoveryPassLength).nextString();
|
||||
management.performRegister(player, thePass, email);
|
||||
return true;
|
||||
}
|
||||
if (commandArguments.getCount() > 1 && Settings.getEnablePasswordVerifier)
|
||||
if (commandArguments.getCount() > 1 && Settings.getEnablePasswordVerifier) {
|
||||
if (!commandArguments.get(0).equals(commandArguments.get(1))) {
|
||||
m.send(player, "password_error");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
management.performRegister(player, commandArguments.get(0), "");
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class UnregisterCommand extends ExecutableCommand {
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
final Messages m = plugin.getMessages();
|
||||
|
||||
// Make sure the current command executor is a player
|
||||
if (!(sender instanceof Player)) {
|
||||
|
@ -52,7 +52,7 @@ public class SqlToFlat implements Converter {
|
||||
sender.sendMessage("Successfully convert from SQL table to file auths.db");
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
Messages.getInstance().send(sender, "error");
|
||||
plugin.getMessages().send(sender, "error");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
public static final ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<>();
|
||||
public final AuthMe plugin;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for AuthMePlayerListener.
|
||||
@ -48,6 +48,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public AuthMePlayerListener(AuthMe plugin) {
|
||||
this.m = plugin.getMessages();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,8 @@ import org.bukkit.plugin.Plugin;
|
||||
*/
|
||||
public class AuthMeServerListener implements Listener {
|
||||
|
||||
public final AuthMe plugin;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final AuthMe plugin;
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for AuthMeServerListener.
|
||||
@ -26,6 +26,7 @@ public class AuthMeServerListener implements Listener {
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public AuthMeServerListener(AuthMe plugin) {
|
||||
this.m = plugin.getMessages();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -23,12 +23,12 @@ public class AsyncChangeEmail {
|
||||
private final Messages m;
|
||||
|
||||
public AsyncChangeEmail(Player player, AuthMe plugin, String oldEmail, String newEmail, String newEmailVerify) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
this.oldEmail = oldEmail;
|
||||
this.newEmail = newEmail;
|
||||
this.newEmailVerify = newEmailVerify;
|
||||
this.m = Messages.getInstance();
|
||||
}
|
||||
|
||||
public AsyncChangeEmail(Player player, AuthMe plugin, String oldEmail, String newEmail) {
|
||||
|
@ -40,12 +40,12 @@ public class AsynchronousJoin {
|
||||
private final BukkitScheduler sched;
|
||||
|
||||
public AsynchronousJoin(Player player, AuthMe plugin, DataSource database) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
this.sched = plugin.getServer().getScheduler();
|
||||
this.database = database;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.m = Messages.getInstance();
|
||||
}
|
||||
|
||||
public void process() {
|
||||
|
@ -33,7 +33,7 @@ public class AsynchronousLogin {
|
||||
protected final boolean forceLogin;
|
||||
private final AuthMe plugin;
|
||||
private final DataSource database;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for AsynchronousLogin.
|
||||
@ -44,12 +44,12 @@ public class AsynchronousLogin {
|
||||
* @param plugin AuthMe
|
||||
* @param data DataSource
|
||||
*/
|
||||
public AsynchronousLogin(Player player, String password, boolean forceLogin,
|
||||
AuthMe plugin, DataSource data) {
|
||||
public AsynchronousLogin(Player player, String password, boolean forceLogin, AuthMe plugin, DataSource data) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.password = password;
|
||||
name = player.getName().toLowerCase();
|
||||
realName = player.getName();
|
||||
this.realName = player.getName();
|
||||
this.forceLogin = forceLogin;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
|
@ -20,7 +20,7 @@ public class AsynchronousLogout {
|
||||
protected final AuthMe plugin;
|
||||
protected final DataSource database;
|
||||
protected boolean canLogout = true;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for AsynchronousLogout.
|
||||
@ -29,8 +29,8 @@ public class AsynchronousLogout {
|
||||
* @param plugin AuthMe
|
||||
* @param database DataSource
|
||||
*/
|
||||
public AsynchronousLogout(Player player, AuthMe plugin,
|
||||
DataSource database) {
|
||||
public AsynchronousLogout(Player player, AuthMe plugin, DataSource database) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
|
@ -22,7 +22,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
protected final Player player;
|
||||
protected final AuthMe plugin;
|
||||
protected final String name;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for ProcessSyncronousPlayerLogout.
|
||||
@ -31,6 +31,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public ProcessSyncronousPlayerLogout(Player player, AuthMe plugin) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.plugin = plugin;
|
||||
this.name = player.getName().toLowerCase();
|
||||
|
@ -23,7 +23,7 @@ public class AsyncRegister {
|
||||
protected String email = "";
|
||||
private final AuthMe plugin;
|
||||
private final DataSource database;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for AsyncRegister.
|
||||
@ -34,11 +34,11 @@ public class AsyncRegister {
|
||||
* @param plugin AuthMe
|
||||
* @param data DataSource
|
||||
*/
|
||||
public AsyncRegister(Player player, String password, String email,
|
||||
AuthMe plugin, DataSource data) {
|
||||
public AsyncRegister(Player player, String password, String email, AuthMe plugin, DataSource data) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
name = player.getName().toLowerCase();
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.email = email;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
|
@ -20,7 +20,7 @@ public class ProcessSyncEmailRegister implements Runnable {
|
||||
protected final Player player;
|
||||
protected final String name;
|
||||
private final AuthMe plugin;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for ProcessSyncEmailRegister.
|
||||
@ -29,6 +29,7 @@ public class ProcessSyncEmailRegister implements Runnable {
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public ProcessSyncEmailRegister(Player player, AuthMe plugin) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.plugin = plugin;
|
||||
|
@ -25,7 +25,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
protected final Player player;
|
||||
protected final String name;
|
||||
private final AuthMe plugin;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
|
||||
/**
|
||||
* Constructor for ProcessSyncronousPasswordRegister.
|
||||
@ -34,6 +34,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public ProcessSyncronousPasswordRegister(Player player, AuthMe plugin) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.plugin = plugin;
|
||||
|
@ -29,7 +29,7 @@ public class AsynchronousUnregister {
|
||||
protected final String password;
|
||||
protected final boolean force;
|
||||
private final AuthMe plugin;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
private final JsonCache playerCache;
|
||||
|
||||
/**
|
||||
@ -40,12 +40,12 @@ public class AsynchronousUnregister {
|
||||
* @param force boolean
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public AsynchronousUnregister(Player player, String password,
|
||||
boolean force, AuthMe plugin) {
|
||||
public AsynchronousUnregister(Player player, String password, boolean force, AuthMe plugin) {
|
||||
this.m = plugin.getMessages();
|
||||
this.player = player;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.password = password;
|
||||
this.force = force;
|
||||
name = player.getName().toLowerCase();
|
||||
this.plugin = plugin;
|
||||
this.playerCache = new JsonCache();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.io.File;
|
||||
/**
|
||||
*/
|
||||
// TODO ljacqu 20151124: This class is a weird mix between singleton and POJO
|
||||
// TODO: change it into POJO
|
||||
public class Messages extends CustomConfiguration {
|
||||
|
||||
/** The section symbol, used in Minecraft for formatting codes. */
|
||||
|
@ -42,7 +42,7 @@ public class ChangePasswordTask implements Runnable {
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Messages m = Messages.getInstance();
|
||||
Messages m = plugin.getMessages();
|
||||
try {
|
||||
String name = player.getName().toLowerCase();
|
||||
String hashNew = PasswordSecurity.getHash(Settings.getPasswordHash, newPassword, name);
|
||||
|
@ -12,7 +12,7 @@ public class TimeoutTask implements Runnable {
|
||||
|
||||
private final AuthMe plugin;
|
||||
private final String name;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final Messages m;
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
@ -23,6 +23,7 @@ public class TimeoutTask implements Runnable {
|
||||
* @param player Player
|
||||
*/
|
||||
public TimeoutTask(AuthMe plugin, String name, Player player) {
|
||||
this.m = plugin.getMessages();
|
||||
this.plugin = plugin;
|
||||
this.name = name;
|
||||
this.player = player;
|
||||
@ -44,15 +45,16 @@ public class TimeoutTask implements Runnable {
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline())
|
||||
if (player.isOnline()) {
|
||||
player.kickPlayer(m.send("timeout")[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user