Archiviert
13
0

Implemented per world setting to keep the spawn in memory or not.

Dieser Commit ist enthalten in:
Rigby 2011-07-27 00:24:27 +01:00 committet von EvilSeph
Ursprung 6ae23e3f03
Commit 4117d6b65e
5 geänderte Dateien mit 48 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -49,7 +49,7 @@ public class ChunkProviderServer implements IChunkProvider {
int l = j * 16 + 8 - chunkcoordinates.z;
short short1 = 128;
if (k < -short1 || k > short1 || l < -short1 || l > short1) {
if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // CraftBukkit - added 'this.world.keepSpawnInMemory'
this.unloadQueue.add(i, j); // CraftBukkit
}
}

Datei anzeigen

@ -234,6 +234,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
// if (l == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
WorldServer worldserver = this.worlds.get(l);
log.info("Preparing start region for level " + l + " (Seed: " + worldserver.getSeed() + ")");
if (worldserver.getWorld().getKeepSpawnInMemory()) {
// CraftBukkit end
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
@ -260,7 +261,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
}
}
}
// } // CraftBukkit
} // CraftBukkit
}
// CraftBukkit start

Datei anzeigen

@ -83,6 +83,7 @@ public class World implements IBlockAccess {
// CraftBukkit start
private final CraftWorld world;
public boolean pvpMode;
public boolean keepSpawnInMemory = true;
public ChunkGenerator generator;
Chunk lastChunkAccessed;
int lastXAccessed = Integer.MIN_VALUE;

Datei anzeigen

@ -485,6 +485,7 @@ public final class CraftServer implements Server {
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
System.out.print("Preparing start region for level " + (console.worlds.size() -1) + " (Seed: " + internal.getSeed() + ")");
if (internal.getWorld().getKeepSpawnInMemory()) {
short short1 = 196;
long i = System.currentTimeMillis();
for (int j = -short1; j <= short1; j += 16) {
@ -511,6 +512,7 @@ public final class CraftServer implements Server {
}
}
}
}
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
return internal.getWorld();
}

Datei anzeigen

@ -783,4 +783,26 @@ public class CraftWorld implements World {
public int getMaxHeight() {
return 128;
}
public boolean getKeepSpawnInMemory() {
return world.keepSpawnInMemory;
}
public void setKeepSpawnInMemory(boolean keepLoaded) {
world.keepSpawnInMemory = keepLoaded;
// Grab the worlds spawn chunk
ChunkCoordinates chunkcoordinates = this.world.getSpawn();
int chunkCoordX = chunkcoordinates.x >> 4;
int chunkCoordZ = chunkcoordinates.z >> 4;
// Cycle through the 25x25 Chunks around it to load/unload the chunks.
for (int x = -12; x <= 12; x++) {
for (int z = -12; z <= 12; z++) {
if (keepLoaded) {
loadChunk(chunkCoordX + x, chunkCoordZ + z);
} else {
unloadChunk(chunkCoordX + x, chunkCoordZ + z);
}
}
}
}
}