aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-06-15 20:47:32 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-06-15 20:47:32 -0600
commit9431767c3bd129715a1b45af6c3d0d3cd3e027c2 (patch)
treef697df1f4641ed5d27e2defeebe432f42c215a98
parent5cc1fe69baf24cc890993cda47d667de4fc3660e (diff)
downloadresurrection-9431767c3bd129715a1b45af6c3d0d3cd3e027c2.tar
resurrection-9431767c3bd129715a1b45af6c3d0d3cd3e027c2.tar.gz
resurrection-9431767c3bd129715a1b45af6c3d0d3cd3e027c2.tar.bz2
added a stilldead flag
-rw-r--r--out/artifacts/Resurrection_jar/Resurrection.jarbin1338995 -> 1339140 bytes
-rw-r--r--out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener$1.classbin2590 -> 2628 bytes
-rw-r--r--out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener.classbin2558 -> 2771 bytes
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerListener.java30
4 files changed, 18 insertions, 12 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar
index e80bed1..1c9de1f 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/player/PlayerListener$1.class b/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener$1.class
index f2b8ddd..ad295f0 100644
--- a/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener$1.class
+++ b/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener$1.class
Binary files differ
diff --git a/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener.class b/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener.class
index ce42074..1c4c442 100644
--- a/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener.class
+++ b/out/production/Resurrection/net/brysonsteck/Resurrection/player/PlayerListener.class
Binary files differ
diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
index 4e793f0..003a26c 100644
--- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
@@ -15,12 +15,14 @@ import org.bukkit.scheduler.BukkitRunnable;
public class PlayerListener implements Listener {
+ boolean stillDead;
Location spawn;
@EventHandler
public void onDeath(PlayerDeathEvent e) {
System.out.println("Resurrection: A player has died!");
Player p = e.getEntity();
+ stillDead = true;
//
// TimeCheck death = new TimeCheck(timeOfDeath);
// TimeCheck resurrect = new TimeCheck((timeOfDeath + 86400000) - timeOfDeath);
@@ -34,6 +36,7 @@ public class PlayerListener implements Listener {
// save death information to player file
@Override
public void run() {
+ stillDead = false;
for (PotionEffect effect : p.getActivePotionEffects())
p.removePotionEffect(effect.getType());
p.setGameMode(GameMode.SURVIVAL);
@@ -47,20 +50,23 @@ public class PlayerListener implements Listener {
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
- final Player p = e.getPlayer();
- p.setGameMode(GameMode.SPECTATOR);
- new BukkitRunnable() {
- @Override
- public void run() {
- spawn = p.getLocation();
+ if (stillDead) {
+ final Player p = e.getPlayer();
+ p.setGameMode(GameMode.SPECTATOR);
+ p.sendTitle("You have died!", "You must wait 24 hours before you can respawn.");
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ spawn = p.getLocation();
// PotionEffect invisibility = new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false);
- PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 100, 10, false);
- PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 100, 10, false);
+ PotionEffect blindness = new PotionEffect(PotionEffectType.BLINDNESS, 100, 10, false);
+ PotionEffect slowness = new PotionEffect(PotionEffectType.SLOW, 100, 10, false);
// invisibility.apply(p);
- blindness.apply(p);
- slowness.apply(p);
- }
- }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
+ blindness.apply(p);
+ slowness.apply(p);
+ }
+ }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), 1);
+ }
}
@EventHandler