Compare commits

...

23 Commits

Author SHA1 Message Date
Mike Primm f0885abea2 Back to 1.1 for patch 2012-11-16 18:39:44 -06:00
Mike Primm 2b17cb215b Bump to 1.2 2012-11-16 18:06:22 -06:00
Mike Primm 68f0c17f70 Support world loading/unloading - allow viewing while world unloaded 2012-11-10 23:47:40 -06:00
Mike Primm a20e55beab Add support for handling custom biomes (ExtraBiomes XL) 2012-11-09 21:01:11 -06:00
Mike Primm 413542fe61 Add permissions.jar to project - not on repo anymore 2012-11-08 14:25:32 -06:00
Mike Primm a250732d31 Bump to v1.1 2012-10-29 22:37:55 -05:00
Mike Primm 07f2496f2f Bump to 1.00 2012-10-21 12:32:58 -05:00
Mike Primm 2f6e52261c Cleanup unused methods, speed up world lookup 2012-10-17 19:42:37 -05:00
Mike Primm a117987840 Handle multiple mod names 2012-10-15 08:24:10 -05:00
Mike Primm cbb8cc061e Add support for automatic enabling of mod-specific blocks and textures 2012-10-15 01:19:18 -05:00
Mike Primm c03365d574 Correct setting for TubeStuff support 2012-10-14 21:02:37 -05:00
Mike Primm 827f18b8e0 Support delaying dynmap start to allow Spout blocks to be registered 2012-10-05 00:10:32 -05:00
Mike Primm 1603015631 Handle new CancellationExceptions being thrown by Bukkit Scheduler 2012-09-03 20:43:30 -05:00
Mike Primm c2d97ba3d5 Keep metrics from nagging if mcstats.org is offline 2012-08-27 21:03:55 -05:00
Mike Primm 418b175923 Bump to 0.90 2012-08-26 22:07:56 -05:00
Mike Primm fdc14b413d Add ee2-support setting for Equivalent Exchange 2 support 2012-08-25 22:55:48 -05:00
Mike Primm e6d509c3e6 Add some more feature metrics 2012-08-24 22:37:48 -05:00
Mike Primm b10ec3a331 Add support for ExtraBiomesXL Bunyan blocks 2012-08-24 01:28:46 -05:00
Mike Primm 9f8617d81d Add mcstats.org reporting 2012-08-24 00:07:06 -05:00
Mike Primm 265e037b74 Add setting for enabling ExtraBiomesXL rendering support 2012-08-20 00:17:00 -05:00
Mike Primm f50e73180c Back to 0.80 2012-08-19 19:34:45 -05:00
Mike Primm aad4b64603 Set to 0.70.3 - fix for CB internals change in 1.3.1-R2.1 2012-08-19 18:04:36 -05:00
Mike Primm aeeb09f600 To 0.80 2012-08-14 01:11:22 -05:00
8 changed files with 1123 additions and 145 deletions
BIN
View File
Binary file not shown.
+4 -2
View File
@@ -2,7 +2,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.70.2</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -128,7 +127,9 @@
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>[2.5.4,)</version>
<version>3.1.6</version>
<scope>system</scope>
<systemPath>${project.basedir}/Permissions.jar</systemPath>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
@@ -185,4 +186,5 @@
<version>1.2.5-R5.1-SNAPSHOT</version>
</dependency>
</dependencies>
<version>1.1</version>
</project>
@@ -17,13 +17,36 @@ public class BukkitWorld extends DynmapWorld {
private World world;
private World.Environment env;
private boolean skylight;
private DynmapLocation spawnloc = new DynmapLocation();
public BukkitWorld(World w) {
super(w.getName(), w.getMaxHeight(), w.getSeaLevel());
this(w.getName(), w.getMaxHeight(), w.getSeaLevel(), w.getEnvironment());
setWorldLoaded(w);
new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
}
public BukkitWorld(String name, int height, int sealevel, World.Environment env) {
super(name, height, sealevel);
world = null;
this.env = env;
skylight = (env == World.Environment.NORMAL);
new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
}
/**
* Set world online
* @param w - loaded world
*/
public void setWorldLoaded(World w) {
world = w;
env = world.getEnvironment();
skylight = (env == World.Environment.NORMAL);
new Permission("dynmap.world." + getName(), "Dynmap access for world " + getName(), PermissionDefault.OP);
}
/**
* Set world unloaded
*/
@Override
public void setWorldUnloaded() {
getSpawnLocation(); /* Remember spawn location before unload */
world = null;
}
/* Test if world is nether */
@Override
@@ -33,26 +56,44 @@ public class BukkitWorld extends DynmapWorld {
/* Get world spawn location */
@Override
public DynmapLocation getSpawnLocation() {
DynmapLocation dloc = new DynmapLocation();
Location sloc = world.getSpawnLocation();
dloc.x = sloc.getBlockX(); dloc.y = sloc.getBlockY();
dloc.z = sloc.getBlockZ(); dloc.world = normalizeWorldName(sloc.getWorld().getName());
return dloc;
if(world != null) {
Location sloc = world.getSpawnLocation();
spawnloc.x = sloc.getBlockX();
spawnloc.y = sloc.getBlockY();
spawnloc.z = sloc.getBlockZ();
spawnloc.world = normalizeWorldName(sloc.getWorld().getName());
}
return spawnloc;
}
/* Get world time */
@Override
public long getTime() {
return world.getTime();
if(world != null) {
return world.getTime();
}
else {
return -1;
}
}
/* World is storming */
@Override
public boolean hasStorm() {
return world.hasStorm();
if(world != null) {
return world.hasStorm();
}
else {
return false;
}
}
/* World is thundering */
@Override
public boolean isThundering() {
return world.isThundering();
if(world != null) {
return world.isThundering();
}
else {
return false;
}
}
/* World is loaded */
@Override
@@ -62,22 +103,37 @@ public class BukkitWorld extends DynmapWorld {
/* Get light level of block */
@Override
public int getLightLevel(int x, int y, int z) {
return world.getBlockAt(x, y, z).getLightLevel();
if(world != null) {
return world.getBlockAt(x, y, z).getLightLevel();
}
else {
return -1;
}
}
/* Get highest Y coord of given location */
@Override
public int getHighestBlockYAt(int x, int z) {
return world.getHighestBlockYAt(x, z);
if(world != null) {
return world.getHighestBlockYAt(x, z);
}
else {
return -1;
}
}
/* Test if sky light level is requestable */
@Override
public boolean canGetSkyLightLevel() {
return skylight;
return skylight && (world != null);
}
/* Return sky light level */
@Override
public int getSkyLightLevel(int x, int y, int z) {
return world.getBlockAt(x, y, z).getLightFromSky();
if(world != null) {
return world.getBlockAt(x, y, z).getLightFromSky();
}
else {
return -1;
}
}
/**
* Get world environment ID (lower case - normal, the_end, nether)
@@ -91,9 +147,14 @@ public class BukkitWorld extends DynmapWorld {
*/
@Override
public MapChunkCache getChunkCache(List<DynmapChunk> chunks) {
NewMapChunkCache c = new NewMapChunkCache();
c.setChunks(this, chunks);
return c;
if(isLoaded()) {
NewMapChunkCache c = new NewMapChunkCache();
c.setChunks(this, chunks);
return c;
}
else {
return null;
}
}
public World getWorld() {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,14 +1,21 @@
package org.dynmap.bukkit;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.ChunkProviderServer;
import org.bukkit.World;
import org.bukkit.Chunk;
import org.bukkit.block.Biome;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftChunkSnapshot;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.util.LongHashset;
import org.bukkit.ChunkSnapshot;
@@ -28,6 +35,10 @@ import org.getspout.spoutapi.block.SpoutChunk;
public class NewMapChunkCache implements MapChunkCache {
private static boolean init = false;
private static boolean use_spout = false;
private static Field unloadqueue = null;
private static Method queuecontainskey = null;
private static Field biomesnapshot = null;
private World w;
private DynmapWorld dw;
@@ -138,15 +149,37 @@ public class NewMapChunkCache implements MapChunkCache {
sameneighborbiomecnt[i] = new byte[z_size];
biomemap[i] = new BiomeMap[z_size];
}
BiomeBase[] biomebase = null;
ChunkSnapshot biome_css = null;
for(int i = 0; i < x_size; i++) {
initialize(i + x_base, 64, z_base);
for(int j = 0; j < z_size; j++) {
Biome bb = snap.getBiome(bx, bz);
BiomeMap bm;
if(bb == null)
bm = BiomeMap.NULL;
else
bm = biome_to_bmap[bb.ordinal()];
if((biomesnapshot != null) && (snap != biome_css)) {
biomebase = null;
biome_css = snap;
try {
if (biome_css instanceof SpoutChunkSnapshot) {
biome_css = ((SpoutChunkSnapshot)biome_css).chunk;
}
if(biome_css instanceof CraftChunkSnapshot) {
biomebase = (BiomeBase[]) biomesnapshot.get(biome_css);
}
} catch (IllegalArgumentException iax) {
} catch (IllegalAccessException e) {
}
}
if(biomebase != null) {
bm = BiomeMap.byBiomeID(biomebase[bz << 4 | bx].id);
}
else {
Biome bb = snap.getBiome(bx, bz);
if(bb == null)
bm = BiomeMap.NULL;
else
bm = biome_to_bmap[bb.ordinal()];
}
biomemap[i][j] = bm;
int cnt = 0;
if(i > 0) {
@@ -659,12 +692,37 @@ public class NewMapChunkCache implements MapChunkCache {
if(!init) {
use_spout = DynmapPlugin.plugin.hasSpout();
try {
unloadqueue = ChunkProviderServer.class.getField("unloadQueue");
Class cls = unloadqueue.getType();
String nm = cls.getName();
if (nm.equals("org.bukkit.craftbukkit.util.LongHashset")) {
queuecontainskey = unloadqueue.getType().getMethod("containsKey", new Class[] { int.class, int.class });
}
else {
unloadqueue = null;
}
} catch (NoSuchFieldException nsfx) {
unloadqueue = null;
} catch (NoSuchMethodException nsmx) {
unloadqueue = null;
}
try {
biomesnapshot = CraftChunkSnapshot.class.getDeclaredField("biome");
biomesnapshot.setAccessible(true);
} catch (NoSuchFieldException nsfx) {
biomesnapshot = null;
Log.warning("Unable to find biome field in ChunkSnapshot");
}
init = true;
}
}
public void setChunks(BukkitWorld dw, List<DynmapChunk> chunks) {
this.dw = dw;
this.w = dw.getWorld();
if(this.w == null) {
this.chunks = new ArrayList<DynmapChunk>();
}
nsect = dw.worldheight >> 4;
this.chunks = chunks;
/* Compute range */
@@ -707,9 +765,18 @@ public class NewMapChunkCache implements MapChunkCache {
}
public int loadChunks(int max_to_load) {
if(dw.isLoaded() == false)
return 0;
long t0 = System.nanoTime();
CraftWorld cw = (CraftWorld)w;
LongHashset unloadqueue = cw.getHandle().chunkProviderServer.unloadQueue;
Object queue = null;
try {
if (unloadqueue != null) {
queue = unloadqueue.get(cw.getHandle().chunkProviderServer);
}
} catch (IllegalArgumentException iax) {
} catch (IllegalAccessException e) {
}
int cnt = 0;
if(iterator == null)
iterator = chunks.listIterator();
@@ -754,7 +821,15 @@ public class NewMapChunkCache implements MapChunkCache {
chunks_attempted++;
boolean wasLoaded = w.isChunkLoaded(chunk.x, chunk.z);
boolean didload = false;
boolean isunloadpending = unloadqueue.containsKey(chunk.x, chunk.z);
boolean isunloadpending = false;
if (queue != null) {
try {
isunloadpending = (Boolean)queuecontainskey.invoke(queue, chunk.x, chunk.z);
} catch (IllegalAccessException iax) {
} catch (IllegalArgumentException e) {
} catch (InvocationTargetException e) {
}
}
if (isunloadpending) { /* Workaround: can't be pending if not loaded */
wasLoaded = true;
}
@@ -856,6 +931,11 @@ public class NewMapChunkCache implements MapChunkCache {
* Test if done loading
*/
public boolean isDoneLoading() {
if(dw.isLoaded() == false) {
isempty = true;
unloadChunks();
return true;
}
if(iterator != null)
return !iterator.hasNext();
return false;
@@ -877,45 +957,6 @@ public class NewMapChunkCache implements MapChunkCache {
snaparray = null;
}
}
/**
* Get block ID at coordinates
*/
public int getBlockTypeID(int x, int y, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getBlockTypeId(x & 0xF, y, z & 0xF);
}
/**
* Get block data at coordiates
*/
public byte getBlockData(int x, int y, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return (byte)ss.getBlockData(x & 0xF, y, z & 0xF);
}
/* Get sky light level
*/
public int getBlockSkyLight(int x, int y, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getBlockSkyLight(x & 0xF, y, z & 0xF);
}
/* Get emitted light level
*/
public int getBlockEmittedLight(int x, int y, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getBlockEmittedLight(x & 0xF, y, z & 0xF);
}
public BiomeMap getBiome(int x, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
Biome b = ss.getBiome(x & 0xF, z & 0xF);
return (b != null)?biome_to_bmap[b.ordinal()]:null;
}
public double getRawBiomeTemperature(int x, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getRawBiomeTemperature(x & 0xF, z & 0xF);
}
public double getRawBiomeRainfall(int x, int z) {
ChunkSnapshot ss = snaparray[((x>>4) - x_min) + ((z>>4) - z_min) * x_dim];
return ss.getRawBiomeRainfall(x & 0xF, z & 0xF);
}
private void initSectionData(int idx) {
isSectionNotEmpty[idx] = new boolean[nsect + 1];
if(snaparray[idx] != EMPTY) {
@@ -9,6 +9,7 @@ import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import javax.imageio.ImageIO;
@@ -33,7 +34,29 @@ import org.getspout.spoutapi.material.MaterialData;
public class SpoutPluginBlocks {
private Field textXPosField; /* float[][] textXPos */
private Field textYPosField; /* float[][] textYPos */
private HashSet<String> plugins_pending = new HashSet<String>();
public SpoutPluginBlocks(Plugin plugin) {
/* First, see if any spout plugins that need to be enabled */
for(Plugin p : plugin.getServer().getPluginManager().getPlugins()) {
List<String> dep = p.getDescription().getDepend();
if((dep != null) && (dep.contains("Spout"))) {
Log.info("Found Spout plugin: " + p.getName());
if(p.isEnabled() == false) {
plugins_pending.add(p.getName());
}
}
}
}
public boolean isReady() {
return plugins_pending.isEmpty();
}
public void markPluginEnabled(Plugin p) {
plugins_pending.remove(p.getName());
}
private boolean initSpoutAccess() {
boolean success = false;
try {
@@ -73,17 +96,6 @@ public class SpoutPluginBlocks {
/* Process spout blocks - return true if something changed */
public boolean processSpoutBlocks(DynmapPlugin plugin, DynmapCore core) {
/* First, see if any spout plugins that need to be enabled */
for(Plugin p : plugin.getServer().getPluginManager().getPlugins()) {
List<String> dep = p.getDescription().getDepend();
if((dep != null) && (dep.contains("Spout"))) {
Log.info("Found Spout plugin: " + p.getName());
if(p.isEnabled() == false) {
plugin.getPluginLoader().enablePlugin(p);
}
}
}
File datadir = core.getDataFolder();
if(textYPosField == null) {
if(initSpoutAccess() == false)
-31
View File
@@ -218,37 +218,6 @@ skin-url: "http://s3.amazonaws.com/MinecraftSkins/%player%.png"
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
compass-mode: newnorth
### Mod block support ###
# Enable Industrial Craft 2 block rendering support (core, Advanced Machines, Charging Bench, Power Converters, Compact Solars, Nuclear Control)
#ic2-support: true
#ic2-advancesmachines-support: true
#ic2-chargingbench-support: true
#ic2-powerconverters-support: true
#ic2-compactsolars-support: true
#ic2-nuclearcontrol-support: true
# Enable BuildCraft block rendering support
#buildcraft-support: true
# Enable RedPower2 block rendering support
#redpower2-support: true
# Enable NetherOres block rendering support
#netherores-support: true
# Enable RailCraft block rendering support
#railcraft-support: true
# Enable Kaevator's Superslopes block rendering support
#superslopes-support: true
# Enabled ComputerCraft block rendering support
#computercraft-support: true
# Enabled LC Trees++ block rendering support
#lctrees-support: true
# Enable Forestry block rending support
#forestry-support: true
# Enable IronCheck block rendering support
#ironchest-support: true
# Enable TubeCraft block rendering support
#tubecraft-support: true
# Enable Ender Storage block rendering support
#enderstorage-support: true
render-triggers:
#- playermove
#- playerjoin