mirror of
https://github.com/encounter/dynmap.git
synced 2026-03-30 11:08:39 -07:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f6e52261c | |||
| a117987840 | |||
| cbb8cc061e | |||
| c03365d574 | |||
| 827f18b8e0 | |||
| 1603015631 | |||
| c2d97ba3d5 | |||
| 418b175923 | |||
| fdc14b413d | |||
| e6d509c3e6 | |||
| b10ec3a331 | |||
| 9f8617d81d | |||
| 265e037b74 | |||
| f50e73180c | |||
| aad4b64603 | |||
| aeeb09f600 | |||
| e73e88281c | |||
| fde3d14abd | |||
| 6cf60b3d53 | |||
| 9e29cb8e44 | |||
| fca05e399a | |||
| a6490743ca | |||
| 7da1051d5f | |||
| ddf14b7c3b | |||
| 38a4d869f6 | |||
| 905802e558 | |||
| 30db9c04b6 |
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>dynmap</artifactId>
|
||||
<version>0.60</version>
|
||||
<version>0.90</version>
|
||||
<name>dynmap</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -179,5 +179,10 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/PermissionsBukkit.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.2.5-R5.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
package org.dynmap.bukkit;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -7,10 +8,14 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import net.minecraft.server.ChunkProviderServer;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.util.LongHashset;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.dynmap.DynmapChunk;
|
||||
import org.dynmap.DynmapCore;
|
||||
@@ -19,7 +24,7 @@ import org.dynmap.Log;
|
||||
import org.dynmap.common.BiomeMap;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
import org.dynmap.utils.BlockStep;
|
||||
import org.getspout.spoutapi.block.SpoutChunk;
|
||||
|
||||
/**
|
||||
@@ -27,16 +32,12 @@ import org.getspout.spoutapi.block.SpoutChunk;
|
||||
*/
|
||||
public class NewMapChunkCache implements MapChunkCache {
|
||||
private static boolean init = false;
|
||||
private static Method poppreservedchunk = null;
|
||||
private static Method gethandle = null;
|
||||
private static Method removeentities = null;
|
||||
private static Method getworldhandle = null;
|
||||
private static boolean use_spout = false;
|
||||
private static boolean use_sections = false;
|
||||
private static Field unloadqueue = null;
|
||||
private static Method queuecontainskey = null;
|
||||
|
||||
private World w;
|
||||
private DynmapWorld dw;
|
||||
private Object craftworld;
|
||||
private int nsect;
|
||||
private List<DynmapChunk> chunks;
|
||||
private ListIterator<DynmapChunk> iterator;
|
||||
@@ -661,41 +662,25 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
/**
|
||||
* Construct empty cache
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public NewMapChunkCache() {
|
||||
if(!init) {
|
||||
/* Get CraftWorld.popPreservedChunk(x,z) - reduces memory bloat from map traversals (optional) */
|
||||
try {
|
||||
Class c = Class.forName("org.bukkit.craftbukkit.CraftWorld");
|
||||
poppreservedchunk = c.getDeclaredMethod("popPreservedChunk", new Class[] { int.class, int.class });
|
||||
/* getHandle() */
|
||||
getworldhandle = c.getDeclaredMethod("getHandle", new Class[0]);
|
||||
} catch (ClassNotFoundException cnfx) {
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
}
|
||||
/* Get CraftChunk.getChunkSnapshot(boolean,boolean,boolean) and CraftChunk.getHandle() */
|
||||
try {
|
||||
Class c = Class.forName("org.bukkit.craftbukkit.CraftChunk");
|
||||
gethandle = c.getDeclaredMethod("getHandle", new Class[0]);
|
||||
} catch (ClassNotFoundException cnfx) {
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
}
|
||||
/* Get Chunk.removeEntities() */
|
||||
try {
|
||||
Class c = Class.forName("net.minecraft.server.Chunk");
|
||||
removeentities = c.getDeclaredMethod("removeEntities", new Class[0]);
|
||||
} catch (ClassNotFoundException cnfx) {
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
}
|
||||
/* Check for ChunkSnapshot.isSectionEmpty(int) method */
|
||||
try {
|
||||
ChunkSnapshot.class.getDeclaredMethod("isSectionEmpty", new Class[] { int.class });
|
||||
use_sections = true;
|
||||
} catch (NoSuchMethodException nsmx) {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
}
|
||||
@@ -703,12 +688,6 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
this.dw = dw;
|
||||
this.w = dw.getWorld();
|
||||
nsect = dw.worldheight >> 4;
|
||||
if((getworldhandle != null) && (craftworld == null)) {
|
||||
try {
|
||||
craftworld = getworldhandle.invoke(w); /* World.getHandle() */
|
||||
} catch (Exception x) {
|
||||
}
|
||||
}
|
||||
this.chunks = chunks;
|
||||
/* Compute range */
|
||||
if(chunks.size() == 0) {
|
||||
@@ -751,6 +730,15 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
|
||||
public int loadChunks(int max_to_load) {
|
||||
long t0 = System.nanoTime();
|
||||
CraftWorld cw = (CraftWorld)w;
|
||||
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();
|
||||
@@ -795,8 +783,25 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
chunks_attempted++;
|
||||
boolean wasLoaded = w.isChunkLoaded(chunk.x, chunk.z);
|
||||
boolean didload = false;
|
||||
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;
|
||||
}
|
||||
try {
|
||||
didload = w.loadChunk(chunk.x, chunk.z, false);
|
||||
if (!wasLoaded) {
|
||||
didload = w.loadChunk(chunk.x, chunk.z, false);
|
||||
}
|
||||
else { /* If already was loaded, no need to load */
|
||||
didload = true;
|
||||
}
|
||||
} catch (Throwable t) { /* Catch chunk error from Bukkit */
|
||||
Log.warning("Bukkit error loading chunk " + chunk.x + "," + chunk.z + " on " + w.getName());
|
||||
if(!wasLoaded) { /* If wasn't loaded, we loaded it if it now is */
|
||||
@@ -809,6 +814,17 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
didgenerate = didload = w.loadChunk(chunk.x, chunk.z, true);
|
||||
/* If it did load, make cache of it */
|
||||
if(didload) {
|
||||
Chunk c = w.getChunkAt(chunk.x, chunk.z); /* Get the chunk */
|
||||
/* Test if chunk isn't populated */
|
||||
boolean populated = true;
|
||||
//TODO: figure out why this doesn't appear to be reliable in Bukkit
|
||||
//if((nmschunk != null) && (doneflag != null)) {
|
||||
// try {
|
||||
// populated = doneflag.getBoolean(nmschunk);
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// } catch (IllegalAccessException e) {
|
||||
// }
|
||||
//}
|
||||
if(!vis) {
|
||||
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
|
||||
ss = STONE;
|
||||
@@ -817,8 +833,10 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
else
|
||||
ss = EMPTY;
|
||||
}
|
||||
else if(!populated) { /* If not populated, treat as empty */
|
||||
ss = EMPTY;
|
||||
}
|
||||
else {
|
||||
Chunk c = w.getChunkAt(chunk.x, chunk.z);
|
||||
if(blockdata || highesty) {
|
||||
ss = c.getChunkSnapshot(highesty, biome, biomeraw);
|
||||
if(use_spout) {
|
||||
@@ -832,46 +850,25 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
}
|
||||
}
|
||||
snaparray[(chunk.x-x_min) + (chunk.z - z_min)*x_dim] = ss;
|
||||
}
|
||||
if ((!wasLoaded) && didload) {
|
||||
chunks_read++;
|
||||
/* It looks like bukkit "leaks" entities - they don't get removed from the world-level table
|
||||
* when chunks are unloaded but not saved - removing them seems to do the trick */
|
||||
if(!(didgenerate && do_save)) {
|
||||
boolean did_remove = false;
|
||||
Chunk cc = w.getChunkAt(chunk.x, chunk.z);
|
||||
if((gethandle != null) && (removeentities != null)) {
|
||||
try {
|
||||
Object chk = gethandle.invoke(cc);
|
||||
if(chk != null) {
|
||||
removeentities.invoke(chk);
|
||||
did_remove = true;
|
||||
}
|
||||
} catch (InvocationTargetException itx) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
}
|
||||
if(!did_remove) {
|
||||
if(cc != null) {
|
||||
for(Entity e: cc.getEntities())
|
||||
e.remove();
|
||||
}
|
||||
/* If wasn't loaded before, we need to do unload */
|
||||
if (!wasLoaded) {
|
||||
chunks_read++;
|
||||
/* It looks like bukkit "leaks" entities - they don't get removed from the world-level table
|
||||
* when chunks are unloaded but not saved - removing them seems to do the trick */
|
||||
if(!(didgenerate && do_save)) {
|
||||
CraftChunk cc = (CraftChunk)c;
|
||||
cc.getHandle().removeEntities();
|
||||
}
|
||||
/* Since we only remember ones we loaded, and we're synchronous, no player has
|
||||
* moved, so it must be safe (also prevent chunk leak, which appears to happen
|
||||
* because isChunkInUse defined "in use" as being within 256 blocks of a player,
|
||||
* while the actual in-use chunk area for a player where the chunks are managed
|
||||
* by the MC base server is 21x21 (or about a 160 block radius).
|
||||
* Also, if we did generate it, need to save it */
|
||||
w.unloadChunk(chunk.x, chunk.z, didgenerate && do_save, false);
|
||||
}
|
||||
/* Since we only remember ones we loaded, and we're synchronous, no player has
|
||||
* moved, so it must be safe (also prevent chunk leak, which appears to happen
|
||||
* because isChunkInUse defined "in use" as being within 256 blocks of a player,
|
||||
* while the actual in-use chunk area for a player where the chunks are managed
|
||||
* by the MC base server is 21x21 (or about a 160 block radius).
|
||||
* Also, if we did generate it, need to save it */
|
||||
w.unloadChunk(chunk.x, chunk.z, didgenerate && do_save, false);
|
||||
/* And pop preserved chunk - this is a bad leak in Bukkit for map traversals like us */
|
||||
try {
|
||||
if(poppreservedchunk != null)
|
||||
poppreservedchunk.invoke(w, chunk.x, chunk.z);
|
||||
} catch (Exception x) {
|
||||
Log.severe("Cannot pop preserved chunk - " + x.toString());
|
||||
else if (isunloadpending) { /* Else, if loaded and unload is pending */
|
||||
w.unloadChunkRequest(chunk.x, chunk.z); /* Request new unload */
|
||||
}
|
||||
}
|
||||
cnt++;
|
||||
@@ -917,56 +914,12 @@ 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) {
|
||||
if(!use_sections) {
|
||||
Arrays.fill(isSectionNotEmpty[idx], true);
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < nsect; i++) {
|
||||
if(snaparray[idx].isSectionEmpty(i) == false) {
|
||||
isSectionNotEmpty[idx][i] = true;
|
||||
}
|
||||
for(int i = 0; i < nsect; i++) {
|
||||
if(snaparray[idx].isSectionEmpty(i) == false) {
|
||||
isSectionNotEmpty[idx][i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1082,8 +1035,8 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
static {
|
||||
Biome[] b = Biome.values();
|
||||
BiomeMap[] bm = BiomeMap.values();
|
||||
biome_to_bmap = new BiomeMap[b.length];
|
||||
for(int i = 0; i < b.length; i++) {
|
||||
biome_to_bmap = new BiomeMap[256];
|
||||
for(int i = 0; i < biome_to_bmap.length; i++) {
|
||||
biome_to_bmap[i] = BiomeMap.NULL;
|
||||
}
|
||||
for(int i = 0; i < b.length; i++) {
|
||||
|
||||
@@ -9,11 +9,14 @@ 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;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.Log;
|
||||
import org.getspout.spoutapi.block.design.BlockDesign;
|
||||
import org.getspout.spoutapi.block.design.GenericBlockDesign;
|
||||
@@ -31,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 {
|
||||
@@ -53,13 +78,31 @@ public class SpoutPluginBlocks {
|
||||
sb.append("block:id=" + blk.getCustomId() + ",allfaces=12049,transparency=TRANSPARENT\n");
|
||||
}
|
||||
|
||||
private static String fixIDString(String id) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len = id.length();
|
||||
sb.setLength(len);
|
||||
for(int i = 0; i < len; i++) {
|
||||
char c = id.charAt(i);
|
||||
if(Character.isJavaIdentifierStart(c)) {
|
||||
sb.setCharAt(i, c);
|
||||
}
|
||||
else {
|
||||
sb.setCharAt(i, '_');
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/* Process spout blocks - return true if something changed */
|
||||
public boolean processSpoutBlocks(File datadir) {
|
||||
public boolean processSpoutBlocks(DynmapPlugin plugin, DynmapCore core) {
|
||||
File datadir = core.getDataFolder();
|
||||
if(textYPosField == null) {
|
||||
if(initSpoutAccess() == false)
|
||||
return false;
|
||||
}
|
||||
HashMap<String, String> texturelist = new HashMap<String, String>();
|
||||
boolean use_existing_texture = core.configuration.getBoolean("spout/use-existing-textures", true);
|
||||
|
||||
int cnt = 0;
|
||||
File f = new File(datadir, "texturepacks/standard/spout");
|
||||
@@ -72,8 +115,7 @@ public class SpoutPluginBlocks {
|
||||
/* Loop through blocks - try to freshen files, if needed */
|
||||
for(CustomBlock b : cb) {
|
||||
BlockDesign bd = b.getBlockDesign();
|
||||
String blkid = bd.getTexturePlugin() + "." + b.getName();
|
||||
blkid = blkid.replace(' ', '_');
|
||||
String blkid = bd.getTexturePlugin() + "." + fixIDString(b.getName());
|
||||
/* If not GenericCubiodBlockDesign, we don't handle it */
|
||||
if((bd instanceof GenericCuboidBlockDesign) == false) {
|
||||
Log.info("Block " + blkid + " not suppored - only cubiod blocks");
|
||||
@@ -110,53 +152,59 @@ public class SpoutPluginBlocks {
|
||||
String txtid = texturelist.get(txname); /* Get texture */
|
||||
if(txtid == null) { /* Not found yet */
|
||||
File imgfile = new File(f, blkid + ".png");
|
||||
BufferedImage img = null;
|
||||
boolean urlloaded = false;
|
||||
try {
|
||||
URL url = new URL(txname);
|
||||
img = ImageIO.read(url); /* Load skin for player */
|
||||
urlloaded = true;
|
||||
} catch (IOException iox) {
|
||||
if(txname.startsWith("http") == false) { /* Not URL - try file */
|
||||
File tf = new File(txname);
|
||||
if(tf.exists() == false) {
|
||||
/* Horrible hack - try to find temp file (some SpoutMaterials versions) */
|
||||
try {
|
||||
File tmpf = File.createTempFile("dynmap", "test");
|
||||
|
||||
tf = new File(tmpf.getParent(), txname);
|
||||
tmpf.delete();
|
||||
} catch (IOException iox2) {}
|
||||
|
||||
/* If not reusing loaded textures OR not previously loaded */
|
||||
if((!use_existing_texture) || (!imgfile.exists())) {
|
||||
BufferedImage img = null;
|
||||
boolean urlloaded = false;
|
||||
try {
|
||||
URL url = new URL(txname);
|
||||
img = ImageIO.read(url); /* Load skin for player */
|
||||
urlloaded = true;
|
||||
} catch (IOException iox) {
|
||||
if(txname.startsWith("http") == false) { /* Not URL - try file */
|
||||
File tf = new File(txname);
|
||||
if(tf.exists() == false) {
|
||||
/* Horrible hack - try to find temp file (some SpoutMaterials versions) */
|
||||
try {
|
||||
File tmpf = File.createTempFile("dynmap", "test");
|
||||
|
||||
tf = new File(tmpf.getParent(), txname);
|
||||
tmpf.delete();
|
||||
} catch (IOException iox2) {}
|
||||
}
|
||||
if(tf.exists()) {
|
||||
try {
|
||||
img = ImageIO.read(tf);
|
||||
urlloaded = true;
|
||||
} catch (IOException iox3) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tf.exists()) {
|
||||
try {
|
||||
img = ImageIO.read(tf);
|
||||
urlloaded = true;
|
||||
} catch (IOException iox3) {
|
||||
if(img == null) {
|
||||
Log.severe("Error loading texture for custom block '" + blkid + "' (" + b.getCustomId() + ") from " + txname + "(" + iox.getMessage() + ")");
|
||||
if(imgfile.exists()) {
|
||||
try {
|
||||
img = ImageIO.read(imgfile); /* Load existing */
|
||||
Log.info("Loaded cached texture file for " + blkid);
|
||||
} catch (IOException iox2) {
|
||||
Log.severe("Error loading cached texture file for " + blkid + " - " + iox2.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(img == null) {
|
||||
Log.severe("Error loading texture for custom block '" + blkid + "' (" + b.getCustomId() + ") from " + txname + "(" + iox.getMessage() + ")");
|
||||
if(imgfile.exists()) {
|
||||
try {
|
||||
img = ImageIO.read(imgfile); /* Load existing */
|
||||
Log.info("Loaded cached texture file for " + blkid);
|
||||
} catch (IOException iox2) {
|
||||
Log.severe("Error loading cached texture file for " + blkid + " - " + iox2.getMessage());
|
||||
}
|
||||
if(img != null) {
|
||||
try {
|
||||
if(urlloaded)
|
||||
ImageIO.write(img, "png", imgfile);
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error writing " + blkid + ".png");
|
||||
} finally {
|
||||
img.flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(img != null) {
|
||||
try {
|
||||
if(urlloaded)
|
||||
ImageIO.write(img, "png", imgfile);
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error writing " + blkid + ".png");
|
||||
} finally {
|
||||
img.flush();
|
||||
}
|
||||
if(imgfile.exists()) { /* If exists now, log it */
|
||||
String tfid = "txtid" + texturelist.size();
|
||||
sb.append("texturefile:id=" + tfid + ",filename=spout/" + blkid + ".png,xcount=" + w/sz + ",ycount=" + h/sz + "\n");
|
||||
texturelist.put(txname, tfid);
|
||||
|
||||
@@ -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
|
||||
@@ -377,6 +346,15 @@ url:
|
||||
# markers base URL
|
||||
#markers: "tiles/"
|
||||
|
||||
# Spout support controls
|
||||
spout:
|
||||
# If false, ignore spout even if detected
|
||||
enabled: true
|
||||
# If true, previously loaded textures will be assumed to still be valid (faster startup, but
|
||||
# can result in stale textures if originals are updated - delete files in texturepacks/standard/spoout
|
||||
# to clean cached textures and force reload on next startup)
|
||||
use-existing-textures: true
|
||||
|
||||
# Set to true to enable verbose startup messages - can help with debugging map configuration problems
|
||||
# Set to false for a much quieter startup log
|
||||
verbose: false
|
||||
|
||||
@@ -2,7 +2,7 @@ name: dynmap
|
||||
main: org.dynmap.bukkit.DynmapPlugin
|
||||
version: "${project.version}-${BUILD_NUMBER}"
|
||||
authors: [FrozenCow, mikeprimm]
|
||||
softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit, SpoutMaterials ]
|
||||
softdepend: [ Permissions, PermissionEx, bPermissions, PermissionsBukkit ]
|
||||
commands:
|
||||
dynmap:
|
||||
description: Controls Dynmap.
|
||||
|
||||
Reference in New Issue
Block a user