aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-06-06 13:20:42 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-06-06 13:20:42 -0600
commitf46b9daae4679e00603d4c3eae086a5ff362debe (patch)
tree67a93383d7f0820baca588061077927729928081 /src
parent80b00aca964cb6943dbe138a4e2c5c106e14a6f6 (diff)
downloadresurrection-f46b9daae4679e00603d4c3eae086a5ff362debe.tar
resurrection-f46b9daae4679e00603d4c3eae086a5ff362debe.tar.gz
resurrection-f46b9daae4679e00603d4c3eae086a5ff362debe.tar.bz2
trying spectator mode again
Diffstat (limited to 'src')
-rw-r--r--src/net/brysonsteck/Resurrection/PlayerListener.java21
1 files changed, 14 insertions, 7 deletions
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);
+ }
+
}
}