mirror of
https://github.com/encounter/dynmap.git
synced 2026-03-30 11:08:39 -07:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d1ab180c4 | |||
| 4c51080129 | |||
| 809866248c | |||
| 2b5fcd4c2e |
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>dynmap</artifactId>
|
||||
<version>0.22</version>
|
||||
<version>0.21.1</version>
|
||||
<name>dynmap</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -13,24 +13,6 @@
|
||||
<url>https://github.com/FrozenCow/dynmap/issues</url>
|
||||
</issueManagement>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
<include>*.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<excludes>
|
||||
<exclude>*.yml</exclude>
|
||||
<exclude>*.txt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -15,20 +15,9 @@
|
||||
<include>CHANGELOG*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/web/</directory>
|
||||
<outputDirectory>/dynmap/web/</outputDirectory>
|
||||
<includes>
|
||||
<include>version.js</include>
|
||||
</includes>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/web</directory>
|
||||
<outputDirectory>/dynmap/web</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>version.js</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/colorschemes</directory>
|
||||
@@ -43,9 +32,7 @@
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<destName>dynmap.jar</destName>
|
||||
</file>
|
||||
</files>
|
||||
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<destName>dynmap.jar</destName></file></files>
|
||||
</assembly>
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.dynmap.markers.Marker;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
import org.json.simple.JSONAware;
|
||||
import org.json.simple.JSONStreamAware;
|
||||
|
||||
@@ -79,8 +77,4 @@ public class Client {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentMessage extends Update {
|
||||
public String type = "component";
|
||||
/* Each subclass must provide 'ctype' string for component 'type' */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ public class ClientConfigurationComponent extends Component {
|
||||
s(t, "spammessage", c.getString("spammessage", "You may only chat once every %interval% seconds."));
|
||||
s(t, "webprefix", unescapeString(c.getString("webprefix", "[WEB] ")));
|
||||
s(t, "defaultzoom", c.getInteger("defaultzoom", 0));
|
||||
s(t, "sidebaropened", c.getString("sidebaropened", "false"));
|
||||
s(t, "dynmapversion", plugin.getDescription().getVersion());
|
||||
s(t, "sidebaropened", c.getBoolean("sidebaropened", false));
|
||||
|
||||
DynmapWorld defaultWorld = null;
|
||||
String defmap = null;
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
@@ -50,7 +49,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkPopulateEvent;
|
||||
import org.bukkit.event.world.SpawnChangeEvent;
|
||||
import org.bukkit.event.world.WorldListener;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -61,8 +59,6 @@ import org.dynmap.debug.Debug;
|
||||
import org.dynmap.debug.Debugger;
|
||||
import org.dynmap.hdmap.HDBlockModels;
|
||||
import org.dynmap.hdmap.TexturePack;
|
||||
import org.dynmap.markers.MarkerAPI;
|
||||
import org.dynmap.markers.impl.MarkerAPIImpl;
|
||||
import org.dynmap.permissions.BukkitPermissions;
|
||||
import org.dynmap.permissions.NijikokunPermissions;
|
||||
import org.dynmap.permissions.OpPermissions;
|
||||
@@ -89,8 +85,6 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
|
||||
private HashMap<Event.Type, List<Listener>> event_handlers = new HashMap<Event.Type, List<Listener>>();
|
||||
|
||||
private MarkerAPIImpl markerapi;
|
||||
|
||||
public static File dataDirectory;
|
||||
public static File tilesDirectory;
|
||||
|
||||
@@ -214,7 +208,6 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
permissions = new OpPermissions(new String[] { "fullrender", "cancelrender", "radiusrender", "resetstats", "reload" });
|
||||
|
||||
dataDirectory = this.getDataFolder();
|
||||
|
||||
/* Load block models */
|
||||
HDBlockModels.loadModels(dataDirectory);
|
||||
/* Load texture mappings */
|
||||
@@ -285,11 +278,11 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
if (!configuration.getBoolean("disable-webserver", false)) {
|
||||
startWebserver();
|
||||
}
|
||||
|
||||
|
||||
/* Print version info */
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
Log.info("version " + pdfFile.getVersion() + " is enabled" );
|
||||
|
||||
|
||||
events.<Object>trigger("initialized", null);
|
||||
}
|
||||
|
||||
@@ -310,19 +303,6 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
boolean checkbannedips = configuration.getBoolean("check-banned-ips", true);
|
||||
int maxconnections = configuration.getInteger("max-sessions", 30);
|
||||
if(maxconnections < 2) maxconnections = 2;
|
||||
/* Load customized response headers, if any */
|
||||
ConfigurationNode custhttp = configuration.getNode("http-response-headers");
|
||||
HashMap<String, String> custhdrs = new HashMap<String,String>();
|
||||
if(custhttp != null) {
|
||||
for(String k : custhttp.keySet()) {
|
||||
String v = custhttp.getString(k);
|
||||
if(v != null) {
|
||||
custhdrs.put(k, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
HttpServer.setCustomHeaders(custhdrs);
|
||||
|
||||
if(allow_symlinks)
|
||||
Log.verboseinfo("Web server is permitting symbolic links");
|
||||
else
|
||||
@@ -367,10 +347,7 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
ll.clear(); /* Empty list - we use presence of list to remember that we've registered with Bukkit */
|
||||
}
|
||||
playerfacemgr = null;
|
||||
if(markerapi != null) {
|
||||
markerapi.cleanup(this);
|
||||
markerapi = null;
|
||||
}
|
||||
|
||||
Debug.clearDebuggers();
|
||||
}
|
||||
|
||||
@@ -650,9 +627,6 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
if(cmd.getName().equalsIgnoreCase("dmarker")) {
|
||||
return MarkerAPIImpl.onCommand(this, sender, cmd, commandLabel, args);
|
||||
}
|
||||
if (!cmd.getName().equalsIgnoreCase("dynmap"))
|
||||
return false;
|
||||
Player player = null;
|
||||
@@ -781,7 +755,7 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkPlayerPermission(CommandSender sender, String permission) {
|
||||
private boolean checkPlayerPermission(CommandSender sender, String permission) {
|
||||
if (!(sender instanceof Player) || sender.isOp()) {
|
||||
return true;
|
||||
} else if (!permissions.has(sender, permission.toLowerCase())) {
|
||||
@@ -1099,16 +1073,6 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSpawnChange(SpawnChangeEvent event) {
|
||||
/* Call listeners */
|
||||
List<Listener> ll = event_handlers.get(event.getType());
|
||||
if(ll != null) {
|
||||
for(Listener l : ll) {
|
||||
((WorldListener)l).onSpawnChange(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private CustomEventListener ourCustomEventHandler = new CustomEventListener() {
|
||||
@@ -1164,12 +1128,11 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
case BLOCK_SPREAD:
|
||||
case BLOCK_PISTON_EXTEND:
|
||||
case BLOCK_PISTON_RETRACT:
|
||||
pm.registerEvent(type, ourBlockEventHandler, Event.Priority.Monitor, this);
|
||||
pm.registerEvent(type, ourBlockEventHandler, Event.Priority.Monitor, this);
|
||||
break;
|
||||
case WORLD_LOAD:
|
||||
case CHUNK_LOAD:
|
||||
case CHUNK_POPULATED:
|
||||
case SPAWN_CHANGE:
|
||||
pm.registerEvent(type, ourWorldEventHandler, Event.Priority.Monitor, this);
|
||||
break;
|
||||
case CUSTOM_EVENT:
|
||||
@@ -1187,24 +1150,4 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
}
|
||||
ll.add(listener);
|
||||
}
|
||||
/**
|
||||
* ** This is the public API for other plugins to use for accessing the Marker API **
|
||||
* This method can return null if the 'markers' component has not been configured -
|
||||
* a warning message will be issued to the server.log in this event.
|
||||
*
|
||||
* @return MarkerAPI, or null if not configured
|
||||
*/
|
||||
public MarkerAPI getMarkerAPI() {
|
||||
if(markerapi == null) {
|
||||
Log.warning("Marker API has been requested, but is not enabled. Uncomment or add 'markers' component to configuration.txt.");
|
||||
}
|
||||
return markerapi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register markers API - used by component to supply marker API to plugin
|
||||
*/
|
||||
public void registerMarkerAPI(MarkerAPIImpl api) {
|
||||
markerapi = api;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package org.dynmap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Location;
|
||||
import org.dynmap.MapType.ImageFormat;
|
||||
import org.dynmap.debug.Debug;
|
||||
import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.FileLockManager;
|
||||
@@ -153,7 +151,6 @@ public class DynmapWorld {
|
||||
boolean neg_step_y;
|
||||
String baseprefix;
|
||||
int zoomlevel;
|
||||
int background;
|
||||
String zoomprefix;
|
||||
String fnprefix;
|
||||
String zfnprefix;
|
||||
@@ -236,7 +233,7 @@ public class DynmapWorld {
|
||||
/* If level is above top needed for this map, skip */
|
||||
if(zoomlevel > (this.extrazoomoutlevels + mt.getMapZoomOutLevels()))
|
||||
continue;
|
||||
List<MapType.ZoomInfo> pfx = mt.baseZoomFileInfo();
|
||||
List<String> pfx = mt.baseZoomFilePrefixes();
|
||||
int stepsize = mt.baseZoomFileStepSize();
|
||||
int bigworldshift = mt.getBigWorldShift();
|
||||
boolean neg_step_x = false;
|
||||
@@ -255,14 +252,13 @@ public class DynmapWorld {
|
||||
break;
|
||||
}
|
||||
int[] stepseq = mt.zoomFileStepSequence();
|
||||
for(MapType.ZoomInfo p : pfx) {
|
||||
for(String p : pfx) {
|
||||
PrefixData pd = new PrefixData();
|
||||
pd.stepsize = stepsize;
|
||||
pd.neg_step_x = neg_step_x;
|
||||
pd.neg_step_y = neg_step_y;
|
||||
pd.stepseq = stepseq;
|
||||
pd.baseprefix = p.prefix;
|
||||
pd.background = p.background_argb;
|
||||
pd.baseprefix = p;
|
||||
pd.zoomlevel = zoomlevel;
|
||||
pd.zoomprefix = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz".substring(0, zoomlevel);
|
||||
pd.bigworldshift = bigworldshift;
|
||||
@@ -283,7 +279,7 @@ public class DynmapWorld {
|
||||
pd.zfnprefix = "z" + pd.fnprefix;
|
||||
}
|
||||
|
||||
maptab.put(p.prefix, pd);
|
||||
maptab.put(p, pd);
|
||||
}
|
||||
}
|
||||
return maptab;
|
||||
@@ -434,16 +430,6 @@ public class DynmapWorld {
|
||||
/* blit scaled rendered tile onto zoom-out tile */
|
||||
zIm.setRGB(((i>>1) != 0)?0:width/2, (i & 1) * height/2, width/2, height/2, argb, 0, width);
|
||||
}
|
||||
else if((pd.background != 0) && (pd.fmt != ImageFormat.FORMAT_PNG)) {
|
||||
Arrays.fill(argb, pd.background);
|
||||
/* blit scaled rendered tile onto zoom-out tile */
|
||||
zIm.setRGB(((i>>1) != 0)?0:width/2, (i & 1) * height/2, width/2, height/2, argb, 0, width);
|
||||
}
|
||||
}
|
||||
else if((pd.background != 0) && (pd.fmt != ImageFormat.FORMAT_PNG)) {
|
||||
Arrays.fill(argb, pd.background);
|
||||
/* blit scaled rendered tile onto zoom-out tile */
|
||||
zIm.setRGB(((i>>1) != 0)?0:width/2, (i & 1) * height/2, width/2, height/2, argb, 0, width);
|
||||
}
|
||||
}
|
||||
FileLockManager.getWriteLock(zf);
|
||||
|
||||
@@ -268,15 +268,12 @@ public class MapManager {
|
||||
activemaplist = map.getMapNamesSharingRender(world);
|
||||
/* Build active map list */
|
||||
activemaps = "";
|
||||
if(mapname != null) {
|
||||
activemaps = mapname;
|
||||
}
|
||||
else {
|
||||
for(String n : activemaplist) {
|
||||
if(activemaps.length() > 0)
|
||||
activemaps += ",";
|
||||
activemaps += n;
|
||||
}
|
||||
for(String n : activemaplist) {
|
||||
if((mapname != null) && (!mapname.equals(n)))
|
||||
continue;
|
||||
if(activemaps.length() > 0)
|
||||
activemaps += ",";
|
||||
activemaps += n;
|
||||
}
|
||||
/* Mark all the concurrently rendering maps rendered */
|
||||
renderedmaps.addAll(map.getMapsSharingRender(world));
|
||||
@@ -793,8 +790,7 @@ public class MapManager {
|
||||
|
||||
public void pushUpdate(String worldName, Object update) {
|
||||
DynmapWorld world = getWorld(worldName);
|
||||
if(world != null)
|
||||
world.updates.pushUpdate(update);
|
||||
world.updates.pushUpdate(update);
|
||||
}
|
||||
|
||||
public Object[] getWorldUpdates(String worldName, long since) {
|
||||
|
||||
@@ -28,12 +28,6 @@ public abstract class MapType {
|
||||
public String getFileExt() { return ext; }
|
||||
public float getQuality() { return qual; }
|
||||
};
|
||||
|
||||
public static class ZoomInfo {
|
||||
public String prefix;
|
||||
public int background_argb;
|
||||
public ZoomInfo(String pre, int bg) { prefix = pre; background_argb = bg; }
|
||||
}
|
||||
|
||||
public abstract MapTile[] getTiles(Location l);
|
||||
|
||||
@@ -60,7 +54,7 @@ public abstract class MapType {
|
||||
X_MINUS_Y_MINUS
|
||||
}
|
||||
public abstract MapStep zoomFileMapStep();
|
||||
public abstract List<ZoomInfo> baseZoomFileInfo();
|
||||
public abstract List<String> baseZoomFilePrefixes();
|
||||
public abstract int baseZoomFileStepSize();
|
||||
/* How many bits of coordinate are shifted off to make big world directory name */
|
||||
public abstract int getBigWorldShift();
|
||||
@@ -70,11 +64,7 @@ public abstract class MapType {
|
||||
public int getMapZoomOutLevels() { return 0; }
|
||||
|
||||
public ImageFormat getImageFormat() { return ImageFormat.FORMAT_PNG; }
|
||||
|
||||
public int getBackgroundARGBNight() { return 0; }
|
||||
|
||||
public int getBackgroundARGBDay() { return 0; }
|
||||
|
||||
|
||||
/**
|
||||
* Step sequence for creating zoomed file: first index is top-left, second top-right, third bottom-left, forth bottom-right
|
||||
* Values correspond to tile X,Y (0), X+step,Y (1), X,Y+step (2), X+step,Y+step (3)
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
package org.dynmap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.world.SpawnChangeEvent;
|
||||
import org.bukkit.event.world.WorldListener;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.dynmap.markers.Marker;
|
||||
import org.dynmap.markers.MarkerIcon;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
import org.dynmap.markers.impl.MarkerAPIImpl;
|
||||
import org.dynmap.markers.impl.MarkerSignManager;
|
||||
|
||||
/**
|
||||
* Markers component - ties in the component system, both on the server and client
|
||||
*/
|
||||
public class MarkersComponent extends ClientComponent {
|
||||
private MarkerAPIImpl api;
|
||||
private MarkerSignManager signmgr;
|
||||
private MarkerIcon spawnicon;
|
||||
private String spawnlbl;
|
||||
|
||||
public MarkersComponent(DynmapPlugin plugin, ConfigurationNode configuration) {
|
||||
super(plugin, configuration);
|
||||
/* Register API with plugin */
|
||||
api = MarkerAPIImpl.initializeMarkerAPI(plugin);
|
||||
plugin.registerMarkerAPI(api);
|
||||
/* If configuration has enabled sign support, prime it too */
|
||||
if(configuration.getBoolean("enablesigns", false)) {
|
||||
signmgr = MarkerSignManager.initializeSignManager(plugin);
|
||||
}
|
||||
/* If we're posting spawn point markers, initialize and add world listener */
|
||||
if(configuration.getBoolean("showspawn", false)) {
|
||||
String ico = configuration.getString("spawnicon", MarkerIcon.WORLD);
|
||||
spawnlbl = configuration.getString("spawnlabel", "Spawn");
|
||||
spawnicon = api.getMarkerIcon(ico); /* Load it */
|
||||
if(spawnicon == null) {
|
||||
spawnicon = api.getMarkerIcon(MarkerIcon.WORLD);
|
||||
}
|
||||
WorldListener wl = new WorldListener() {
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
World w = event.getWorld(); /* Get the world */
|
||||
Location loc = w.getSpawnLocation(); /* Get location of spawn */
|
||||
if(loc != null)
|
||||
addUpdateWorld(w, loc);
|
||||
}
|
||||
public void onSpawnChange(SpawnChangeEvent event) {
|
||||
World w = event.getWorld(); /* Get the world */
|
||||
Location loc = w.getSpawnLocation(); /* Get location of spawn */
|
||||
if(loc != null)
|
||||
addUpdateWorld(w, loc);
|
||||
}
|
||||
};
|
||||
plugin.registerEvent(org.bukkit.event.Event.Type.WORLD_LOAD, wl);
|
||||
plugin.registerEvent(org.bukkit.event.Event.Type.SPAWN_CHANGE, wl);
|
||||
/* Initialize already loaded worlds */
|
||||
for(DynmapWorld w : plugin.getMapManager().getWorlds()) {
|
||||
World world = w.world;
|
||||
Location loc = world.getSpawnLocation();
|
||||
if(loc != null)
|
||||
addUpdateWorld(world, loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addUpdateWorld(World w, Location loc) {
|
||||
MarkerSet ms = api.getMarkerSet(MarkerSet.DEFAULT);
|
||||
if(ms != null) {
|
||||
String spawnid = "_spawn_" + w.getName();
|
||||
Marker m = ms.findMarker(spawnid); /* See if defined */
|
||||
if(m == null) { /* Not defined yet, add it */
|
||||
ms.createMarker(spawnid, spawnlbl, w.getName(), loc.getX(), loc.getY(), loc.getZ(),
|
||||
spawnicon, false);
|
||||
}
|
||||
else {
|
||||
m.setLocation(w.getName(), loc.getX(), loc.getY(), loc.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if(signmgr != null) {
|
||||
MarkerSignManager.terminateSignManager(this.plugin);
|
||||
signmgr = null;
|
||||
}
|
||||
if(api != null) {
|
||||
/* Clean up API registered with plugin */
|
||||
plugin.registerMarkerAPI(null);
|
||||
api.cleanup(this.plugin);
|
||||
api = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,21 +56,16 @@ public class PlayerFaces {
|
||||
int[] faceaccessory = new int[64]; /* 8x8 of face accessory */
|
||||
/* Get buffered image for face at 8x8 */
|
||||
DynmapBufferedImage face8x8 = DynmapBufferedImage.allocateBufferedImage(8, 8);
|
||||
int[] bgcolor = new int[1];
|
||||
img.getRGB(0, 0, 1, 1, bgcolor, 0, 1); /* Get BG color (for accessory face) */
|
||||
img.getRGB(8, 8, 8, 8, face8x8.argb_buf, 0, 8); /* Read face from image */
|
||||
img.getRGB(40, 8, 8, 8, faceaccessory, 0, 8); /* Read face accessory from image */
|
||||
/* Apply accessory to face: see if anything is transparent (if so, apply accessory */
|
||||
boolean transp = false;
|
||||
/* Apply accessory to face: first element is transparency color so only ones not matching it */
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if((faceaccessory[i] & 0xFF000000) == 0) {
|
||||
transp = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(transp) {
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if((faceaccessory[i] & 0xFF000000) != 0)
|
||||
face8x8.argb_buf[i] = faceaccessory[i];
|
||||
}
|
||||
if(faceaccessory[i] != bgcolor[0])
|
||||
face8x8.argb_buf[i] = faceaccessory[i];
|
||||
else if(face8x8.argb_buf[i] == bgcolor[0])
|
||||
face8x8.argb_buf[i] = 0;
|
||||
}
|
||||
/* Write 8x8 file */
|
||||
File img_8x8 = new File(faces8x8dir, playername + ".png");
|
||||
|
||||
@@ -454,11 +454,11 @@ public class FlatMap extends MapType {
|
||||
return Collections.singletonList(name);
|
||||
}
|
||||
|
||||
public List<ZoomInfo> baseZoomFileInfo() {
|
||||
ArrayList<ZoomInfo> s = new ArrayList<ZoomInfo>();
|
||||
s.add(new ZoomInfo(getPrefix() + "_128", 0));
|
||||
public List<String> baseZoomFilePrefixes() {
|
||||
ArrayList<String> s = new ArrayList<String>();
|
||||
s.add(getPrefix() + "_128");
|
||||
if(night_and_day)
|
||||
s.add(new ZoomInfo(getPrefix()+"_day_128", 0));
|
||||
s.add(getPrefix()+"_day_128");
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ public class HDBlockModels {
|
||||
public static class HDScaledBlockModels {
|
||||
private short[][][] modelvectors;
|
||||
|
||||
public final short[] getScaledModel(int blocktype, int blockdata, int blockrenderdata) {
|
||||
public final short[] getScaledModel(int blocktype, int blockdata) {
|
||||
if(modelvectors[blocktype] == null) {
|
||||
return null;
|
||||
}
|
||||
return modelvectors[blocktype][(blockrenderdata>=0)?blockrenderdata:blockdata];
|
||||
return modelvectors[blocktype][blockdata];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ public class HDMap extends MapType {
|
||||
private ConfigurationNode configuration;
|
||||
private int mapzoomout;
|
||||
private MapType.ImageFormat imgformat;
|
||||
private int bgcolornight;
|
||||
private int bgcolorday;
|
||||
|
||||
public static final String IMGFORMAT_PNG = "png";
|
||||
public static final String IMGFORMAT_JPG = "jpg";
|
||||
@@ -102,20 +100,7 @@ public class HDMap extends MapType {
|
||||
if(imgformat == null) {
|
||||
Log.severe("HDMap '"+name+"' set invalid image-format: " + fmt);
|
||||
imgformat = ImageFormat.FORMAT_PNG;
|
||||
}
|
||||
/* Get color info */
|
||||
String c = configuration.getString("background");
|
||||
if(c != null) {
|
||||
bgcolorday = bgcolornight = parseColor(c);
|
||||
}
|
||||
c = configuration.getString("backgroundday");
|
||||
if(c != null) {
|
||||
bgcolorday = parseColor(c);
|
||||
}
|
||||
c = configuration.getString("backgroundnight");
|
||||
if(c != null) {
|
||||
bgcolornight = parseColor(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HDShader getShader() { return shader; }
|
||||
@@ -143,11 +128,11 @@ public class HDMap extends MapType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ZoomInfo> baseZoomFileInfo() {
|
||||
ArrayList<ZoomInfo> s = new ArrayList<ZoomInfo>();
|
||||
s.add(new ZoomInfo(prefix, getBackgroundARGBNight()));
|
||||
public List<String> baseZoomFilePrefixes() {
|
||||
ArrayList<String> s = new ArrayList<String>();
|
||||
s.add(prefix);
|
||||
if(lighting.isNightAndDayEnabled())
|
||||
s.add(new ZoomInfo(prefix + "_day", getBackgroundARGBDay()));
|
||||
s.add(prefix + "_day");
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -237,37 +222,4 @@ public class HDMap extends MapType {
|
||||
a(worldObject, "maps", o);
|
||||
|
||||
}
|
||||
|
||||
private static int parseColor(String c) {
|
||||
int v = 0;
|
||||
if(c.startsWith("#")) {
|
||||
c = c.substring(1);
|
||||
if(c.length() == 3) { /* #rgb */
|
||||
try {
|
||||
v = Integer.valueOf(c, 16);
|
||||
} catch (NumberFormatException nfx) {
|
||||
return 0;
|
||||
}
|
||||
v = 0xFF000000 | ((v & 0xF00) << 12) | ((v & 0x0F0) << 8) | ((v & 0x00F) << 4);
|
||||
}
|
||||
else if(c.length() == 6) { /* #rrggbb */
|
||||
try {
|
||||
v = Integer.valueOf(c, 16);
|
||||
} catch (NumberFormatException nfx) {
|
||||
return 0;
|
||||
}
|
||||
v = 0xFF000000 | (v & 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
public int getBackgroundARGBDay() {
|
||||
return bgcolorday;
|
||||
}
|
||||
|
||||
public int getBackgroundARGBNight() {
|
||||
return bgcolornight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,6 @@ public interface HDPerspectiveState {
|
||||
* Get current block data
|
||||
*/
|
||||
int getBlockData();
|
||||
/**
|
||||
* Get current block render data
|
||||
*/
|
||||
int getBlockRenderData();
|
||||
/**
|
||||
* Get direction of last block step
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.MapTile;
|
||||
import org.dynmap.MapType;
|
||||
import org.dynmap.MapType.ImageFormat;
|
||||
import org.dynmap.TileHashManager;
|
||||
import org.dynmap.debug.Debug;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
@@ -96,7 +95,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
private class OurPerspectiveState implements HDPerspectiveState {
|
||||
int blocktypeid = 0;
|
||||
int blockdata = 0;
|
||||
int blockrenderdata = -1;
|
||||
int lastblocktypeid = 0;
|
||||
Vector3D top, bottom;
|
||||
int px, py;
|
||||
@@ -195,10 +193,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
* Get current block data
|
||||
*/
|
||||
public final int getBlockData() { return blockdata; }
|
||||
/**
|
||||
* Get current block render data
|
||||
*/
|
||||
public final int getBlockRenderData() { return blockrenderdata; }
|
||||
/**
|
||||
* Get direction of last block step
|
||||
*/
|
||||
@@ -479,23 +473,22 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
skiptoair = false;
|
||||
}
|
||||
else if(nonairhit || (blocktypeid != 0)) {
|
||||
blockdata = mapiter.getBlockData();
|
||||
switch(blocktypeid) {
|
||||
case FENCE_BLKTYPEID: /* Special case for fence - need to fake data so we can render properly */
|
||||
blockrenderdata = generateFenceBlockData(mapiter);
|
||||
blockdata = generateFenceBlockData(mapiter);
|
||||
break;
|
||||
case CHEST_BLKTYPEID: /* Special case for chest - need to fake data so we can render */
|
||||
blockrenderdata = generateChestBlockData(mapiter);
|
||||
blockdata = generateChestBlockData(mapiter);
|
||||
break;
|
||||
case REDSTONE_BLKTYPEID: /* Special case for redstone - fake data for wire pattern */
|
||||
blockrenderdata = generateRedstoneWireBlockData(mapiter);
|
||||
blockdata = generateRedstoneWireBlockData(mapiter);
|
||||
break;
|
||||
default:
|
||||
blockrenderdata = -1;
|
||||
break;
|
||||
blockdata = mapiter.getBlockData();
|
||||
break;
|
||||
}
|
||||
/* Look up to see if block is modelled */
|
||||
short[] model = scalemodels.getScaledModel(blocktypeid, blockdata, blockrenderdata);
|
||||
short[] model = scalemodels.getScaledModel(blocktypeid, blockdata);
|
||||
if(model != null) {
|
||||
return handleSubModel(model, shaderstate, shaderdone);
|
||||
}
|
||||
@@ -972,9 +965,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
DynmapBufferedImage dayim[] = new DynmapBufferedImage[numshaders];
|
||||
int[][] argb_buf = new int[numshaders][];
|
||||
int[][] day_argb_buf = new int[numshaders][];
|
||||
boolean isjpg[] = new boolean[numshaders];
|
||||
int bgday[] = new int[numshaders];
|
||||
int bgnight[] = new int[numshaders];
|
||||
|
||||
for(int i = 0; i < numshaders; i++) {
|
||||
HDShader shader = shaderstate[i].getShader();
|
||||
@@ -989,9 +979,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
dayim[i] = DynmapBufferedImage.allocateBufferedImage(tileWidth, tileHeight);
|
||||
day_argb_buf[i] = dayim[i].argb_buf;
|
||||
}
|
||||
isjpg[i] = shaderstate[i].getMap().getImageFormat() != ImageFormat.FORMAT_PNG;
|
||||
bgday[i] = shaderstate[i].getMap().getBackgroundARGBDay();
|
||||
bgnight[i] = shaderstate[i].getMap().getBackgroundARGBNight();
|
||||
}
|
||||
|
||||
/* Create perspective state object */
|
||||
@@ -1003,7 +990,6 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
double ybase = tile.ty * tileHeight;
|
||||
boolean shaderdone[] = new boolean[numshaders];
|
||||
boolean rendered[] = new boolean[numshaders];
|
||||
|
||||
for(int x = 0; x < tileWidth; x++) {
|
||||
ps.px = x;
|
||||
for(int y = 0; y < tileHeight; y++) {
|
||||
@@ -1026,20 +1012,10 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
rendered[i] = true;
|
||||
}
|
||||
shaderstate[i].getRayColor(rslt, 0);
|
||||
if(isjpg[i] && rslt.isTransparent()) {
|
||||
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = bgnight[i];
|
||||
}
|
||||
else {
|
||||
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
|
||||
}
|
||||
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
|
||||
if(day_argb_buf[i] != null) {
|
||||
shaderstate[i].getRayColor(rslt, 1);
|
||||
if(isjpg[i] && rslt.isTransparent()) {
|
||||
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = bgday[i];
|
||||
}
|
||||
else {
|
||||
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
|
||||
}
|
||||
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,15 +120,12 @@ public class TexturePack {
|
||||
private List<Integer> blockids;
|
||||
private int databits;
|
||||
private BlockTransparency bt;
|
||||
private boolean userender;
|
||||
private static HDTextureMap[] texmaps;
|
||||
private static BlockTransparency transp[];
|
||||
private static boolean userenderdata[];
|
||||
|
||||
private static void initializeTable() {
|
||||
texmaps = new HDTextureMap[16*BLOCKTABLELEN];
|
||||
transp = new BlockTransparency[BLOCKTABLELEN];
|
||||
userenderdata = new boolean[BLOCKTABLELEN];
|
||||
HDTextureMap blank = new HDTextureMap();
|
||||
for(int i = 0; i < texmaps.length; i++)
|
||||
texmaps[i] = blank;
|
||||
@@ -139,7 +136,6 @@ public class TexturePack {
|
||||
private HDTextureMap() {
|
||||
blockids = Collections.singletonList(Integer.valueOf(0));
|
||||
databits = 0xFFFF;
|
||||
userender = false;
|
||||
faces = new int[] { BLOCKINDEX_BLANK, BLOCKINDEX_BLANK, BLOCKINDEX_BLANK, BLOCKINDEX_BLANK, BLOCKINDEX_BLANK, BLOCKINDEX_BLANK };
|
||||
|
||||
for(int i = 0; i < texmaps.length; i++) {
|
||||
@@ -147,12 +143,11 @@ public class TexturePack {
|
||||
}
|
||||
}
|
||||
|
||||
public HDTextureMap(List<Integer> blockids, int databits, int[] faces, BlockTransparency trans, boolean userender) {
|
||||
public HDTextureMap(List<Integer> blockids, int databits, int[] faces, BlockTransparency trans) {
|
||||
this.faces = faces;
|
||||
this.blockids = blockids;
|
||||
this.databits = databits;
|
||||
this.bt = trans;
|
||||
this.userender = userender;
|
||||
}
|
||||
|
||||
public void addToTable() {
|
||||
@@ -164,15 +159,11 @@ public class TexturePack {
|
||||
}
|
||||
}
|
||||
transp[blkid] = bt; /* Transparency is only blocktype based right now */
|
||||
userenderdata[blkid] = userender; /* Ditto for using render data */
|
||||
}
|
||||
}
|
||||
|
||||
public static HDTextureMap getMap(int blkid, int blkdata, int blkrenderdata) {
|
||||
if(userenderdata[blkid])
|
||||
return texmaps[(blkid<<4) + blkrenderdata];
|
||||
else
|
||||
return texmaps[(blkid<<4) + blkdata];
|
||||
public static HDTextureMap getMap(int blkid, int blkdata) {
|
||||
return texmaps[(blkid<<4) + blkdata];
|
||||
}
|
||||
|
||||
public static BlockTransparency getTransparency(int blkid) {
|
||||
@@ -713,7 +704,6 @@ public class TexturePack {
|
||||
line = line.substring(6);
|
||||
BlockTransparency trans = BlockTransparency.OPAQUE;
|
||||
String[] args = line.split(",");
|
||||
boolean userenderdata = false;
|
||||
for(String a : args) {
|
||||
String[] av = a.split("=");
|
||||
if(av.length < 2) continue;
|
||||
@@ -769,15 +759,12 @@ public class TexturePack {
|
||||
Log.severe("Texture mapping has invalid transparency setting - " + av[1] + " - line " + rdr.getLineNumber() + " of " + txtname);
|
||||
}
|
||||
}
|
||||
else if(av[0].equals("userenderdata")) {
|
||||
userenderdata = av[1].equals("true");
|
||||
}
|
||||
}
|
||||
/* If no data bits, assume all */
|
||||
if(databits < 0) databits = 0xFFFF;
|
||||
/* If we have everything, build block */
|
||||
if(blkids.size() > 0) {
|
||||
HDTextureMap map = new HDTextureMap(blkids, databits, faces, trans, userenderdata);
|
||||
HDTextureMap map = new HDTextureMap(blkids, databits, faces, trans);
|
||||
map.addToTable();
|
||||
cnt++;
|
||||
}
|
||||
@@ -808,7 +795,7 @@ public class TexturePack {
|
||||
*/
|
||||
public final void readColor(final HDPerspectiveState ps, final MapIterator mapiter, final Color rslt, final int blkid, final int lastblocktype, final boolean biome_shaded) {
|
||||
int blkdata = ps.getBlockData();
|
||||
HDTextureMap map = HDTextureMap.getMap(blkid, blkdata, ps.getBlockRenderData());
|
||||
HDTextureMap map = HDTextureMap.getMap(blkid, blkdata);
|
||||
BlockStep laststep = ps.getLastBlockStep();
|
||||
int textid = map.faces[laststep.ordinal()]; /* Get index of texture source */
|
||||
if(textid < 0) {
|
||||
|
||||
@@ -289,12 +289,12 @@ public class KzedMap extends MapType {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<ZoomInfo> baseZoomFileInfo() {
|
||||
ArrayList<ZoomInfo> s = new ArrayList<ZoomInfo>();
|
||||
public List<String> baseZoomFilePrefixes() {
|
||||
ArrayList<String> s = new ArrayList<String>();
|
||||
for(MapTileRenderer r : renderers) {
|
||||
s.add(new ZoomInfo("z" + r.getPrefix(), 0));
|
||||
s.add("z" + r.getPrefix());
|
||||
if(r.isNightAndDayEnabled())
|
||||
s.add(new ZoomInfo("z" + r.getPrefix() + "_day", 0));
|
||||
s.add("z" + r.getPrefix() + "_day");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -76,14 +76,7 @@ public class KzedMapTile extends MapTile {
|
||||
}
|
||||
|
||||
public boolean render(MapChunkCache cache, String mapname) {
|
||||
boolean rslt = false;
|
||||
for(MapTileRenderer r : map.renderers) {
|
||||
if((mapname == null) || (r.getName().equals(mapname))) {
|
||||
KzedMapTile t = new KzedMapTile(world, map, r, px, py);
|
||||
rslt |= map.render(cache, t, MapManager.mapman.getTileFile(t));
|
||||
}
|
||||
}
|
||||
return rslt;
|
||||
return map.render(cache, this, MapManager.mapman.getTileFile(this));
|
||||
}
|
||||
|
||||
public List<DynmapChunk> getRequiredChunks() {
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package org.dynmap.markers;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
/**
|
||||
* This defines the public interface to a marker object, for use with the MarkerAPI
|
||||
*/
|
||||
public interface Marker {
|
||||
/**
|
||||
* Get ID of the marker (unique string within the MarkerSet)
|
||||
* @return id of marker
|
||||
*/
|
||||
public String getMarkerID();
|
||||
/**
|
||||
* Get the marker set for the marker
|
||||
* @return marker set
|
||||
*/
|
||||
public MarkerSet getMarkerSet();
|
||||
/**
|
||||
* Delete the marker
|
||||
*/
|
||||
public void deleteMarker();
|
||||
/**
|
||||
* Get marker's world ID
|
||||
* @return world id
|
||||
*/
|
||||
public String getWorld();
|
||||
/**
|
||||
* Get marker's X coordinate
|
||||
* @return x coordinate
|
||||
*/
|
||||
public double getX();
|
||||
/**
|
||||
* Get marker's Y coordinate
|
||||
* @return y coordinate
|
||||
*/
|
||||
public double getY();
|
||||
/**
|
||||
* Get marker's Z coordinate
|
||||
* @return z coordinate
|
||||
*/
|
||||
public double getZ();
|
||||
/**
|
||||
* Update the marker's location
|
||||
* @param worldid - world ID
|
||||
* @param x - x coord
|
||||
* @param y - y coord
|
||||
* @param z - z coord
|
||||
*/
|
||||
public void setLocation(String worldid, double x, double y, double z);
|
||||
/**
|
||||
* Get the marker's icon
|
||||
* @return marker icon
|
||||
*/
|
||||
public MarkerIcon getMarkerIcon();
|
||||
/**
|
||||
* Set the marker's icon
|
||||
* @param icon - new marker icon
|
||||
* @return true if new marker icon set, false if not allowed
|
||||
*/
|
||||
public boolean setMarkerIcon(MarkerIcon icon);
|
||||
/**
|
||||
* Test if marker is persistent
|
||||
*/
|
||||
public boolean isPersistentMarker();
|
||||
/**
|
||||
* Get the marker's label
|
||||
*/
|
||||
public String getLabel();
|
||||
/**
|
||||
* Update the marker's label
|
||||
*/
|
||||
public void setLabel(String lbl);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package org.dynmap.markers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* This defines the public interface to the MarkerAPI (as retrieved by the getMarkerAPI() method in the DynmapPlugin class).
|
||||
*/
|
||||
public interface MarkerAPI {
|
||||
/**
|
||||
* Get set of defined marker sets
|
||||
* @return set of marker sets
|
||||
*/
|
||||
public Set<MarkerSet> getMarkerSets();
|
||||
/**
|
||||
* Find marker set by ID
|
||||
* @param id - ID of marker set
|
||||
* @return marker set, or null if not found
|
||||
*/
|
||||
public MarkerSet getMarkerSet(String id);
|
||||
/**
|
||||
* Create marker set
|
||||
* @param id - ID for marker set (must be unique among marker set - limit to alphanumerics, periods, underscores)
|
||||
* @param lbl - Label for marker set
|
||||
* @param iconlimit - set of allowed marker icons (if null, any marker icon can be used in set)
|
||||
* @param persistent - if true, set is persistent (and can contain persistent markers)
|
||||
* @return marker set, or null if failed to be created
|
||||
*/
|
||||
public MarkerSet createMarkerSet(String id, String lbl, Set<MarkerIcon> iconlimit, boolean persistent);
|
||||
/**
|
||||
* Get set of defined marker icons
|
||||
* @return set of marker icons
|
||||
*/
|
||||
public Set<MarkerIcon> getMarkerIcons();
|
||||
/**
|
||||
* Find marker icon by ID
|
||||
* @param id - ID of marker icon
|
||||
* @return marker icon, or null if not found
|
||||
*/
|
||||
public MarkerIcon getMarkerIcon(String id);
|
||||
/**
|
||||
* Register a new marker icon
|
||||
* @param id - ID of marker icon (must be unique among marker icons - letters, numbers, periods, underscores only)
|
||||
* @param label - label for marker icon
|
||||
* @param marker_png - stream containing PNG encoded icon for marker (will be read and copied)
|
||||
* @return marker icon object, or null if failed
|
||||
*/
|
||||
public MarkerIcon createMarkerIcon(String id, String label, InputStream marker_png);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user