summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java55
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java10
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());
+ }
}