diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index a8113c18..31aff37e 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -189,7 +189,7 @@ public class AsynchronousJoin implements AsynchronousProcess { if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { // Allow infinite blindness effect int blindTimeOut = (registrationTimeout <= 0) ? 99999 : registrationTimeout; - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindTimeOut, 2)); + bukkitService.runTask(player,() -> player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindTimeOut, 2))); } commandManager.runCommandsOnJoin(player); }); diff --git a/src/main/java/fr/xephi/authme/service/BukkitService.java b/src/main/java/fr/xephi/authme/service/BukkitService.java index 2c30fcc4..64f05407 100644 --- a/src/main/java/fr/xephi/authme/service/BukkitService.java +++ b/src/main/java/fr/xephi/authme/service/BukkitService.java @@ -10,10 +10,12 @@ import fr.xephi.authme.util.Utils; import org.bukkit.BanEntry; import org.bukkit.BanList; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.OfflinePlayer; import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.Event; @@ -98,6 +100,15 @@ public class BukkitService implements SettingsDependent { getScheduler().runTask(task); } + public void runTask(Entity entity, Runnable task) { + getScheduler().runTask(entity, task); + } + + public void runTask(Location location, Runnable task) { + getScheduler().runTask(location, task); + } + + /** * Returns a task that will run after the specified number of server * ticks.