aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-06-06 12:38:24 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-06-06 12:38:24 -0600
commit1922bb3499857a4464f07eba2ee2de932674be5f (patch)
tree976156ef79c2a10d2d80c274210b7a8aff3e3417
parent0a94eaf19095615e03fb2bef1cecaa8bcc13d227 (diff)
downloadresurrection-1922bb3499857a4464f07eba2ee2de932674be5f.tar
resurrection-1922bb3499857a4464f07eba2ee2de932674be5f.tar.gz
resurrection-1922bb3499857a4464f07eba2ee2de932674be5f.tar.bz2
moved effects to respawn event
-rw-r--r--out/artifacts/Resurrection_jar/Resurrection.jarbin1334010 -> 1334012 bytes
-rw-r--r--out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.classbin2334 -> 2450 bytes
-rw-r--r--src/net/brysonsteck/Resurrection/PlayerListener.java11
3 files changed, 8 insertions, 3 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar
index 48b3b72..c6a45ec 100644
--- a/out/artifacts/Resurrection_jar/Resurrection.jar
+++ b/out/artifacts/Resurrection_jar/Resurrection.jar
Binary files differ
diff --git a/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class b/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class
index aac069e..d10fb84 100644
--- a/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class
+++ b/out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.class
Binary files differ
diff --git a/src/net/brysonsteck/Resurrection/PlayerListener.java b/src/net/brysonsteck/Resurrection/PlayerListener.java
index fe8f2b7..58bc405 100644
--- a/src/net/brysonsteck/Resurrection/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/PlayerListener.java
@@ -5,6 +5,7 @@ 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.PlayerRespawnEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@@ -19,10 +20,7 @@ public class PlayerListener implements Listener {
public void onDeath(PlayerDeathEvent e) {
System.out.println("Resurrection: A player has died!");
Player p = e.getEntity();
- p.spigot().respawn();
p.setGameMode(GameMode.SPECTATOR);
- p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000000, 500));
- p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000000000, 500));
Long timeOfDeath = System.currentTimeMillis();
Long resurrectionTime = timeOfDeath + 86400000;
@@ -35,4 +33,11 @@ public class PlayerListener implements Listener {
p.sendMessage("You have died! You will be able to respawn in 24 hours.");
}
+
+ @EventHandler
+ public void onPlayerRespawn(PlayerRespawnEvent e) {
+ Player p = e.getPlayer();
+ p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,1000000000, 500));
+ p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000000000, 500));
+ }
}