aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);
+ }
+
}
}