diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-05 20:51:22 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-07 01:51:05 +0000 |
commit | b229931ce6bd76b19e8e45ce1b4f7665f612eb51 (patch) | |
tree | e21d78e9765044ed88afb07f4d06aadb193fd038 /src | |
parent | bf304ddc439484ce17b083ba667f2eb37aa54ea7 (diff) | |
download | craftbukkit-b229931ce6bd76b19e8e45ce1b4f7665f612eb51.tar craftbukkit-b229931ce6bd76b19e8e45ce1b4f7665f612eb51.tar.gz craftbukkit-b229931ce6bd76b19e8e45ce1b4f7665f612eb51.tar.lz craftbukkit-b229931ce6bd76b19e8e45ce1b4f7665f612eb51.tar.xz craftbukkit-b229931ce6bd76b19e8e45ce1b4f7665f612eb51.zip |
Attempt to clear loaded chunks during multiworld teleportation
Diffstat (limited to 'src')
3 files changed, 60 insertions, 7 deletions
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 8a44578e..a9e3a906 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -28,7 +28,7 @@ public class ServerConfigurationManager { public static Logger a = Logger.getLogger("Minecraft"); public List b = new ArrayList(); private MinecraftServer c; - private PlayerManager d; + public PlayerManager d; // Craftbukkit - public private int e; private Set f = new HashSet(); private Set g = new HashSet(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 36f01868..4bc77407 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -149,17 +149,12 @@ public final class CraftServer implements Server { return pluginManager; } -<<<<<<< HEAD public BukkitScheduler getScheduler() { return scheduler; -======= - public World[] getWorlds() { - return console.worlds.toArray(new World[0]); ->>>>>>> f045828... Added internal MC support for multiple worlds } public World[] getWorlds() { - return new World[]{console.e.getWorld()}; + return console.worlds.toArray(new World[0]); } public ServerConfigurationManager getHandle() { @@ -196,4 +191,52 @@ public final class CraftServer implements Server { public String toString() { return "CraftServer{" + "serverName=" + serverName + "serverVersion=" + serverVersion + "protocolVersion=" + protocolVersion + '}'; } + + public World createWorld(String name, boolean nether) { + File folder = new File(name); + + if ((folder.exists()) && (!folder.isDirectory())) { + throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder"); + } + + WorldServer internal = new WorldServer(console, new File("."), name, nether ? -1 : 0); + + internal.a(new WorldManager(console, internal)); + internal.k = 1; + internal.a(true, true); + console.f.a(internal); + console.worlds.add(internal); + + short short1 = 196; + long i = System.currentTimeMillis(); + for (int j = -short1; j <= short1; j += 16) { + for (int k = -short1; k <= short1; k += 16) { + long l = System.currentTimeMillis(); + + if (l < i) { + i = l; + } + + if (l > i + 1000L) { + int i1 = (short1 * 2 + 1) * (short1 * 2 + 1); + int j1 = (j + short1) * (short1 * 2 + 1) + k + 1; + + System.out.println("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%"); + i = l; + } + + internal.A.d(internal.spawnX + j >> 4, internal.spawnZ + k >> 4); + + while (internal.d()) { + ; + } + } + } + + return new CraftWorld(internal); + } + + public MinecraftServer getServer() { + return console; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index f01c67f7..20cc0010 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -10,6 +10,7 @@ import net.minecraft.server.Packet6SpawnPosition; import net.minecraft.server.WorldServer; import org.bukkit.Location; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Player; public class CraftPlayer extends CraftHumanEntity implements Player { @@ -109,4 +110,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public boolean performCommand(String command) { return server.dispatchCommand(this, command); } + + @Override + public void teleportTo(Location location) { + if (location.getWorld() != getWorld()) { + server.getServer().f.d.b(entity); + } + entity.world = ((CraftWorld)location.getWorld()).getHandle(); + entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + } } |