Fix #146 and cleanup
This commit is contained in:
parent
52c06917c3
commit
3f3671c95c
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme.process.quit;
|
package fr.xephi.authme.process.quit;
|
||||||
|
|
||||||
|
import com.github.Anon8281.universalScheduler.UniversalScheduler;
|
||||||
import fr.xephi.authme.data.limbo.LimboService;
|
import fr.xephi.authme.data.limbo.LimboService;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||||
@ -27,7 +28,9 @@ public class ProcessSyncPlayerQuit implements SynchronousProcess {
|
|||||||
commandManager.runCommandsOnLogout(player);
|
commandManager.runCommandsOnLogout(player);
|
||||||
} else {
|
} else {
|
||||||
limboService.restoreData(player);
|
limboService.restoreData(player);
|
||||||
player.saveData(); // #1238: Speed is sometimes not restored properly
|
if (!UniversalScheduler.isFolia) { // AuthMeReReloaded - Fix #146 (Very stupid solution, but works)
|
||||||
|
player.saveData(); // #1238: Speed is sometimes not restored properly
|
||||||
|
}
|
||||||
}
|
}
|
||||||
player.leaveVehicle();
|
player.leaveVehicle();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
package fr.xephi.authme.service;
|
package fr.xephi.authme.service;
|
||||||
|
|
||||||
import com.github.Anon8281.universalScheduler.UniversalRunnable;
|
import com.github.Anon8281.universalScheduler.UniversalRunnable;
|
||||||
|
import com.github.Anon8281.universalScheduler.UniversalScheduler;
|
||||||
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask;
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.initialization.SettingsDependent;
|
import fr.xephi.authme.initialization.SettingsDependent;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.util.Utils;
|
|
||||||
import org.bukkit.BanEntry;
|
import org.bukkit.BanEntry;
|
||||||
import org.bukkit.BanList;
|
import org.bukkit.BanList;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -38,7 +38,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
/** Number of ticks per minute. */
|
/** Number of ticks per minute. */
|
||||||
public static final int TICKS_PER_MINUTE = 60 * TICKS_PER_SECOND;
|
public static final int TICKS_PER_MINUTE = 60 * TICKS_PER_SECOND;
|
||||||
/** Whether the server is running Folia. */
|
/** Whether the server is running Folia. */
|
||||||
private static final boolean IS_FOLIA = Utils.isClassLoaded("io.papermc.paper.threadedregions.RegionizedServer");
|
private static final boolean isFolia = UniversalScheduler.isFolia;
|
||||||
private final AuthMe authMe;
|
private final AuthMe authMe;
|
||||||
private boolean useAsyncTasks;
|
private boolean useAsyncTasks;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @param delay Delay in server ticks before executing task
|
* @param delay Delay in server ticks before executing task
|
||||||
*/
|
*/
|
||||||
public void scheduleSyncDelayedTask(Runnable task, long delay) {
|
public void scheduleSyncDelayedTask(Runnable task, long delay) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
runTaskLater(task, delay);
|
runTaskLater(task, delay);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTaskLater(authMe, task, delay); // We must do this to keep compatibility
|
Bukkit.getScheduler().runTaskLater(authMe, task, delay); // We must do this to keep compatibility
|
||||||
@ -98,7 +98,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @throws IllegalArgumentException if task is null
|
* @throws IllegalArgumentException if task is null
|
||||||
*/
|
*/
|
||||||
public void runTask(Runnable task) {
|
public void runTask(Runnable task) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
getScheduler().runTask(task);
|
getScheduler().runTask(task);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTask(authMe, task);
|
Bukkit.getScheduler().runTask(authMe, task);
|
||||||
@ -106,7 +106,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void runTask(Entity entity, Runnable task) {
|
public void runTask(Entity entity, Runnable task) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
getScheduler().runTask(entity, task);
|
getScheduler().runTask(entity, task);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTask(authMe, task);
|
Bukkit.getScheduler().runTask(authMe, task);
|
||||||
@ -122,7 +122,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @param task the task to be run
|
* @param task the task to be run
|
||||||
*/
|
*/
|
||||||
public void runTaskIfFolia(Runnable task) {
|
public void runTaskIfFolia(Runnable task) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
runTask(task);
|
runTask(task);
|
||||||
} else {
|
} else {
|
||||||
task.run();
|
task.run();
|
||||||
@ -134,7 +134,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @param task the task to be run
|
* @param task the task to be run
|
||||||
*/
|
*/
|
||||||
public void runTaskIfFolia(Entity entity, Runnable task) {
|
public void runTaskIfFolia(Entity entity, Runnable task) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
runTask(entity, task);
|
runTask(entity, task);
|
||||||
} else {
|
} else {
|
||||||
task.run();
|
task.run();
|
||||||
@ -146,7 +146,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @param task the task to be run
|
* @param task the task to be run
|
||||||
*/
|
*/
|
||||||
public void runTaskIfFolia(Location location, Runnable task) {
|
public void runTaskIfFolia(Location location, Runnable task) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
runTask(location, task);
|
runTask(location, task);
|
||||||
} else {
|
} else {
|
||||||
task.run();
|
task.run();
|
||||||
@ -196,7 +196,7 @@ public class BukkitService implements SettingsDependent {
|
|||||||
* @throws IllegalArgumentException if task is null
|
* @throws IllegalArgumentException if task is null
|
||||||
*/
|
*/
|
||||||
public void runTaskAsynchronously(Runnable task) {
|
public void runTaskAsynchronously(Runnable task) {
|
||||||
if (IS_FOLIA) {
|
if (isFolia) {
|
||||||
getScheduler().runTaskAsynchronously(task);
|
getScheduler().runTaskAsynchronously(task);
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(authMe, task);
|
Bukkit.getScheduler().runTaskAsynchronously(authMe, task);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user