Removed meta data storage since it's not persistent. Now simply using

setBedSpawnLocation(),
This commit is contained in:
Jos van 't Hof
2012-04-15 12:42:14 +02:00
parent 50b938b361
commit 7b5e833b18
3 changed files with 6 additions and 28 deletions

View File

@@ -32,14 +32,7 @@ public class JoinListener implements Listener{
String worldName = world.getName();
if(world.getEnvironment().equals(Environment.NETHER) || world.getEnvironment().equals(Environment.THE_END)) return;
if(!player.hasMetadata(worldName + ".spawn")
&& plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns",false)
&& plugin.yamlHandler.spawnLocations.contains(worldName + "." + playerName)
){
migrateMetaData(player, world);
}
File file = new File(world.getWorldFolder() + File.separator + "players" + File.separator + player.getName() + ".dat");
if(file.exists()) return;
@@ -68,7 +61,7 @@ public class JoinListener implements Listener{
player.setNoDamageTicks(plugin.yamlHandler.config.getInt("nodamagetime",5)*20);
if (plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns",false)){
plugin.setPlayerSpawn(player, spawnLocation);
player.setBedSpawnLocation(spawnLocation);
}
if (plugin.yamlHandler.config.getString("messages.randomspawned") != null){
@@ -78,20 +71,6 @@ public class JoinListener implements Listener{
}
}
private void migrateMetaData(Player player, World world) {
String playerName = player.getName();
String worldName = world.getName();
plugin.logDebug("(JoinListener) Migrating spawnlocation of '" + playerName + "' to metadata format!");
double x = this.plugin.yamlHandler.spawnLocations.getDouble(worldName + "." + playerName + ".x");
double y = this.plugin.yamlHandler.spawnLocations.getDouble(worldName + "." + playerName + ".y");
double z = this.plugin.yamlHandler.spawnLocations.getDouble(worldName + "." + playerName + ".z");
plugin.setPlayerSpawn(player, new Location(world,x,y,z));
}
private Location getFirstSpawn(World world) {
String worldName = world.getName();

View File

@@ -41,9 +41,8 @@ public class RespawnListener implements Listener{
return;
}
if (plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns", false) &&
player.hasMetadata(player.getWorld().getName() + ".spawn")){
event.setRespawnLocation(plugin.getPlayerSpawn(player, world));
if (plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns", false)){
event.setRespawnLocation(player.getBedSpawnLocation());
plugin.logDebug(playerName + " is spawned at his saved spawn.");
return;
}
@@ -59,7 +58,7 @@ public class RespawnListener implements Listener{
player.setNoDamageTicks(plugin.yamlHandler.config.getInt("nodamagetime",5)*20);
if (plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns",false)){
plugin.setPlayerSpawn(player, spawnLocation);
player.setBedSpawnLocation(spawnLocation);
}
if (plugin.yamlHandler.config.getString("messages.randomspawned") != null){

View File

@@ -43,7 +43,7 @@ public class SignListener implements Listener {
player.setNoDamageTicks(plugin.yamlHandler.config.getInt("nodamagetime",5)*20);
if (plugin.yamlHandler.worlds.getBoolean(world.getName() + ".keeprandomspawns",false)){
plugin.setPlayerSpawn(player, spawnLocation);
player.setBedSpawnLocation(spawnLocation);
}
}else{