Compare commits

..

6 Commits

Author SHA1 Message Date
Mike Primm 01b054e972 Make logo component position settable, allow more than one instance 2012-05-19 22:12:01 -05:00
Mike Primm 5d35205cae Handle chunk cache loading in platform module 2012-05-19 15:50:20 -05:00
Mike Primm 58c7d6378c Add IC2 Compact Solars support setting 2012-05-11 22:35:07 -05:00
Mike Primm d95213e7dd Fix hideifundercover on The End 2012-05-09 00:29:04 -05:00
Mike Primm 4f5063155e Add forestry-support flag to configuration.txt 2012-05-08 22:40:08 -05:00
Mike Primm 2d4e233005 Bump to 0.39 2012-05-06 17:25:48 -05:00
4 changed files with 87 additions and 5 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.38</version>
<version>0.39</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -16,16 +16,20 @@ import org.dynmap.utils.MapChunkCache;
public class BukkitWorld extends DynmapWorld {
private World world;
private Permission perm;
private World.Environment env;
private boolean skylight;
public BukkitWorld(World w) {
super(w.getName(), w.getMaxHeight(), w.getSeaLevel());
world = w;
env = world.getEnvironment();
skylight = (env == World.Environment.NORMAL);
perm = new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
}
/* Test if world is nether */
@Override
public boolean isNether() {
return world.getEnvironment() == World.Environment.NETHER;
return env == World.Environment.NETHER;
}
/* Get world spawn location */
@Override
@@ -69,7 +73,7 @@ public class BukkitWorld extends DynmapWorld {
/* Test if sky light level is requestable */
@Override
public boolean canGetSkyLightLevel() {
return true;
return skylight;
}
/* Return sky light level */
@Override
@@ -81,7 +85,7 @@ public class BukkitWorld extends DynmapWorld {
*/
@Override
public String getEnvironment() {
return world.getEnvironment().name().toLowerCase();
return env.name().toLowerCase();
}
/**
* Get map chunk cache for world
@@ -57,6 +57,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.DynmapAPI;
import org.dynmap.DynmapChunk;
import org.dynmap.DynmapCore;
import org.dynmap.DynmapLocation;
import org.dynmap.DynmapWebChatEvent;
@@ -77,6 +78,7 @@ import org.dynmap.common.DynmapPlayer;
import org.dynmap.common.DynmapServerInterface;
import org.dynmap.common.DynmapListenerManager.EventType;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.utils.MapChunkCache;
import org.getspout.spoutapi.plugin.SpoutPlugin;
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
@@ -108,6 +110,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
* Server access abstraction class
*/
public class BukkitServer implements DynmapServerInterface {
/* Chunk load handling */
private Object loadlock = new Object();
private int chunks_in_cur_tick = 0;
private long cur_tick;
@Override
public void scheduleServerTask(Runnable run, long delay) {
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, run, delay);
@@ -302,6 +309,70 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
return false;
return permissions.hasOfflinePermission(player, perm);
}
/**
* Render processor helper - used by code running on render threads to request chunk snapshot cache from server/sync thread
*/
@Override
public MapChunkCache createMapChunkCache(DynmapWorld w, List<DynmapChunk> chunks,
boolean blockdata, boolean highesty, boolean biome, boolean rawbiome) {
MapChunkCache c = w.getChunkCache(chunks);
if(w.visibility_limits != null) {
for(MapChunkCache.VisibilityLimit limit: w.visibility_limits) {
c.setVisibleRange(limit);
}
c.setHiddenFillStyle(w.hiddenchunkstyle);
c.setAutoGenerateVisbileRanges(w.do_autogenerate);
}
if(w.hidden_limits != null) {
for(MapChunkCache.VisibilityLimit limit: w.hidden_limits) {
c.setHiddenRange(limit);
}
c.setHiddenFillStyle(w.hiddenchunkstyle);
}
if(c.setChunkDataTypes(blockdata, biome, highesty, rawbiome) == false) {
Log.severe("CraftBukkit build does not support biome APIs");
}
if(chunks.size() == 0) { /* No chunks to get? */
c.loadChunks(0);
return c;
}
final MapChunkCache cc = c;
while(!cc.isDoneLoading()) {
synchronized(loadlock) {
long now = System.currentTimeMillis();
if(cur_tick != (now/50)) { /* New tick? */
chunks_in_cur_tick = mapManager.getMaxChunkLoadsPerTick();
cur_tick = now/50;
}
}
Future<Boolean> f = core.getServer().callSyncMethod(new Callable<Boolean>() {
public Boolean call() throws Exception {
boolean exhausted;
synchronized(loadlock) {
if(chunks_in_cur_tick > 0)
chunks_in_cur_tick -= cc.loadChunks(chunks_in_cur_tick);
exhausted = (chunks_in_cur_tick == 0);
}
return exhausted;
}
});
Boolean delay;
try {
delay = f.get();
} catch (Exception ix) {
Log.severe(ix);
return null;
}
if((delay != null) && delay.booleanValue()) {
try { Thread.sleep(25); } catch (InterruptedException ix) {}
}
}
return c;
}
}
/**
* Player access abstraction class
+8 -1
View File
@@ -139,11 +139,14 @@ components:
hidey: false
show-mcr: false
# Note: more than one logo component can be defined
#- class: org.dynmap.ClientComponent
# type: logo
# text: "Dynmap"
# #logourl: "images/block_surface.png"
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
# # Valid positions: top-left, top-right, bottom-left, bottom-right
# position: bottom-right
#- class: org.dynmap.ClientComponent
# type: inactive
@@ -212,11 +215,12 @@ correct-water-lighting: true
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
compass-mode: newnorth
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters)
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters, Compact Solars)
#ic2-support: true
#ic2-advancesmachines-support: true
#ic2-chargingbench-support: true
#ic2-powerconverters-support: true
#ic2-compactsolars-support: true
# Enable BuildCraft block rendering support
#buildcraft-support: true
@@ -239,6 +243,9 @@ compass-mode: newnorth
# Enabled LC Trees++ block rendering support
#lctrees-support: true
# Enable Forestry block rending support
#forestry-support: true
render-triggers:
#- playermove
#- playerjoin