trying bukkitrunnable

This commit is contained in:
Bryson Steck 2021-06-06 19:42:48 -06:00
parent 22410ae7b9
commit 7d5f60d921
3 changed files with 13 additions and 12 deletions

View file

@ -9,8 +9,10 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import static org.bukkit.Bukkit.getServer; import static org.bukkit.Bukkit.getServer;
@ -36,19 +38,18 @@ public class PlayerListener implements Listener {
public void onPlayerRespawn(PlayerRespawnEvent e) { public void onPlayerRespawn(PlayerRespawnEvent e) {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
p.setGameMode(GameMode.ADVENTURE); p.setGameMode(GameMode.ADVENTURE);
new Thread(() -> { new BukkitRunnable() {
try { @Override
Thread.sleep(100); public void run() {
} catch (InterruptedException interruptedException) {
interruptedException.printStackTrace();
}
PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 200, 10, false); PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 200, 10, false);
PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 200, 10, false); PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 200, 10, false);
PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 200, 10, false); PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 200, 10, false);
invisibility.apply(p); invisibility.apply(p);
blindness.apply(p); blindness.apply(p);
slowness.apply(p); slowness.apply(p);
}).start(); }
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 20);
} }