aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-06-06 18:00:18 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-06-06 18:00:18 -0600
commit1e32b6f67e1f10479a89aba73d889c267d678786 (patch)
treee20e525d413023274365ad91182fbf370e59ac9f
parent0f89320996551ca6b5584be55b230f0511a5ad2c (diff)
downloadresurrection-1e32b6f67e1f10479a89aba73d889c267d678786.tar
resurrection-1e32b6f67e1f10479a89aba73d889c267d678786.tar.gz
resurrection-1e32b6f67e1f10479a89aba73d889c267d678786.tar.bz2
potions arent adding after respawn
-rw-r--r--out/artifacts/Resurrection_jar/Resurrection.jarbin1335900 -> 1335783 bytes
-rw-r--r--out/production/Resurrection/net/brysonsteck/Resurrection/PlayerListener.classbin3402 -> 3031 bytes
-rw-r--r--src/net/brysonsteck/Resurrection/PlayerListener.java13
3 files changed, 8 insertions, 5 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar
index dc6854b..53c1768 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 63ceec4..17841e0 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 f0c5d6e..b94e83d 100644
--- a/src/net/brysonsteck/Resurrection/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/PlayerListener.java
@@ -17,30 +17,33 @@ public class PlayerListener implements Listener {
public void onDeath(PlayerDeathEvent e) {
System.out.println("Resurrection: A player has died!");
Player p = e.getEntity();
- p.setGameMode(GameMode.SPECTATOR);
Long timeOfDeath = System.currentTimeMillis();
Long resurrectionTime = timeOfDeath + 86400000;
TimeCheck death = new TimeCheck(timeOfDeath);
- TimeCheck resurrect = new TimeCheck(timeOfDeath + 86400000);
+ TimeCheck resurrect = new TimeCheck((timeOfDeath + 86400000) - timeOfDeath);
String deathFormatted = death.formatTime();
String resurrectFormatted = resurrect.formatTime();
- p.sendMessage("You have died!! You will be able to respawn in the next " + resurrectFormatted);
+ p.sendMessage("You have died!! You will be able to respawn in the next 24 hours.");
}
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
- p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 86400, 255));
+ p.setGameMode(GameMode.ADVENTURE);
+ p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 10, false));
+ p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1728000, 10, false));
+ p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1728000, 10, false));
+ p.setNoDamageTicks(1728000);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
Location location = p.getLocation();
- if (p.getGameMode() == GameMode.SPECTATOR && p.hasPotionEffect(PotionEffectType.BLINDNESS)) {
+ if (p.getGameMode() == GameMode.ADVENTURE) {
p.teleport(location);
}
}