Make HDMap fall back to default perspective, shader or lighting as needed if unable to find configured preset.

This commit is contained in:
Mike Primm 2011-07-24 20:34:39 -05:00
parent abd7c25d80
commit 3ddce85f89
4 changed files with 75 additions and 24 deletions

View File

@ -351,6 +351,8 @@ public class MapManager {
private class CheckWorldTimes implements Runnable { private class CheckWorldTimes implements Runnable {
public void run() { public void run() {
Future<Integer> f = scheduler.callSyncMethod(plug_in, new Callable<Integer>() {
public Integer call() throws Exception {
for(DynmapWorld w : worlds) { for(DynmapWorld w : worlds) {
int new_servertime = (int)(w.world.getTime() % 24000); int new_servertime = (int)(w.world.getTime() % 24000);
/* Check if we went from night to day */ /* Check if we went from night to day */
@ -361,6 +363,15 @@ public class MapManager {
MapManager.mapman.pushUpdate(w.world, new Client.DayNight(isday)); MapManager.mapman.pushUpdate(w.world, new Client.DayNight(isday));
} }
} }
return 0;
}
});
try {
f.get();
} catch (Exception ix) {
Log.severe(ix);
}
renderpool.schedule(this, 5, TimeUnit.SECONDS);
} }
} }
@ -410,8 +421,6 @@ public class MapManager {
for (World world : plug_in.getServer().getWorlds()) { for (World world : plug_in.getServer().getWorlds()) {
activateWorld(world); activateWorld(world);
} }
scheduler.scheduleSyncRepeatingTask(plugin, new CheckWorldTimes(), 5*20, 5*20); /* Check very 5 seconds */
} }
void renderFullWorld(Location l, CommandSender sender) { void renderFullWorld(Location l, CommandSender sender) {
@ -578,6 +587,7 @@ public class MapManager {
tileQueue.start(); tileQueue.start();
renderpool = new DynmapScheduledThreadPoolExecutor(); renderpool = new DynmapScheduledThreadPoolExecutor();
renderpool.schedule(new DoZoomOutProcessing(), 60000, TimeUnit.MILLISECONDS); renderpool.schedule(new DoZoomOutProcessing(), 60000, TimeUnit.MILLISECONDS);
renderpool.schedule(new CheckWorldTimes(), 5, TimeUnit.SECONDS);
} }
public void stopRendering() { public void stopRendering() {

View File

@ -36,24 +36,43 @@ public class HDMap extends MapType {
String perspectiveid = configuration.getString("perspective", "default"); String perspectiveid = configuration.getString("perspective", "default");
perspective = MapManager.mapman.hdmapman.perspectives.get(perspectiveid); perspective = MapManager.mapman.hdmapman.perspectives.get(perspectiveid);
if(perspective == null) { if(perspective == null) {
Log.severe("HDMap '"+name+"' loading invalid perspective '" + perspectiveid + "' - map disabled"); /* Try to use default */
perspective = MapManager.mapman.hdmapman.perspectives.get("default");
if(perspective == null) {
Log.severe("HDMap '"+name+"' loaded invalid perspective '" + perspectiveid + "' - map disabled");
name = null; name = null;
return; return;
} }
else {
Log.severe("HDMap '"+name+"' loaded invalid perspective '" + perspectiveid + "' - using 'default' perspective");
}
}
String shaderid = configuration.getString("shader", "default"); String shaderid = configuration.getString("shader", "default");
shader = MapManager.mapman.hdmapman.shaders.get(shaderid); shader = MapManager.mapman.hdmapman.shaders.get(shaderid);
if(shader == null) {
shader = MapManager.mapman.hdmapman.shaders.get("default");
if(shader == null) { if(shader == null) {
Log.severe("HDMap '"+name+"' loading invalid shader '" + shaderid + "' - map disabled"); Log.severe("HDMap '"+name+"' loading invalid shader '" + shaderid + "' - map disabled");
name = null; name = null;
return; return;
} }
else {
Log.severe("HDMap '"+name+"' loading invalid shader '" + shaderid + "' - using 'default' shader");
}
}
String lightingid = configuration.getString("lighting", "default"); String lightingid = configuration.getString("lighting", "default");
lighting = MapManager.mapman.hdmapman.lightings.get(lightingid); lighting = MapManager.mapman.hdmapman.lightings.get(lightingid);
if(lighting == null) {
lighting = MapManager.mapman.hdmapman.lightings.get("default");
if(lighting == null) { if(lighting == null) {
Log.severe("HDMap '"+name+"' loading invalid lighting '" + lighting + "' - map disabled"); Log.severe("HDMap '"+name+"' loading invalid lighting '" + lighting + "' - map disabled");
name = null; name = null;
return; return;
} }
else {
Log.severe("HDMap '"+name+"' loading invalid lighting '" + lighting + "' - using 'default' lighting");
}
}
prefix = configuration.getString("prefix", name); prefix = configuration.getString("prefix", name);
this.configuration = configuration; this.configuration = configuration;

View File

@ -4,6 +4,19 @@ version: 0.20
# during upgrades, so new or updated perspective definitions should be done in the custom-perspectives.txt file # during upgrades, so new or updated perspective definitions should be done in the custom-perspectives.txt file
# #
perspectives: perspectives:
# Default - used if bad or no perspective name supplied
- class: org.dynmap.hdmap.IsoHDPerspective
name: default
azimuth: 135
inclination: 60
scale: 4
# iso_classic is very close to KzedMap view
- class: org.dynmap.hdmap.IsoHDPerspective
name: classic
azimuth: 135
inclination: 60
scale: 1.4
# High angle (60 degree) views
- class: org.dynmap.hdmap.IsoHDPerspective - class: org.dynmap.hdmap.IsoHDPerspective
name: iso_S_60_lowres name: iso_S_60_lowres
azimuth: 180 azimuth: 180

View File

@ -3,8 +3,14 @@
# during upgrades, so new or updated shader definitions should be done in the custom-shaders.txt file # during upgrades, so new or updated shader definitions should be done in the custom-shaders.txt file
# #
shaders: shaders:
- class: org.dynmap.hdmap.DefaultHDShader # Default shader - used if shader not specified or invalid
- class: org.dynmap.hdmap.TexturePackHDShader
name: default name: default
texturepack: standard
# Color scheme based shaders
- class: org.dynmap.hdmap.DefaultHDShader
name: defaultscheme
colorscheme: default colorscheme: default
- class: org.dynmap.hdmap.DefaultHDShader - class: org.dynmap.hdmap.DefaultHDShader
@ -19,6 +25,7 @@ shaders:
name: sk89q name: sk89q
colorscheme: sk89q colorscheme: sk89q
# Biome based shaders
- class: org.dynmap.hdmap.DefaultHDShader - class: org.dynmap.hdmap.DefaultHDShader
name: biome name: biome
biomecolored: biome biomecolored: biome
@ -31,21 +38,23 @@ shaders:
name: rainfall name: rainfall
biomecolored: rainfall biomecolored: rainfall
# No transparency default color scheme shader
- class: org.dynmap.hdmap.DefaultHDShader - class: org.dynmap.hdmap.DefaultHDShader
name: no_transparency name: no_transparency
colorscheme: default colorscheme: default
transparency: false transparency: false
# Cave view shader
- class: org.dynmap.hdmap.CaveHDShader - class: org.dynmap.hdmap.CaveHDShader
name: cave name: cave
# Texture pack based shader for standard Minecraft textures
- class: org.dynmap.hdmap.TexturePackHDShader - class: org.dynmap.hdmap.TexturePackHDShader
name: stdtexture name: stdtexture
texturepack: standard texturepack: standard
# Texture pack based shader for standard Minecraft textures, without biome-tinted grass/leaves
- class: org.dynmap.hdmap.TexturePackHDShader - class: org.dynmap.hdmap.TexturePackHDShader
name: stdtexture-nobiome name: stdtexture-nobiome
texturepack: standard texturepack: standard
biomeshaded: false biomeshaded: false