aboutsummaryrefslogtreecommitdiff
path: root/src/net/brysonsteck/Resurrection
diff options
context:
space:
mode:
authorBryson Steck <steck.bryson@gmail.com>2021-07-19 19:25:55 -0600
committerBryson Steck <steck.bryson@gmail.com>2021-07-19 19:25:55 -0600
commitcd0edf247f08dd1cc7380c433142585652038eb9 (patch)
treebea7250f7fa600297f13090c3b0993328ec0aa80 /src/net/brysonsteck/Resurrection
parentdb0d6991fa322b74b62b042409a17711a4406d6f (diff)
downloadresurrection-cd0edf247f08dd1cc7380c433142585652038eb9.tar
resurrection-cd0edf247f08dd1cc7380c433142585652038eb9.tar.gz
resurrection-cd0edf247f08dd1cc7380c433142585652038eb9.tar.bz2
experimenting with new respawns
Diffstat (limited to 'src/net/brysonsteck/Resurrection')
-rw-r--r--src/net/brysonsteck/Resurrection/player/PlayerListener.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
index 93d9f32..e9c4e57 100644
--- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java
+++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java
@@ -14,11 +14,14 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
+import java.util.Hashtable;
+
public class PlayerListener implements Listener {
boolean stillDead;
boolean timerRunning = false;
Location spawn;
+ Hashtable<String, Location> playerSpawns = new Hashtable<>();
@EventHandler
public void onJoin(PlayerJoinEvent e) {
@@ -170,6 +173,7 @@ public class PlayerListener implements Listener {
public void onPlayerRespawn(PlayerRespawnEvent e) {
if (stillDead) {
final Player p = e.getPlayer();
+ playerSpawns.put(p.getDisplayName(), p.getLocation());
p.setGameMode(GameMode.SPECTATOR);
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "YOU HAVE DIED!!");
p.sendMessage(ChatColor.RED + "You will be able to respawn in the next 24 hours.");
@@ -192,7 +196,7 @@ public class PlayerListener implements Listener {
public void onPlayerMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
if (p.getGameMode() == GameMode.SPECTATOR) {
- p.teleport(this.spawn);
+ p.teleport(playerSpawns.get(p.getDisplayName()));
}
}
}