From 4f138a56da29eb96b33568086954ded6afa9e754 Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Sat, 5 Feb 2011 02:11:49 +0100 Subject: [PATCH] Removed comments. --- src/main/java/org/dynmap/DynmapPlugin.java | 17 -- src/main/java/org/dynmap/kzedmap/KzedMap.java | 183 ------------------ 2 files changed, 200 deletions(-) diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index 91c38653..e8fd3955 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -80,22 +80,5 @@ public class DynmapPlugin extends JavaPlugin { getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, new DynmapPlayerListener(mapManager, playerList), Priority.Normal, this); getServer().getPluginManager().registerEvent(Event.Type.PLAYER_CHAT, new DynmapPlayerListener(mapManager, playerList), Priority.Normal, this); - //getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DESTROYED, listener, Priority.Normal, this); - /* etc.getLoader().addListener(PluginLoader.Hook.COMMAND, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.BLOCK_CREATED, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.BLOCK_DESTROYED, listener, this, PluginListener.Priority.MEDIUM); - etc.getLoader().addListener(PluginLoader.Hook.LOGIN, listener, this, PluginListener.Priority.MEDIUM); - - etc.getInstance().addCommand("/map_wait", " [wait] - set wait between tile renders (ms)"); - etc.getInstance().addCommand("/map_stat", " - query number of tiles in render queue"); - etc.getInstance().addCommand("/map_regen", " - regenerate entire map"); - etc.getInstance().addCommand("/map_debug", " - send map debugging messages"); - etc.getInstance().addCommand("/map_nodebug", " - disable map debugging messages"); - etc.getInstance().addCommand("/addsign", " [name] - adds a named sign to the map"); - etc.getInstance().addCommand("/removesign", " [name] - removes a named sign to the map"); - etc.getInstance().addCommand("/listsigns", " - list all named signs"); - etc.getInstance().addCommand("/tpsign", " [name] - teleport to a named sign"); - */ - } } diff --git a/src/main/java/org/dynmap/kzedmap/KzedMap.java b/src/main/java/org/dynmap/kzedmap/KzedMap.java index 48faa5c3..d337150b 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedMap.java +++ b/src/main/java/org/dynmap/kzedmap/KzedMap.java @@ -215,189 +215,6 @@ public class KzedMap extends MapType { else return y - (y % zTileHeight); } - - /* - // regenerate the entire map, starting at position - public void regenerate(int x, int y, int z) - { - int dx = x - anchorx; - int dy = y - anchory; - int dz = z - anchorz; - int px = dx + dz; - int py = dx - dz - dy; - - int tx = tilex(px); - int ty = tiley(py); - - MapTile first = getTileByPosition(tx, ty); - - Vector open = new Vector(); - open.add(first); - - while(open.size() > 0) { - MapTile t = open.remove(open.size() - 1); - if(t.stale) continue; - int h = world.getHighestBlockYAt(t.mx, t.mz); - - log.info("walking: " + t.mx + ", " + t.mz + ", h = " + h); - if(h < 1) - continue; - - pushStaleTile(t); - - open.add(getTileByPosition(t.px + tileWidth, t.py)); - open.add(getTileByPosition(t.px - tileWidth, t.py)); - open.add(getTileByPosition(t.px, t.py + tileHeight)); - open.add(getTileByPosition(t.px, t.py - tileHeight)); - } - } - - // regenerate all zoom tiles, starting at position - public void regenerateZoom(int x, int y, int z) - { - int dx = x - anchorx; - int dy = y - anchory; - int dz = z - anchorz; - int px = dx + dz; - int py = dx - dz - dy; - - int fzpx = ztilex(tilex(px)); - int fzpy = ztiley(tiley(py)); - - class Pair implements Comparator { - public int x; - public int y; - public Pair(int x, int y) - { - this.x = x; - this.y = y; - } - - public int hashCode() - { - return (x << 16) ^ y; - } - - public boolean equals(Object o) - { - Pair p = (Pair) o; - return x == p.x && y == p.y; - } - - public int compare(Object o1, Object o2) - { - Pair p1 = (Pair) o1; - Pair p2 = (Pair) o2; - if(p1.x < p1.x) return -1; - if(p1.x > p1.x) return 1; - if(p1.y < p1.y) return -1; - if(p1.y > p1.y) return 1; - return 0; - } - } - - HashSet visited = new HashSet(); - Vector open = new Vector(); - - Pair fp = new Pair(fzpx, fzpy); - open.add(fp); - visited.add(fp); - - while(open.size() > 0) { - Pair p = open.remove(open.size() - 1); - - int zpx = p.x; - int zpy = p.y; - - log.info("Regenerating zoom tile " + zpx + "," + zpy); - - int g = regenZoomTile(zpx, zpy); - - if(g > 0) { - Pair[] np = new Pair[4]; - np[0] = new Pair(zpx-zTileWidth, zpy); - np[1] = new Pair(zpx+zTileWidth, zpy); - np[2] = new Pair(zpx, zpy-zTileHeight); - np[3] = new Pair(zpx, zpy+zTileHeight); - - for(int i=0; i<4; i++) { - if(!visited.contains(np[i])) { - visited.add(np[i]); - open.add(np[i]); - } - } - } - } - } - - // regenerate zoom-out tile - // returns number of valid subtiles - public int regenZoomTile(int zpx, int zpy) - { - int px1 = zpx + tileWidth; - int py1 = zpy; - int px2 = zpx; - int py2 = py1 + tileHeight; - - MapTile t1 = getTileByPosition(px1, py1); - MapTile t2 = getTileByPosition(px2, py1); - MapTile t3 = getTileByPosition(px1, py2); - MapTile t4 = getTileByPosition(px2, py2); - - BufferedImage im1 = t1.loadTile(this); - BufferedImage im2 = t2.loadTile(this); - BufferedImage im3 = t3.loadTile(this); - BufferedImage im4 = t4.loadTile(this); - - BufferedImage zIm = new BufferedImage(MapManager.tileWidth, MapManager.tileHeight, BufferedImage.TYPE_INT_RGB); - WritableRaster zr = zIm.getRaster(); - Graphics2D g2 = zIm.createGraphics(); - g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - - int scw = tileWidth / 2; - int sch = tileHeight / 2; - - int good = 0; - - if(im1 != null) { - g2.drawImage(im1, 0, 0, scw, sch, null); - good ++; - } - - if(im2 != null) { - g2.drawImage(im2, scw, 0, scw, sch, null); - good ++; - } - - if(im3 != null) { - g2.drawImage(im3, 0, sch, scw, sch, null); - good ++; - } - - if(im4 != null) { - g2.drawImage(im4, scw, sch, scw, sch, null); - good ++; - } - - if(good == 0) { - return 0; - } - - String zPath = t1.getZoomPath(this); - // save zoom-out tile - try { - File file = new File(zPath); - ImageIO.write(zIm, "png", file); - log.info("regenZoomTile saved zoom-out tile at " + zPath); - } catch(IOException e) { - log.log(Level.SEVERE, "Failed to save zoom-out tile: " + zPath, e); - } catch(java.lang.NullPointerException e) { - log.log(Level.SEVERE, "Failed to save zoom-out tile (NullPointerException): " + zPath, e); - } - - return good; - } - */ public java.util.Map loadColorSet(String colorsetpath) { java.util.Map colors = new HashMap();