testing spawn air tester
This commit is contained in:
parent
546c388b8d
commit
fb55c65cf1
3 changed files with 22 additions and 0 deletions
Binary file not shown.
|
@ -7,6 +7,7 @@ import net.brysonsteck.Resurrection.commands.CommandResurrect;
|
||||||
import net.brysonsteck.Resurrection.player.PlayerListener;
|
import net.brysonsteck.Resurrection.player.PlayerListener;
|
||||||
import net.brysonsteck.Resurrection.player.TimeCheck;
|
import net.brysonsteck.Resurrection.player.TimeCheck;
|
||||||
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
import net.brysonsteck.Resurrection.startup.CheckForUpdate;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.brysonsteck.Resurrection.player;
|
||||||
|
|
||||||
import net.brysonsteck.Resurrection.Resurrection;
|
import net.brysonsteck.Resurrection.Resurrection;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -20,9 +21,26 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
boolean stillDead;
|
boolean stillDead;
|
||||||
boolean timerRunning = false;
|
boolean timerRunning = false;
|
||||||
|
World world = Bukkit.getWorlds().get(0);
|
||||||
Location spawn;
|
Location spawn;
|
||||||
Hashtable<String, Location> playerSpawns = new Hashtable<>();
|
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
|
@EventHandler
|
||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
@ -92,6 +110,9 @@ public class PlayerListener implements Listener {
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
p.playSound(p.getLocation(), Sound.ENTITY_ENDER_DRAGON_GROWL, 1, 0);
|
||||||
}
|
}
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!");
|
Bukkit.broadcastMessage(ChatColor.YELLOW +""+ ChatColor.BOLD + p.getDisplayName() + " has resurrected!");
|
||||||
|
if (p.getBedSpawnLocation() != null) {
|
||||||
|
p.teleport(p.getBedSpawnLocation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), resurrectTime);
|
}.runTaskLater(JavaPlugin.getProvidingPlugin(Resurrection.class), resurrectTime);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue