diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-06-06 19:42:48 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-06-06 19:42:48 -0600 |
commit | 7d5f60d921cd35ce82a24e75ebfd79a3fd64bfed (patch) | |
tree | 1d1fcfd3d94dcd984935c6cfd763167fa9546b4e | |
parent | 22410ae7b9d11e5b32fed2fb1044d4298dd36cda (diff) | |
download | resurrection-7d5f60d921cd35ce82a24e75ebfd79a3fd64bfed.tar resurrection-7d5f60d921cd35ce82a24e75ebfd79a3fd64bfed.tar.gz resurrection-7d5f60d921cd35ce82a24e75ebfd79a3fd64bfed.tar.bz2 |
trying bukkitrunnable
-rw-r--r-- | out/artifacts/Resurrection_jar/Resurrection.jar | bin | 1336247 -> 1336634 bytes | |||
-rw-r--r-- | out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class | bin | 4027 -> 3071 bytes | |||
-rw-r--r-- | src/net/brysonsteck/Resurrection/PlayerListener.java | 25 |
3 files changed, 13 insertions, 12 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar Binary files differindex 70af613..fad718e 100644 --- a/out/artifacts/Resurrection_jar/Resurrection.jar +++ b/out/artifacts/Resurrection_jar/Resurrection.jar diff --git a/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class b/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class Binary files differindex 9dcc2e8..206c682 100644 --- a/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class +++ b/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class diff --git a/src/net/brysonsteck/Resurrection/PlayerListener.java b/src/net/brysonsteck/Resurrection/PlayerListener.java index e50359e..e922a06 100644 --- a/src/net/brysonsteck/Resurrection/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/PlayerListener.java @@ -9,8 +9,10 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitRunnable; import static org.bukkit.Bukkit.getServer; @@ -36,19 +38,18 @@ public class PlayerListener implements Listener { public void onPlayerRespawn(PlayerRespawnEvent e) { final Player p = e.getPlayer(); p.setGameMode(GameMode.ADVENTURE); - new Thread(() -> { - try { - Thread.sleep(100); - } catch (InterruptedException interruptedException) { - interruptedException.printStackTrace(); + new BukkitRunnable() { + @Override + public void run() { + PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 200, 10, false); + PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 200, 10, false); + PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 200, 10, false); + invisibility.apply(p); + blindness.apply(p); + slowness.apply(p); } - PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 200, 10, false); - PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 200, 10, false); - PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 200, 10, false); - invisibility.apply(p); - blindness.apply(p); - slowness.apply(p); - }).start(); + }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 20); + } |