Server-side multiworld support with several improvements overal.

This commit is contained in:
FrozenCow 2011-02-12 23:45:33 +01:00
parent 2fd91ef94b
commit 5b0171c459
20 changed files with 398 additions and 296 deletions

View file

@ -1,25 +1,20 @@
package org.dynmap.kzedmap;
import java.util.logging.Logger;
import java.io.File;
import org.bukkit.World;
import org.dynmap.MapTile;
public class KzedMapTile extends MapTile {
protected static final Logger log = Logger.getLogger("Minecraft");
public KzedMap map;
public MapTileRenderer renderer;
/* projection position */
public int px, py;
/* minecraft space origin */
public int mx, my, mz;
// Hack.
public File file = null;
/* create new MapTile */
public KzedMapTile(KzedMap map, MapTileRenderer renderer, int px, int py) {
super(map);
public KzedMapTile(World world, KzedMap map, MapTileRenderer renderer, int px, int py) {
super(world, map);
this.map = map;
this.renderer = renderer;
this.px = px;
@ -31,12 +26,13 @@ public class KzedMapTile extends MapTile {
}
@Override
public String getName() {
return renderer.getName() + "_" + px + "_" + py;
public String getFilename() {
return renderer.getName() + "_" + px + "_" + py + ".png";
}
@Override
public int hashCode() {
return getName().hashCode();
return getFilename().hashCode() ^ getWorld().hashCode();
}
@Override
@ -48,11 +44,10 @@ public class KzedMapTile extends MapTile {
}
public boolean equals(KzedMapTile o) {
return o.getName().equals(getName());
return o.px == px && o.py == py && o.getWorld().equals(getWorld());
}
/* return a simple string representation... */
public String toString() {
return getName();
return getWorld().getName() + ":" + getFilename();
}
}