Fix
This commit is contained in:
parent
1f734f4b95
commit
8932c71173
@ -189,7 +189,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
||||||
// Allow infinite blindness effect
|
// Allow infinite blindness effect
|
||||||
int blindTimeOut = (registrationTimeout <= 0) ? 99999 : registrationTimeout;
|
int blindTimeOut = (registrationTimeout <= 0) ? 99999 : registrationTimeout;
|
||||||
bukkitService.runTask(player,() -> player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindTimeOut, 2)));
|
|
||||||
|
// AuthMeReReloaded - Fix potion apply on Folia
|
||||||
|
bukkitService.runTaskIfFolia(player,() -> player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindTimeOut, 2)));
|
||||||
}
|
}
|
||||||
commandManager.runCommandsOnJoin(player);
|
commandManager.runCommandsOnJoin(player);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,6 +6,7 @@ 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;
|
||||||
@ -36,6 +37,8 @@ public class BukkitService implements SettingsDependent {
|
|||||||
public static final int TICKS_PER_SECOND = 20;
|
public static final int TICKS_PER_SECOND = 20;
|
||||||
/** 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. */
|
||||||
|
private static final boolean IS_FOLIA = Utils.isClassLoaded("io.papermc.paper.threadedregions.RegionizedServer");
|
||||||
private final AuthMe authMe;
|
private final AuthMe authMe;
|
||||||
private boolean useAsyncTasks;
|
private boolean useAsyncTasks;
|
||||||
|
|
||||||
@ -102,6 +105,35 @@ public class BukkitService implements SettingsDependent {
|
|||||||
getScheduler().runTask(location, task);
|
getScheduler().runTask(location, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the task synchronously if we are running Folia, else do nothing but run it.
|
||||||
|
* @param task the task to be run
|
||||||
|
*/
|
||||||
|
public void runTaskIfFolia(Runnable task) {
|
||||||
|
if (IS_FOLIA) {
|
||||||
|
runTask(task);
|
||||||
|
} else {
|
||||||
|
task.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runTaskIfFolia(Entity entity, Runnable task) {
|
||||||
|
if (IS_FOLIA) {
|
||||||
|
runTask(entity, task);
|
||||||
|
} else {
|
||||||
|
task.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runTaskIfFolia(Location location, Runnable task) {
|
||||||
|
if (IS_FOLIA) {
|
||||||
|
runTask(location, task);
|
||||||
|
} else {
|
||||||
|
task.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a task that will run after the specified number of server
|
* Returns a task that will run after the specified number of server
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user