No lookup for worlds, store on object

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2010-12-30 04:37:32 +00:00
parent 837fa8ac26
commit 10d1ac6c12
3 changed files with 3 additions and 15 deletions

View file

@ -20,7 +20,7 @@ public class CraftEntity implements org.bukkit.Entity {
}
public World getWorld() {
return server.getWorld((WorldServer)entity.l);
return ((WorldServer)entity.l).getWorld();
}
public void teleportTo(Location location) {

View file

@ -19,7 +19,6 @@ public final class CraftServer implements Server {
private final String serverName = "Craftbukkit";
private final String serverVersion;
private final HashMap<String, Player> playerCache = new HashMap<String, Player>();
private final HashMap<WorldServer, World> worldCache = new HashMap<WorldServer, World>();
private final PluginManager pluginManager = new SimplePluginManager(this);
protected final MinecraftServer console;
@ -87,18 +86,7 @@ public final class CraftServer implements Server {
}
public World[] getWorlds() {
return new World[] { getWorld(console.e) };
}
public World getWorld(WorldServer world) {
World result = worldCache.get(world);
if (result == null) {
result = new CraftWorld(world);
worldCache.put(world, result);
}
return result;
return new World[] { console.e.getWorld() };
}
public ServerConfigurationManager getHandle() {

View file

@ -13,7 +13,7 @@ public class CraftWorld implements World {
private final Map<BlockCoordinate, Block> blockCache = new HashMap<BlockCoordinate, Block>();
private final WorldServer world;
protected CraftWorld(WorldServer world) {
public CraftWorld(WorldServer world) {
this.world = world;
}