diff options
Diffstat (limited to 'src/net/brysonsteck')
-rw-r--r-- | src/net/brysonsteck/Resurrection/PlayerListener.java | 25 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/Resurrection.java | 7 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/net/brysonsteck/Resurrection/PlayerListener.java b/src/net/brysonsteck/Resurrection/PlayerListener.java index c48f303..e50359e 100644 --- a/src/net/brysonsteck/Resurrection/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/PlayerListener.java @@ -1,5 +1,6 @@ package net.brysonsteck.Resurrection; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -11,6 +12,8 @@ import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import static org.bukkit.Bukkit.getServer; + public class PlayerListener implements Listener { @EventHandler @@ -31,16 +34,22 @@ public class PlayerListener implements Listener { @EventHandler public void onPlayerRespawn(PlayerRespawnEvent e) { - Player p = e.getPlayer(); + final Player p = e.getPlayer(); p.setGameMode(GameMode.ADVENTURE); + new Thread(() -> { + try { + Thread.sleep(100); + } catch (InterruptedException interruptedException) { + interruptedException.printStackTrace(); + } + 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(); - 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); - p.setNoDamageTicks(1728000); } @EventHandler diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index 33c5b99..cfd196d 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -4,11 +4,15 @@ import net.brysonsteck.Resurrection.commands.CommandAbout; import net.brysonsteck.Resurrection.commands.CommandResurrect; import net.brysonsteck.Resurrection.startup.CheckForUpdate; import org.bukkit.command.CommandExecutor; +import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; +import org.w3c.dom.stylesheets.LinkStyle; -public class Resurrection extends JavaPlugin { +import static org.bukkit.Bukkit.getServer; + +public class Resurrection extends JavaPlugin implements Listener { // public Plugin plugin = getPlugin(Resurrection.class); //spigot things @@ -21,6 +25,7 @@ public class Resurrection extends JavaPlugin { public void onEnable() { super.onEnable(); PluginDescriptionFile pluginInfo = getDescription(); + getServer().getPluginManager().registerEvents(this, this); // check for updates System.out.println("[Resurrection] Checking for updates..."); |