diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-07-21 21:28:41 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-07-21 21:28:41 -0600 |
commit | fb55c65cf129d610eee652c76a8c0744c1921169 (patch) | |
tree | 7303b2a0bb89d5a363dfabb9727a60860db09e61 | |
parent | 546c388b8dcb94e8b914201d4e5ca1f2111f1968 (diff) | |
download | resurrection-fb55c65cf129d610eee652c76a8c0744c1921169.tar resurrection-fb55c65cf129d610eee652c76a8c0744c1921169.tar.gz resurrection-fb55c65cf129d610eee652c76a8c0744c1921169.tar.bz2 |
testing spawn air tester
-rw-r--r-- | out/artifacts/Resurrection_jar/Resurrection.jar | bin | 1352137 -> 1352760 bytes | |||
-rw-r--r-- | src/net/brysonsteck/Resurrection/Resurrection.java | 1 | ||||
-rw-r--r-- | src/net/brysonsteck/Resurrection/player/PlayerListener.java | 21 |
3 files changed, 22 insertions, 0 deletions
diff --git a/out/artifacts/Resurrection_jar/Resurrection.jar b/out/artifacts/Resurrection_jar/Resurrection.jar Binary files differindex d38c0ab..0156966 100644 --- a/out/artifacts/Resurrection_jar/Resurrection.jar +++ b/out/artifacts/Resurrection_jar/Resurrection.jar diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index 84b3eea..33fff14 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -7,6 +7,7 @@ import net.brysonsteck.Resurrection.commands.CommandResurrect; import net.brysonsteck.Resurrection.player.PlayerListener; import net.brysonsteck.Resurrection.player.TimeCheck; import net.brysonsteck.Resurrection.startup.CheckForUpdate; +import org.bukkit.Bukkit; import org.bukkit.event.Listener; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; diff --git a/src/net/brysonsteck/Resurrection/player/PlayerListener.java b/src/net/brysonsteck/Resurrection/player/PlayerListener.java index e9c4e57..9581da3 100644 --- a/src/net/brysonsteck/Resurrection/player/PlayerListener.java +++ b/src/net/brysonsteck/Resurrection/player/PlayerListener.java @@ -2,6 +2,7 @@ package net.brysonsteck.Resurrection.player; import net.brysonsteck.Resurrection.Resurrection; import org.bukkit.*; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -20,9 +21,26 @@ public class PlayerListener implements Listener { boolean stillDead; boolean timerRunning = false; + World world = Bukkit.getWorlds().get(0); Location spawn; Hashtable<String, Location> playerSpawns = new Hashtable<>(); + public PlayerListener() { + double newY = 0; + while(true) { + Location testLocation = new Location (world, 0, newY, 0); + Block block = testLocation.getBlock(); + if (block.getType() == Material.AIR) { + newY++; + System.out.println("The spawn block at X0 Z0 is Y" + newY); + spawn = testLocation; + break; + } else { + newY++; + } + } + } + @EventHandler public void onJoin(PlayerJoinEvent e) { Player p = e.getPlayer(); @@ -92,6 +110,9 @@ public class PlayerListener implements Listener { p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0); } Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!"); + if (p.getBedSpawnLocation() != null) { + p.teleport(p.getBedSpawnLocation()); + } } }.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), resurrectTime); } |