diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index d1e82645..812ef79b 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -579,14 +579,17 @@ public class DynmapPlugin extends JavaPlugin { else if(c.equals("radiusrender") && checkPlayerPermission(sender,"radiusrender")) { if (player != null) { int radius = 0; + String mapname = null; if(args.length > 1) { radius = Integer.parseInt(args[1]); /* Parse radius */ if(radius < 0) radius = 0; + if(args.length > 2) + mapname = args[2]; } Location loc = player.getLocation(); if(loc != null) - mapManager.renderWorldRadius(loc, sender, radius); + mapManager.renderWorldRadius(loc, sender, mapname, radius); } else { sender.sendMessage("Command can only be issued by player."); @@ -616,18 +619,28 @@ public class DynmapPlugin extends JavaPlugin { } } } else if (c.equals("fullrender") && checkPlayerPermission(sender,"fullrender")) { + String map = null; if (args.length > 1) { for (int i = 1; i < args.length; i++) { - World w = getServer().getWorld(args[i]); + int dot = args[i].indexOf(":"); + World w; + String wname = args[i]; + if(dot >= 0) { + wname = args[i].substring(0, dot); + map = args[i].substring(dot+1); + } + w = getServer().getWorld(wname); if(w != null) - mapManager.renderFullWorld(new Location(w, 0, 0, 0),sender); + mapManager.renderFullWorld(new Location(w, 0, 0, 0),sender, map); else - sender.sendMessage("World '" + args[i] + "' not defined/loaded"); + sender.sendMessage("World '" + wname + "' not defined/loaded"); } } else if (player != null) { Location loc = player.getLocation(); + if(args.length > 1) + map = args[1]; if(loc != null) - mapManager.renderFullWorld(loc, sender); + mapManager.renderFullWorld(loc, sender, map); } else { sender.sendMessage("World name is required"); } diff --git a/src/main/java/org/dynmap/MapManager.java b/src/main/java/org/dynmap/MapManager.java index c6c97e6c..62d0bbc0 100644 --- a/src/main/java/org/dynmap/MapManager.java +++ b/src/main/java/org/dynmap/MapManager.java @@ -166,15 +166,16 @@ public class MapManager { int cxmin, cxmax, czmin, czmax; String rendertype; boolean cancelled; + String mapname; /* Full world, all maps render */ - FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender) { - this(dworld, l, sender, -1); + FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, String mapname) { + this(dworld, l, sender, mapname, -1); rendertype = "Full render"; } /* Full world, all maps render, with optional render radius */ - FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, int radius) { + FullWorldRenderState(DynmapWorld dworld, Location l, CommandSender sender, String mapname, int radius) { world = dworld; loc = l; found = new HashSet(); @@ -193,6 +194,7 @@ public class MapManager { czmax = (l.getBlockZ() + radius+15)>>4; rendertype = "Radius render"; } + this.mapname = mapname; } /* Single tile render - used for incremental renders */ @@ -240,8 +242,17 @@ public class MapManager { /* Advance to next unrendered map */ while(map_index < world.maps.size()) { map_index++; /* Move to next one */ - if((map_index < world.maps.size()) && (renderedmaps.contains(world.maps.get(map_index)) == false)) - break; + if(map_index >= world.maps.size()) break; + /* If single map render, see if this is our target */ + if(mapname != null) { + if(world.maps.get(map_index).getName().equals(mapname)) { + break; + } + } + else { + if(renderedmaps.contains(world.maps.get(map_index)) == false) + break; + } } if(map_index >= world.maps.size()) { /* Last one done? */ sender.sendMessage(rendertype + " of '" + world.world.getName() + "' finished."); @@ -253,6 +264,8 @@ public class MapManager { /* Build active map list */ activemaps = ""; for(String n : activemaplist) { + if((mapname != null) && (!mapname.equals(n))) + continue; if(activemaps.length() > 0) activemaps += ","; activemaps += n; @@ -307,12 +320,12 @@ public class MapManager { } if(tile0 != null) { /* Single tile? */ if(cache.isEmpty() == false) - tile.render(cache); + tile.render(cache, null); } else { /* Switch to not checking if rendered tile is blank - breaks us on skylands, where tiles can be nominally blank - just work off chunk cache empty */ if (cache.isEmpty() == false) { - tile.render(cache); + tile.render(cache, mapname); found.remove(tile); rendered.add(tile); for (MapTile adjTile : map.getAdjecentTiles(tile)) { @@ -434,7 +447,7 @@ public class MapManager { } } - void renderFullWorld(Location l, CommandSender sender) { + void renderFullWorld(Location l, CommandSender sender, String mapname) { DynmapWorld world = getWorld(l.getWorld().getName()); if (world == null) { sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration."); @@ -448,7 +461,7 @@ public class MapManager { sender.sendMessage(rndr.rendertype + " of world '" + wname + "' already active."); return; } - rndr = new FullWorldRenderState(world,l,sender); /* Make new activation record */ + rndr = new FullWorldRenderState(world,l,sender, mapname); /* Make new activation record */ active_renders.put(wname, rndr); /* Add to active table */ } /* Schedule first tile to be worked */ @@ -457,7 +470,7 @@ public class MapManager { sender.sendMessage("Full render starting on world '" + wname + "'..."); } - void renderWorldRadius(Location l, CommandSender sender, int radius) { + void renderWorldRadius(Location l, CommandSender sender, String mapname, int radius) { DynmapWorld world = getWorld(l.getWorld().getName()); if (world == null) { sender.sendMessage("Could not render: world '" + l.getWorld().getName() + "' not defined in configuration."); @@ -471,7 +484,7 @@ public class MapManager { sender.sendMessage(rndr.rendertype + " of world '" + wname + "' already active."); return; } - rndr = new FullWorldRenderState(world,l,sender, radius); /* Make new activation record */ + rndr = new FullWorldRenderState(world,l,sender, mapname, radius); /* Make new activation record */ active_renders.put(wname, rndr); /* Add to active table */ } /* Schedule first tile to be worked */ diff --git a/src/main/java/org/dynmap/MapTile.java b/src/main/java/org/dynmap/MapTile.java index 3e32fd72..29821b2c 100644 --- a/src/main/java/org/dynmap/MapTile.java +++ b/src/main/java/org/dynmap/MapTile.java @@ -10,7 +10,7 @@ import org.dynmap.utils.MapChunkCache; public abstract class MapTile { protected DynmapWorld world; - public abstract boolean render(MapChunkCache cache); + public abstract boolean render(MapChunkCache cache, String mapname); public abstract List getRequiredChunks(); public abstract MapTile[] getAdjecentTiles(); diff --git a/src/main/java/org/dynmap/flat/FlatMap.java b/src/main/java/org/dynmap/flat/FlatMap.java index 762a72da..c46161ac 100644 --- a/src/main/java/org/dynmap/flat/FlatMap.java +++ b/src/main/java/org/dynmap/flat/FlatMap.java @@ -495,7 +495,7 @@ public class FlatMap extends MapType { } @Override - public boolean render(MapChunkCache cache) { + public boolean render(MapChunkCache cache, String mapname) { return map.render(cache, this, MapManager.mapman.getTileFile(this)); } diff --git a/src/main/java/org/dynmap/hdmap/HDMapManager.java b/src/main/java/org/dynmap/hdmap/HDMapManager.java index 53ee2d0c..0e398183 100644 --- a/src/main/java/org/dynmap/hdmap/HDMapManager.java +++ b/src/main/java/org/dynmap/hdmap/HDMapManager.java @@ -119,7 +119,7 @@ public class HDMapManager { /** * Initialize shader states for all shaders for given tile */ - public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache, MapIterator mapiter) { + public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache, MapIterator mapiter, String mapname) { DynmapWorld w = MapManager.mapman.worldsLookup.get(tile.getWorld().getName()); if(w == null) return new HDShaderState[0]; ArrayList shaders = new ArrayList(); @@ -127,6 +127,9 @@ public class HDMapManager { if(map instanceof HDMap) { HDMap hdmap = (HDMap)map; if(hdmap.getPerspective() == tile.perspective) { + /* If limited to one map, and this isn't it, skip */ + if((mapname != null) && (!hdmap.getName().equals(mapname))) + continue; shaders.add(hdmap.getShader().getStateInstance(hdmap, cache, mapiter)); } } diff --git a/src/main/java/org/dynmap/hdmap/HDMapTile.java b/src/main/java/org/dynmap/hdmap/HDMapTile.java index 5b3ba6fd..15c13bfa 100644 --- a/src/main/java/org/dynmap/hdmap/HDMapTile.java +++ b/src/main/java/org/dynmap/hdmap/HDMapTile.java @@ -76,8 +76,8 @@ public class HDMapTile extends MapTile { @Override public boolean isBlockTypeDataNeeded() { return MapManager.mapman.hdmapman.isBlockTypeDataNeeded(this); } - public boolean render(MapChunkCache cache) { - return perspective.render(cache, this); + public boolean render(MapChunkCache cache, String mapname) { + return perspective.render(cache, this, mapname); } public List getRequiredChunks() { diff --git a/src/main/java/org/dynmap/hdmap/HDPerspective.java b/src/main/java/org/dynmap/hdmap/HDPerspective.java index b6bbe31a..6ef2ee5e 100644 --- a/src/main/java/org/dynmap/hdmap/HDPerspective.java +++ b/src/main/java/org/dynmap/hdmap/HDPerspective.java @@ -18,7 +18,7 @@ public interface HDPerspective { /* Get chunks needed for given tile */ List getRequiredChunks(MapTile tile); /* Render given tile */ - boolean render(MapChunkCache cache, HDMapTile tile); + boolean render(MapChunkCache cache, HDMapTile tile, String mapname); public boolean isBiomeDataNeeded(); public boolean isHightestBlockYDataNeeded(); diff --git a/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java b/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java index 5a5aa6dd..f1d48ab9 100644 --- a/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java +++ b/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java @@ -888,11 +888,11 @@ public class IsoHDPerspective implements HDPerspective { } @Override - public boolean render(MapChunkCache cache, HDMapTile tile) { + public boolean render(MapChunkCache cache, HDMapTile tile, String mapname) { Color rslt = new Color(); MapIterator mapiter = cache.getIterator(0, 0, 0); /* Build shader state object for each shader */ - HDShaderState[] shaderstate = MapManager.mapman.hdmapman.getShaderStateForTile(tile, cache, mapiter); + HDShaderState[] shaderstate = MapManager.mapman.hdmapman.getShaderStateForTile(tile, cache, mapiter, mapname); int numshaders = shaderstate.length; if(numshaders == 0) return false; diff --git a/src/main/java/org/dynmap/kzedmap/KzedMapTile.java b/src/main/java/org/dynmap/kzedmap/KzedMapTile.java index 451f27d3..9207ec99 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedMapTile.java +++ b/src/main/java/org/dynmap/kzedmap/KzedMapTile.java @@ -75,7 +75,7 @@ public class KzedMapTile extends MapTile { return getWorld().getName() + ":" + getFilename(); } - public boolean render(MapChunkCache cache) { + public boolean render(MapChunkCache cache, String mapname) { return map.render(cache, this, MapManager.mapman.getTileFile(this)); } diff --git a/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java b/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java index 89f8c148..2526b5eb 100644 --- a/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java +++ b/src/main/java/org/dynmap/kzedmap/KzedZoomedMapTile.java @@ -84,7 +84,7 @@ public class KzedZoomedMapTile extends MapTile { } @Override - public boolean render(MapChunkCache cache) { + public boolean render(MapChunkCache cache, String mapname) { return false; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7db9def7..a2aca214 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -12,9 +12,11 @@ commands: / show - shows the player from the map. / show TheDude - shows the player 'TheDude' from the map. / render - Renders the tile at your location. - / fullrender - (Attempts to) render entire world from your location. - / fullrender world - (Attempts to) render entire world 'world'. - / radiusrender ## - (Attempts to) render at least ## block radius from your location. + / fullrender - Render all maps for entire world from your location. + / fullrender world - Render all maps for entire world 'world'. + / fullrender world:mapname - Render map 'mapname' of world 'world'. + / radiusrender ## - Render at least ## block radius from your location on all maps. + / radiusrender ## mapname - Render at least ## block radius from your location on map 'mapname' / cancelrender - Cancels any active renders on current world / cancelrender world - Cancels any active renders of world 'world' / stats - Show render statistics.