This commit is contained in:
HaHaWTH 2024-03-25 20:26:27 +08:00
parent 3a8bd1d826
commit fe06f06a11
2 changed files with 12 additions and 1 deletions

View File

@ -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);
});

View File

@ -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.