Revert changes
This commit is contained in:
@@ -2,8 +2,6 @@ package fr.xephi.authme;
|
||||
|
||||
import ch.jalu.injector.Injector;
|
||||
import ch.jalu.injector.InjectorBuilder;
|
||||
import com.github.Anon8281.universalScheduler.UniversalScheduler;
|
||||
import com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler;
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import fr.xephi.authme.command.CommandHandler;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
@@ -79,7 +77,6 @@ public class AuthMe extends JavaPlugin {
|
||||
private static final String pluginBuild = "b";
|
||||
private static String pluginBuildNumber = "40";
|
||||
// Private instances
|
||||
private static TaskScheduler scheduler;
|
||||
private EmailService emailService;
|
||||
private CommandHandler commandHandler;
|
||||
@Inject
|
||||
@@ -105,14 +102,6 @@ public class AuthMe extends JavaPlugin {
|
||||
return pluginBuild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Universal Scheduler
|
||||
*
|
||||
* @return TaskScheduler
|
||||
*/
|
||||
public static TaskScheduler getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plugin's name.
|
||||
@@ -150,7 +139,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
// Load the plugin version data from the plugin description file
|
||||
loadPluginInfo(getDescription().getVersion());
|
||||
scheduler = UniversalScheduler.getScheduler(this);
|
||||
|
||||
// Set the Logger instance and log file path
|
||||
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
||||
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
||||
@@ -195,12 +184,11 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
// Schedule clean up task
|
||||
CleanupTask cleanupTask = injector.getSingleton(CleanupTask.class);
|
||||
getScheduler().runTaskTimerAsynchronously(cleanupTask, CLEANUP_INTERVAL, CLEANUP_INTERVAL);
|
||||
cleanupTask.runTaskTimerAsynchronously(this, CLEANUP_INTERVAL, CLEANUP_INTERVAL);
|
||||
// Do a backup on start
|
||||
backupService.doBackup(BackupService.BackupCause.START);
|
||||
// Set up Metrics
|
||||
OnStartupTasks.sendMetrics(this, settings);
|
||||
|
||||
if (settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
|
||||
logger.info("\n" + " ___ __ __ __ ___ \n" +
|
||||
" / | __ __/ /_/ /_ / |/ /__ \n" +
|
||||
@@ -465,9 +453,7 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
|
||||
private void checkServerType() {
|
||||
if (isClassLoaded("io.papermc.paper.threadedregions.RegionizedServerInitEvent")) {
|
||||
logger.info("AuthMeReReloaded is running on Folia");
|
||||
} else if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
||||
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
||||
logger.info("AuthMeReReloaded is running on Paper");
|
||||
} else if (isClassLoaded("catserver.server.CatServerConfig")) {
|
||||
logger.info("AuthMeReReloaded is running on CatServer");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package fr.xephi.authme.data.limbo;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -22,7 +22,7 @@ public class LimboPlayer {
|
||||
private final Location loc;
|
||||
private final float walkSpeed;
|
||||
private final float flySpeed;
|
||||
private MyScheduledTask timeoutTask = null;
|
||||
private BukkitTask timeoutTask = null;
|
||||
private MessageTask messageTask = null;
|
||||
private LimboPlayerState state = LimboPlayerState.PASSWORD_REQUIRED;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class LimboPlayer {
|
||||
*
|
||||
* @return The timeout task associated to the player
|
||||
*/
|
||||
public MyScheduledTask getTimeoutTask() {
|
||||
public BukkitTask getTimeoutTask() {
|
||||
return timeoutTask;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class LimboPlayer {
|
||||
*
|
||||
* @param timeoutTask The task to set
|
||||
*/
|
||||
public void setTimeoutTask(MyScheduledTask timeoutTask) {
|
||||
public void setTimeoutTask(BukkitTask timeoutTask) {
|
||||
if (this.timeoutTask != null) {
|
||||
this.timeoutTask.cancel();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.data.limbo;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.data.captcha.RegistrationCaptchaManager;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
@@ -12,6 +11,7 @@ import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -68,7 +68,7 @@ class LimboPlayerTaskManager {
|
||||
final int timeout = settings.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
||||
if (timeout > 0) {
|
||||
String message = messages.retrieveSingle(player, MessageKey.LOGIN_TIMEOUT_ERROR);
|
||||
MyScheduledTask task = bukkitService.runTaskLater(new TimeoutTask(player, message, playerCache), timeout);
|
||||
BukkitTask task = bukkitService.runTaskLater(new TimeoutTask(player, message, playerCache), timeout);
|
||||
limbo.setTimeoutTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class DoubleLoginFixListener implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Collection<? extends Player> PlayerList = Bukkit.getServer().getOnlinePlayers();
|
||||
HashSet<String> PlayerSet = new HashSet<>();
|
||||
HashSet<String> PlayerSet = new HashSet<String>();
|
||||
for (Player ep : PlayerList) {
|
||||
if (PlayerSet.contains(ep.getName().toLowerCase())) {
|
||||
ep.kickPlayer(service.retrieveSingleMessage(ep.getPlayer(), MessageKey.DOUBLE_LOGIN_FIX));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.service;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
@@ -9,6 +8,7 @@ import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
||||
import fr.xephi.authme.util.AtomicIntervalCounter;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
@@ -32,7 +32,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
// Service status
|
||||
private AntiBotStatus antiBotStatus;
|
||||
private boolean startup;
|
||||
private MyScheduledTask disableTask;
|
||||
private BukkitTask disableTask;
|
||||
private AtomicIntervalCounter flaggedCounter;
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.service;
|
||||
|
||||
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@@ -15,6 +14,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
@@ -48,10 +48,10 @@ public class BukkitService implements SettingsDependent {
|
||||
* This task will be executed by the main server thread.
|
||||
*
|
||||
* @param task Task to be executed
|
||||
* Task id number (-1 if scheduling failed)
|
||||
* @return Task id number (-1 if scheduling failed)
|
||||
*/
|
||||
public void scheduleSyncDelayedTask(Runnable task) {
|
||||
MyScheduledTask tsk = AuthMe.getScheduler().runTask(task);
|
||||
public int scheduleSyncDelayedTask(Runnable task) {
|
||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(authMe, task);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,10 +61,10 @@ public class BukkitService implements SettingsDependent {
|
||||
*
|
||||
* @param task Task to be executed
|
||||
* @param delay Delay in server ticks before executing task
|
||||
* Task id number (-1 if scheduling failed)
|
||||
* @return Task id number (-1 if scheduling failed)
|
||||
*/
|
||||
public void scheduleSyncDelayedTask(Runnable task, long delay) {
|
||||
MyScheduledTask tsk = AuthMe.getScheduler().runTaskLater(task, delay);
|
||||
public int scheduleSyncDelayedTask(Runnable task, long delay) {
|
||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(authMe, task, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class BukkitService implements SettingsDependent {
|
||||
*/
|
||||
public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) {
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
AuthMe.getScheduler().runTask(task);
|
||||
task.run();
|
||||
} else {
|
||||
scheduleSyncDelayedTask(task);
|
||||
}
|
||||
@@ -86,26 +86,26 @@ public class BukkitService implements SettingsDependent {
|
||||
* Returns a task that will run on the next server tick.
|
||||
*
|
||||
* @param task the task to be run
|
||||
* a BukkitTask that contains the id number
|
||||
* @return a BukkitTask that contains the id number
|
||||
* @throws IllegalArgumentException if plugin is null
|
||||
* @throws IllegalArgumentException if task is null
|
||||
*/
|
||||
public void runTask(Runnable task) {
|
||||
AuthMe.getScheduler().runTask(task);
|
||||
public BukkitTask runTask(Runnable task) {
|
||||
return Bukkit.getScheduler().runTask(authMe, task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a task that will run after the specified number of server
|
||||
* ticks.
|
||||
*
|
||||
* @param task the task to be run
|
||||
* @param task the task to be run
|
||||
* @param delay the ticks to wait before running the task
|
||||
* @return a BukkitTask that contains the id number
|
||||
* @throws IllegalArgumentException if plugin is null
|
||||
* @throws IllegalArgumentException if task is null
|
||||
*/
|
||||
public MyScheduledTask runTaskLater(Runnable task, long delay) {
|
||||
return AuthMe.getScheduler().runTaskLater(task, delay);
|
||||
public BukkitTask runTaskLater(Runnable task, long delay) {
|
||||
return Bukkit.getScheduler().runTaskLater(authMe, task, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,9 +116,9 @@ public class BukkitService implements SettingsDependent {
|
||||
*/
|
||||
public void runTaskOptionallyAsync(Runnable task) {
|
||||
if (useAsyncTasks) {
|
||||
AuthMe.getScheduler().runTaskAsynchronously(task);
|
||||
runTaskAsynchronously(task);
|
||||
} else {
|
||||
AuthMe.getScheduler().runTask(task);
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,12 +129,12 @@ public class BukkitService implements SettingsDependent {
|
||||
* Returns a task that will run asynchronously.
|
||||
*
|
||||
* @param task the task to be run
|
||||
* a BukkitTask that contains the id number
|
||||
* @return a BukkitTask that contains the id number
|
||||
* @throws IllegalArgumentException if plugin is null
|
||||
* @throws IllegalArgumentException if task is null
|
||||
*/
|
||||
public void runTaskAsynchronously(Runnable task) {
|
||||
AuthMe.getScheduler().runTaskAsynchronously(task);
|
||||
public BukkitTask runTaskAsynchronously(Runnable task) {
|
||||
return Bukkit.getScheduler().runTaskAsynchronously(authMe, task);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,12 +148,12 @@ public class BukkitService implements SettingsDependent {
|
||||
* @param delay the ticks to wait before running the task for the first
|
||||
* time
|
||||
* @param period the ticks to wait between runs
|
||||
* a BukkitTask that contains the id number
|
||||
* @return a BukkitTask that contains the id number
|
||||
* @throws IllegalArgumentException if task is null
|
||||
* @throws IllegalStateException if this was already scheduled
|
||||
*/
|
||||
public void runTaskTimerAsynchronously(BukkitRunnable task, long delay, long period) {
|
||||
AuthMe.getScheduler().runTaskTimerAsynchronously(task, delay, period);
|
||||
public BukkitTask runTaskTimerAsynchronously(BukkitRunnable task, long delay, long period) {
|
||||
return task.runTaskTimerAsynchronously(authMe, delay, period);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,12 +163,12 @@ public class BukkitService implements SettingsDependent {
|
||||
* @param task the task to schedule
|
||||
* @param delay the ticks to wait before running the task
|
||||
* @param period the ticks to wait between runs
|
||||
* a BukkitTask that contains the id number
|
||||
* @return a BukkitTask that contains the id number
|
||||
* @throws IllegalArgumentException if plugin is null
|
||||
* @throws IllegalStateException if this was already scheduled
|
||||
*/
|
||||
public void runTaskTimer(BukkitRunnable task, long delay, long period) {
|
||||
AuthMe.getScheduler().runTaskTimer(task, delay, period);
|
||||
public BukkitTask runTaskTimer(BukkitRunnable task, long delay, long period) {
|
||||
return task.runTaskTimer(authMe, delay, period);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user