mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
No lookup for worlds, store on object
This commit is contained in:
parent
c57530392c
commit
416964ef5a
@ -20,7 +20,7 @@ public class WorldServer extends World {
|
|||||||
B = false;
|
B = false;
|
||||||
E = new MCHashTable();
|
E = new MCHashTable();
|
||||||
D = minecraftserver;
|
D = minecraftserver;
|
||||||
world = (CraftWorld)D.server.getWorld(this); // CraftBukkit
|
world = new CraftWorld(this); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@ -37,6 +37,10 @@ public class WorldServer extends World {
|
|||||||
world.updateBlock(i1, j1, k1);
|
world.updateBlock(i1, j1, k1);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CraftWorld getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
// CraftBukkit stop
|
// CraftBukkit stop
|
||||||
|
|
||||||
public void f() {
|
public void f() {
|
||||||
|
@ -20,7 +20,7 @@ public class CraftEntity implements org.bukkit.Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return server.getWorld((WorldServer)entity.l);
|
return ((WorldServer)entity.l).getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teleportTo(Location location) {
|
public void teleportTo(Location location) {
|
||||||
|
@ -19,7 +19,6 @@ public final class CraftServer implements Server {
|
|||||||
private final String serverName = "Craftbukkit";
|
private final String serverName = "Craftbukkit";
|
||||||
private final String serverVersion;
|
private final String serverVersion;
|
||||||
private final HashMap<String, Player> playerCache = new HashMap<String, Player>();
|
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);
|
private final PluginManager pluginManager = new SimplePluginManager(this);
|
||||||
|
|
||||||
protected final MinecraftServer console;
|
protected final MinecraftServer console;
|
||||||
@ -87,18 +86,7 @@ public final class CraftServer implements Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public World[] getWorlds() {
|
public World[] getWorlds() {
|
||||||
return new World[] { getWorld(console.e) };
|
return new World[] { console.e.getWorld() };
|
||||||
}
|
|
||||||
|
|
||||||
public World getWorld(WorldServer world) {
|
|
||||||
World result = worldCache.get(world);
|
|
||||||
|
|
||||||
if (result == null) {
|
|
||||||
result = new CraftWorld(world);
|
|
||||||
worldCache.put(world, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerConfigurationManager getHandle() {
|
public ServerConfigurationManager getHandle() {
|
||||||
|
@ -13,7 +13,7 @@ public class CraftWorld implements World {
|
|||||||
private final Map<BlockCoordinate, Block> blockCache = new HashMap<BlockCoordinate, Block>();
|
private final Map<BlockCoordinate, Block> blockCache = new HashMap<BlockCoordinate, Block>();
|
||||||
private final WorldServer world;
|
private final WorldServer world;
|
||||||
|
|
||||||
protected CraftWorld(WorldServer world) {
|
public CraftWorld(WorldServer world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user