diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-06-06 19:10:32 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-06-06 19:10:32 -0600 |
commit | 22410ae7b9d11e5b32fed2fb1044d4298dd36cda (patch) | |
tree | 0bfd6c687b8a5c260ecd78eee14c165a051074ce | |
parent | 357ef1da6c37080343d40bfcbb1675b62ab32494 (diff) | |
download | resurrection-22410ae7b9d11e5b32fed2fb1044d4298dd36cda.tar resurrection-22410ae7b9d11e5b32fed2fb1044d4298dd36cda.tar.gz resurrection-22410ae7b9d11e5b32fed2fb1044d4298dd36cda.tar.bz2 |
trying threads
-rw-r--r-- | out/artifacts/Resurrection_jar/Resurrection.jar | bin | 1335861 -> 1336247 bytes | |||
-rw-r--r-- | out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class | bin | 3143 -> 4027 bytes | |||
-rw-r--r-- | out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class | bin | 3062 -> 3115 bytes | |||
-rw-r--r-- | src/net/brysonsteck/Resurrection/PlayerListener.java | 25 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/Resurrection.java | 7 |
5 files changed, 23 insertions, 9 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar Binary files differindex 9162506..70af613 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 2955902..9dcc2e8 100644 --- a/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class +++ b/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class diff --git a/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class b/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class Binary files differindex 4bbc08a..c1d7340 100644 --- a/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class +++ b/out/production/Resurrection/net/brysonsteck/Resurrection/Resurrection.class 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..."); |