Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions DynmapCore/src/main/java/org/dynmap/MapManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -629,10 +629,12 @@ else if(pausedforworld) {
renderedmaps.addAll(map.getMapsSharingRender(world));

/* Now, prime the render queue */
for (MapTile mt : map.getTiles(world, (int)loc.x, (int)loc.y, (int)loc.z)) {
if (!found.getFlag(mt.tileOrdinalX(), mt.tileOrdinalY())) {
found.setFlag(mt.tileOrdinalX(), mt.tileOrdinalY(), true);
renderQueue.add(mt);
if (map.isReadOnly() == false) {
for (MapTile mt : map.getTiles(world, (int)loc.x, (int)loc.y, (int)loc.z)) {
if (!found.getFlag(mt.tileOrdinalX(), mt.tileOrdinalY())) {
found.setFlag(mt.tileOrdinalX(), mt.tileOrdinalY(), true);
renderQueue.add(mt);
}
}
}
if(!updaterender) { /* Only add other seed points for fullrender */
Expand Down Expand Up @@ -1072,6 +1074,10 @@ private void addNextTilesToUpdate(int cnt) {
tiles.clear();
for(DynmapWorld w : worlds) {
for(MapTypeState mts : w.mapstate) {
if (mts.type.isReadOnly()) {
continue;
}

if(mts.getNextInvalidTileCoord(coord)) {
mts.type.addMapTiles(tiles, w, coord.x, coord.y);
mts.validateTile(coord.x, coord.y);
Expand Down Expand Up @@ -1903,6 +1909,10 @@ private void processTouchEvents() {
}
if(world == null) continue;
for (MapTypeState mts : world.mapstate) {
if (mts.type.isReadOnly()) {
continue;
}

List<TileFlags.TileCoord> tiles = mts.type.getTileCoords(world, evt.x, evt.y, evt.z);
invalidates += mts.invalidateTiles(tiles);
}
Expand Down Expand Up @@ -1935,6 +1945,10 @@ private void processTouchEvents() {
if(world == null) continue;
int invalidates = 0;
for (MapTypeState mts : world.mapstate) {
if (mts.type.isReadOnly()) {
continue;
}

List<TileFlags.TileCoord> tiles = mts.type.getTileCoords(world, evt.xmin, evt.ymin, evt.zmin, evt.xmax, evt.ymax, evt.zmax);
invalidates += mts.invalidateTiles(tiles);
}
Expand Down
24 changes: 24 additions & 0 deletions DynmapCore/src/main/java/org/dynmap/MapType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

public abstract class MapType {
private boolean is_protected;
/**
* Is the map type read-only? (i.e. should not be updated by renderer)
*/
private boolean is_readonly;
protected int tileupdatedelay;

public enum ImageVariant {
Expand Down Expand Up @@ -207,6 +211,26 @@ public boolean setProtected(boolean p) {
}
return false;
}
/**
* Is the map type read-only? (i.e. should not be updated by renderer)
* @return true if read-only
*/
public boolean isReadOnly() {
return is_readonly;
}

/**
* Set read-only state of map type
* @param r - true if read-only
* @return true if state changed
*/
public boolean setReadOnly(boolean r) {
if(is_readonly != r) {
is_readonly = r;
return true;
}
return false;
}
public abstract String getPrefix();

public int getTileUpdateDelay(DynmapWorld w) {
Expand Down
1 change: 1 addition & 0 deletions DynmapCore/src/main/java/org/dynmap/hdmap/HDMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public HDMap(DynmapCore core, ConfigurationNode configuration) {
this.append_to_world = configuration.getString("append_to_world", "");
setProtected(configuration.getBoolean("protected", false));
setTileUpdateDelay(configuration.getInteger("tileupdatedelay", -1));
setReadOnly(configuration.getBoolean("readonly", false));
}

public ConfigurationNode saveConfiguration() {
Expand Down
6 changes: 6 additions & 0 deletions DynmapCore/src/main/java/org/dynmap/hdmap/HDMapManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache
/* If limited to one map, and this isn't it, skip */
if((mapname != null) && (!hdmap.getName().equals(mapname)))
continue;

// Maps can be set to read-only, which means they don't get re-rendered
if (map.isReadOnly()) {
continue;
}

shaders.add(hdmap.getShader().getStateInstance(hdmap, cache, mapiter, scale));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ public boolean render(MapChunkCache cache, HDMapTile tile, String mapname) {
// Mark the tiles we're going to render as validated
for (int i = 0; i < numshaders; i++) {
MapTypeState mts = world.getMapState(shaderstate[i].getMap());
if (mts != null) {
if (mts != null && mts.type.isReadOnly() == false) {
mts.validateTile(tile.tx, tile.ty);
}
}
Expand Down
2 changes: 2 additions & 0 deletions DynmapCore/src/main/resources/worlds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ worlds:
# shader: cave
# lighting: default
# mapzoomin: 3
# # maps can be set to `readonly: false` to prevent updates
# readonly: false
#
# To just label world, and inherit rest from template, just provide name and title
#- name: world2
Expand Down