summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorDinnerbone <dinnerbone@dinnerbone.com>2011-06-06 21:38:35 +0100
committerDinnerbone <dinnerbone@dinnerbone.com>2011-06-06 21:38:35 +0100
commit8b3f90f232725e94b38859c757400d990b77d45d (patch)
tree3e10a4054e9803c74b2f71fd9e67ea986cb8426f /src/main/java
parentd40c690c8f5fe2fa351f9d6dde3c4a9851366222 (diff)
downloadcraftbukkit-8b3f90f232725e94b38859c757400d990b77d45d.tar
craftbukkit-8b3f90f232725e94b38859c757400d990b77d45d.tar.gz
craftbukkit-8b3f90f232725e94b38859c757400d990b77d45d.tar.lz
craftbukkit-8b3f90f232725e94b38859c757400d990b77d45d.tar.xz
craftbukkit-8b3f90f232725e94b38859c757400d990b77d45d.zip
Use the custom set spawn
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/net/minecraft/server/World.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 259ccdcf..aa4ac1fd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -9,6 +9,7 @@ import java.util.Set;
import java.util.TreeSet;
// CraftBukkit start
+import org.bukkit.Location;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
@@ -124,10 +125,25 @@ public class World implements IBlockAccess {
int j;
- // Craftbukkit
+ // Craftbukkit start
+ if (generator != null) {
+ Random rand = new Random(getSeed());
+ Location spawn = generator.getFixedSpawnLocation(((WorldServer)this).getWorld(), rand);
+ if (spawn != null) {
+ if (spawn.getWorld() != ((WorldServer)this).getWorld()) {
+ throw new IllegalStateException("Cannot set spawn point for " + worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
+ } else {
+ worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
+ isLoading = false;
+ return;
+ }
+ }
+ }
+
for (j = 0; !canSpawn(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
i += this.random.nextInt(64) - this.random.nextInt(64);
}
+ // Craftbukkit end
this.worldData.setSpawn(i, b0, j);
this.isLoading = false;