diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-06-06 13:20:42 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-06-06 13:20:42 -0600 |
commit | f46b9daae4679e00603d4c3eae086a5ff362debe (patch) | |
tree | 67a93383d7f0820baca588061077927729928081 | |
parent | 80b00aca964cb6943dbe138a4e2c5c106e14a6f6 (diff) | |
download | resurrection-f46b9daae4679e00603d4c3eae086a5ff362debe.tar resurrection-f46b9daae4679e00603d4c3eae086a5ff362debe.tar.gz resurrection-f46b9daae4679e00603d4c3eae086a5ff362debe.tar.bz2 |
trying spectator mode again
-rw-r--r-- | out/artifacts/Resurrection_jar/Resurrection.jar | bin | 1334035 -> 1334242 bytes | |||
-rw-r--r-- | out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class | bin | 2486 -> 2974 bytes | |||
-rw-r--r-- | src/net/brysonsteck/Resurrection/PlayerListener.java | 21 |
3 files changed, 14 insertions, 7 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar Binary files differindex 0d15ce2..d8442f8 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 29bf8ec..438dfb7 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 7eb8892..0582356 100644 --- a/src/net/brysonsteck/Resurrection/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/PlayerListener.java @@ -1,10 +1,12 @@ package net.brysonsteck.Resurrection; import org.bukkit.GameMode; +import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; 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.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -12,11 +14,6 @@ import org.bukkit.potion.PotionEffectType; public class PlayerListener implements Listener { @EventHandler - public void onJoin() { - - } - - @EventHandler public void onDeath(PlayerDeathEvent e) { System.out.println("Resurrection: A player has died!"); Player p = e.getEntity(); @@ -38,7 +35,17 @@ public class PlayerListener implements Listener { public void onPlayerRespawn(PlayerRespawnEvent e) { Player p = e.getPlayer(); p.sendMessage("You have respawned"); - p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000000, 500)); - p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000000000, 500)); + p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,500000, 500)); + p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 500000, 500)); + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent e) { + Player p = e.getPlayer(); + Location location = p.getLocation(); + if (p.getGameMode() == GameMode.SPECTATOR) { + p.teleport(location); + } + } } |