Compare commits

..

72 Commits

Author SHA1 Message Date
FrozenCow 03f62bd8f6 Made the different version numbers refer to version in pom.xml. 2011-09-09 20:35:22 +02:00
Mike Primm 6d2193d597 Add hide-by-default attribute to marker sets, /dmarker updateset 2011-09-09 11:05:00 +08:00
Mike Primm 4c50bd502c Fix typo in setMarkerSetLabel() API 2011-09-09 01:01:02 +08:00
Mike Primm 996343c5a3 Add /dmarker addicon command 2011-09-08 11:42:28 +08:00
Mike Primm 2f53b72779 Update jquery to 1.6.3 2011-09-08 11:06:20 +08:00
Mike Primm cfa5f187e6 Add error handling for missing component javascript files 2011-09-08 10:46:33 +08:00
Mike Primm 91bc59d7f8 Fix message for version mismatch, and abort UI if it fails 2011-09-08 10:46:33 +08:00
Mike Primm 6181aa8ba9 Add version check for javascript files versus plugin version 2011-09-08 09:47:00 +08:00
Mike Primm 9322c5426d Add support for showing spawn points as map markers 2011-09-08 09:47:00 +08:00
Mike Primm 9da159f842 Add 'hidebydefault' option for Markers layers 2011-09-08 00:23:38 +08:00
Mike Primm 771059bf5a Fix background colors when rendering zoomout with JPEG format 2011-09-06 14:19:49 +08:00
Mike Primm e7f30153b8 Add marker set commands - addset, deleteset, listsets 2011-09-06 14:19:49 +08:00
Mike Primm 7bee1dcae5 Fix markers being left on world changes 2011-09-06 09:05:25 +08:00
Mike Primm 2f7890a40b Remove debug messages, adjust sign ID mapping 2011-09-06 07:53:49 +08:00
Mike Primm 36d983ba28 Add support for using signs to define markers 2011-09-06 07:53:48 +08:00
Mike Primm 20e409b71f Start sign support 2011-09-06 07:53:48 +08:00
Mike Primm e0fcca4b7f Fix single map render message on single map render of day/night worlds 2011-09-06 04:41:08 +08:00
Mike Primm f99700d863 Fix double-quoted strings in parameters 2011-09-06 02:36:37 +08:00
Mike Primm e86aa352df Make all /dmarker command match-on-label as well as id:<id> 2011-09-05 14:35:29 +08:00
Mike Primm f0db205eb9 Complete first drop of /dmarker commands and client support 2011-09-04 23:40:00 -05:00
Mike Primm 9f8ab5da03 Add icons on to map display, and marker update logic 2011-09-04 14:11:48 -05:00
Mike Primm c034a10951 Finish revert 2011-09-04 02:07:15 -05:00
Mike Primm 6b301b2208 Merge remote branch 'origin/master' 2011-09-04 02:05:58 -05:00
Mike Primm 83642a6291 Put it back - not sure other fix did anything 2011-09-04 02:03:52 -05:00
Mike Primm cbe4ca0377 Fix player faces in sidebar, while still preserving load cache 2011-09-04 14:35:41 +08:00
Mike Primm eee6476d6a Fix player faces in sidebar, while still preserving load cache 2011-09-04 01:35:02 -05:00
Mike Primm 8bdce005c3 Merge remote branch 'upstream/master' 2011-09-04 01:31:46 -05:00
Mike Primm 3f585c84b7 Put markers in a component, add generic component update messages 2011-09-03 16:49:18 -05:00
Mike Primm dd8a84165b Add marker update/delete events for client 2011-09-03 01:06:00 -05:00
Mike Primm c486c42de8 Add default marker set 2011-09-02 23:02:23 -05:00
Mike Primm cdffc5824f Fix texture rotation for NE and SW rail corners 2011-09-03 03:23:34 +08:00
Mike Primm f6a4f3e619 Fix texture rotation for NE and SW rail corners 2011-09-02 14:22:13 -05:00
Mike Primm dcdcdd88aa Prevent trap if townBlocks is undefined in towny town file 2011-09-03 00:11:35 +08:00
Mike Primm a476b66c2f Prevent trap if townBlocks is undefined in towny town file 2011-09-02 09:19:27 -05:00
Mike Primm fba69e3d19 Frame out API and data handling for markers support 2011-09-01 01:01:51 -05:00
Mike Primm 0bd55b76d8 Yet another face fix - hopefully got the rules on accessories right
this time...
2011-08-31 07:15:44 +08:00
Mike Primm 704fc7fb32 Yet another face fix - hopefully got the rules on accessories right
this time...
2011-08-30 18:13:59 -05:00
FrozenCow d88763f179 Fixed playerfaces not showing in sidebar. 2011-08-30 21:46:22 +02:00
Mike Primm 56faab71e2 Handle Towny 0.74.0 configuration format 2011-08-30 13:29:36 +08:00
Mike Primm 9da3180e38 Handle Towny 0.74.0 configuration format 2011-08-30 00:28:28 -05:00
Mike Primm 85a564aa45 Handle Factions on worlds with no faction data properly 2011-08-30 13:04:54 +08:00
Mike Primm b9170db1c1 Support applying background color to JPG tiles (since no transparency) 2011-08-30 13:04:54 +08:00
Mike Primm 0e1158c77b Handle Factions on worlds with no faction data properly 2011-08-30 00:03:37 -05:00
Mike Primm 8ac000abec Support applying background color to JPG tiles (since no transparency) 2011-08-30 00:02:52 -05:00
Mike Primm f371cff011 Add support for 'http-reponse-headers' attribute to add custom response headers 2011-08-30 10:34:58 +08:00
Mike Primm 5088adb7eb Add support for 'http-reponse-headers' attribute to add custom response headers 2011-08-29 21:33:41 -05:00
Mike Primm d1ff472bda Add 'sidebaropened: pinned' option to allow sidebar to be pre-pinned but support unpinning 2011-08-30 10:01:07 +08:00
Mike Primm 7e37817b86 Add 'sidebaropened: pinned' option to allow sidebar to be pre-pinned but support unpinning 2011-08-29 21:00:05 -05:00
Mike Primm 611a935232 Fix multi-map KzedMap rendering (default cave not rendered issue) 2011-08-30 04:56:21 +08:00
Mike Primm 974cd33853 Fix multi-map KzedMap rendering (default cave not rendered issue) 2011-08-29 15:53:48 -05:00
Mike Primm fc1fec4af8 Split renderdata (generated data) from normal block data - to help
with custom block work
2011-08-30 03:23:11 +08:00
Mike Primm 13bf8d7733 Split renderdata (generated data) from normal block data - to help
with custom block work
2011-08-29 14:21:39 -05:00
Mike Primm f4de63e85e Add first pass of Factions support 2011-08-29 10:37:22 +08:00
Mike Primm af1f47df23 Add first pass of Factions support 2011-08-28 21:31:04 -05:00
Mike Primm 0755dd3377 Merge remote branch 'upstream/master' 2011-08-28 18:29:18 -05:00
Mike Primm f20c4a25a9 Merge remote branch 'origin/master' 2011-08-28 18:28:13 -05:00
Mike Primm cfc758fe7d Fix handling of non-standard town_block_size values 2011-08-28 23:12:47 +08:00
Mike Primm b20b9e1436 Fix handling of non-standard town_block_size values 2011-08-28 10:12:04 -05:00
Mike Primm 0c292dde12 Fix Towny support to handle 0.75.x and 0.74.x 2011-08-28 08:14:08 +08:00
Mike Primm ac650656b4 Fix Towny support to handle 0.75.x and 0.74.x 2011-08-27 19:13:34 -05:00
FrozenCow a3573c7a64 Added support for Towny Advanced 0.75 2011-08-27 20:51:47 +02:00
FrozenCow 069d4c0ce5 Changed version to 0.22. 2011-08-27 17:13:56 +02:00
Mike Primm 3d385106e9 Add hidebydefault setting to playermarkers component too 2011-08-26 01:22:03 -05:00
Mike Primm ace7fbf838 Handle multiple instances of same component type (regions) 2011-08-26 00:55:53 -05:00
Mike Primm aee7ea2d49 Add hidebydefault option for regions layers 2011-08-26 00:13:03 -05:00
Mike Primm c6cccf6899 Merge remote branch 'upstream/master' 2011-08-25 23:33:57 -05:00
Mike Primm 1a128a6d74 Add playermarkers to hide/show-able layer group 2011-08-25 17:31:34 -05:00
Mike Primm bfb12e4f81 Add control for hide/show of component layers (only regions for now) 2011-08-25 17:07:00 -05:00
Mike Primm 625b62fa36 Use towns list in Towny worlds/* files to get valid towns (old towns
still in towns/* directory)
2011-08-25 14:49:32 -05:00
Mike Primm c65b17d80b Disable IOImage cache use for image loads 2011-08-25 14:48:42 -05:00
Mike Primm 627cef720c Towny fixes - multiple areas on multiple worlds per town 2011-08-24 22:11:31 -05:00
Mike Primm 586c41d23c Fix accessory face mixing 2011-08-24 01:23:05 -05:00
127 changed files with 2895 additions and 131 deletions
+19 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.21.1</version>
<version>0.22</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -13,6 +13,24 @@
<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>
+16 -3
View File
@@ -15,9 +15,20 @@
<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>
@@ -32,7 +43,9 @@
</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>
+6
View File
@@ -4,6 +4,8 @@ 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;
@@ -77,4 +79,8 @@ public class Client {
}
}
public static class ComponentMessage extends Update {
public String type = "component";
/* Each subclass must provide 'ctype' string for component 'type' */
}
}
@@ -20,7 +20,8 @@ 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.getBoolean("sidebaropened", false));
s(t, "sidebaropened", c.getString("sidebaropened", "false"));
s(t, "dynmapversion", plugin.getDescription().getVersion());
DynmapWorld defaultWorld = null;
String defmap = null;
+62 -5
View File
@@ -39,6 +39,7 @@ 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;
@@ -49,6 +50,7 @@ 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;
@@ -59,6 +61,8 @@ 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;
@@ -85,6 +89,8 @@ 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;
@@ -208,6 +214,7 @@ 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 */
@@ -278,11 +285,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);
}
@@ -303,6 +310,19 @@ 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
@@ -347,7 +367,10 @@ 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();
}
@@ -627,6 +650,9 @@ 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;
@@ -755,7 +781,7 @@ public class DynmapPlugin extends JavaPlugin {
return false;
}
private boolean checkPlayerPermission(CommandSender sender, String permission) {
public boolean checkPlayerPermission(CommandSender sender, String permission) {
if (!(sender instanceof Player) || sender.isOp()) {
return true;
} else if (!permissions.has(sender, permission.toLowerCase())) {
@@ -1073,6 +1099,16 @@ 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() {
@@ -1128,11 +1164,12 @@ 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:
@@ -1150,4 +1187,24 @@ 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;
}
}
+18 -4
View File
@@ -1,10 +1,12 @@
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;
@@ -151,6 +153,7 @@ public class DynmapWorld {
boolean neg_step_y;
String baseprefix;
int zoomlevel;
int background;
String zoomprefix;
String fnprefix;
String zfnprefix;
@@ -233,7 +236,7 @@ public class DynmapWorld {
/* If level is above top needed for this map, skip */
if(zoomlevel > (this.extrazoomoutlevels + mt.getMapZoomOutLevels()))
continue;
List<String> pfx = mt.baseZoomFilePrefixes();
List<MapType.ZoomInfo> pfx = mt.baseZoomFileInfo();
int stepsize = mt.baseZoomFileStepSize();
int bigworldshift = mt.getBigWorldShift();
boolean neg_step_x = false;
@@ -252,13 +255,14 @@ public class DynmapWorld {
break;
}
int[] stepseq = mt.zoomFileStepSequence();
for(String p : pfx) {
for(MapType.ZoomInfo 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;
pd.baseprefix = p.prefix;
pd.background = p.background_argb;
pd.zoomlevel = zoomlevel;
pd.zoomprefix = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz".substring(0, zoomlevel);
pd.bigworldshift = bigworldshift;
@@ -279,7 +283,7 @@ public class DynmapWorld {
pd.zfnprefix = "z" + pd.fnprefix;
}
maptab.put(p, pd);
maptab.put(p.prefix, pd);
}
}
return maptab;
@@ -430,6 +434,16 @@ 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);
+11 -7
View File
@@ -268,12 +268,15 @@ public class MapManager {
activemaplist = map.getMapNamesSharingRender(world);
/* Build active map list */
activemaps = "";
for(String n : activemaplist) {
if((mapname != null) && (!mapname.equals(n)))
continue;
if(activemaps.length() > 0)
activemaps += ",";
activemaps += n;
if(mapname != null) {
activemaps = mapname;
}
else {
for(String n : activemaplist) {
if(activemaps.length() > 0)
activemaps += ",";
activemaps += n;
}
}
/* Mark all the concurrently rendering maps rendered */
renderedmaps.addAll(map.getMapsSharingRender(world));
@@ -790,7 +793,8 @@ public class MapManager {
public void pushUpdate(String worldName, Object update) {
DynmapWorld world = getWorld(worldName);
world.updates.pushUpdate(update);
if(world != null)
world.updates.pushUpdate(update);
}
public Object[] getWorldUpdates(String worldName, long since) {
+12 -2
View File
@@ -28,6 +28,12 @@ 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);
@@ -54,7 +60,7 @@ public abstract class MapType {
X_MINUS_Y_MINUS
}
public abstract MapStep zoomFileMapStep();
public abstract List<String> baseZoomFilePrefixes();
public abstract List<ZoomInfo> baseZoomFileInfo();
public abstract int baseZoomFileStepSize();
/* How many bits of coordinate are shifted off to make big world directory name */
public abstract int getBigWorldShift();
@@ -64,7 +70,11 @@ 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)
@@ -0,0 +1,94 @@
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;
}
}
}
+12 -7
View File
@@ -56,16 +56,21 @@ 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: first element is transparency color so only ones not matching it */
/* Apply accessory to face: see if anything is transparent (if so, apply accessory */
boolean transp = false;
for(int i = 0; i < 64; 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;
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];
}
}
/* Write 8x8 file */
File img_8x8 = new File(faces8x8dir, playername + ".png");
+4 -4
View File
@@ -454,11 +454,11 @@ public class FlatMap extends MapType {
return Collections.singletonList(name);
}
public List<String> baseZoomFilePrefixes() {
ArrayList<String> s = new ArrayList<String>();
s.add(getPrefix() + "_128");
public List<ZoomInfo> baseZoomFileInfo() {
ArrayList<ZoomInfo> s = new ArrayList<ZoomInfo>();
s.add(new ZoomInfo(getPrefix() + "_128", 0));
if(night_and_day)
s.add(getPrefix()+"_day_128");
s.add(new ZoomInfo(getPrefix()+"_day_128", 0));
return s;
}
@@ -31,11 +31,11 @@ public class HDBlockModels {
public static class HDScaledBlockModels {
private short[][][] modelvectors;
public final short[] getScaledModel(int blocktype, int blockdata) {
public final short[] getScaledModel(int blocktype, int blockdata, int blockrenderdata) {
if(modelvectors[blocktype] == null) {
return null;
}
return modelvectors[blocktype][blockdata];
return modelvectors[blocktype][(blockrenderdata>=0)?blockrenderdata:blockdata];
}
}
+53 -5
View File
@@ -28,6 +28,8 @@ 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";
@@ -100,7 +102,20 @@ 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; }
@@ -128,11 +143,11 @@ public class HDMap extends MapType {
}
@Override
public List<String> baseZoomFilePrefixes() {
ArrayList<String> s = new ArrayList<String>();
s.add(prefix);
public List<ZoomInfo> baseZoomFileInfo() {
ArrayList<ZoomInfo> s = new ArrayList<ZoomInfo>();
s.add(new ZoomInfo(prefix, getBackgroundARGBNight()));
if(lighting.isNightAndDayEnabled())
s.add(prefix + "_day");
s.add(new ZoomInfo(prefix + "_day", getBackgroundARGBDay()));
return s;
}
@@ -222,4 +237,37 @@ 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,6 +20,10 @@ public interface HDPerspectiveState {
* Get current block data
*/
int getBlockData();
/**
* Get current block render data
*/
int getBlockRenderData();
/**
* Get direction of last block step
*/
@@ -22,6 +22,7 @@ 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;
@@ -95,6 +96,7 @@ 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;
@@ -193,6 +195,10 @@ 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
*/
@@ -473,22 +479,23 @@ 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 */
blockdata = generateFenceBlockData(mapiter);
blockrenderdata = generateFenceBlockData(mapiter);
break;
case CHEST_BLKTYPEID: /* Special case for chest - need to fake data so we can render */
blockdata = generateChestBlockData(mapiter);
blockrenderdata = generateChestBlockData(mapiter);
break;
case REDSTONE_BLKTYPEID: /* Special case for redstone - fake data for wire pattern */
blockdata = generateRedstoneWireBlockData(mapiter);
blockrenderdata = generateRedstoneWireBlockData(mapiter);
break;
default:
blockdata = mapiter.getBlockData();
break;
blockrenderdata = -1;
break;
}
/* Look up to see if block is modelled */
short[] model = scalemodels.getScaledModel(blocktypeid, blockdata);
short[] model = scalemodels.getScaledModel(blocktypeid, blockdata, blockrenderdata);
if(model != null) {
return handleSubModel(model, shaderstate, shaderdone);
}
@@ -965,6 +972,9 @@ 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();
@@ -979,6 +989,9 @@ 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 */
@@ -990,6 +1003,7 @@ 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++) {
@@ -1012,10 +1026,20 @@ public class IsoHDPerspective implements HDPerspective {
rendered[i] = true;
}
shaderstate[i].getRayColor(rslt, 0);
argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
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();
}
if(day_argb_buf[i] != null) {
shaderstate[i].getRayColor(rslt, 1);
day_argb_buf[i][(tileHeight-y-1)*tileWidth + x] = rslt.getARGB();
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();
}
}
}
}
@@ -120,12 +120,15 @@ 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;
@@ -136,6 +139,7 @@ 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++) {
@@ -143,11 +147,12 @@ public class TexturePack {
}
}
public HDTextureMap(List<Integer> blockids, int databits, int[] faces, BlockTransparency trans) {
public HDTextureMap(List<Integer> blockids, int databits, int[] faces, BlockTransparency trans, boolean userender) {
this.faces = faces;
this.blockids = blockids;
this.databits = databits;
this.bt = trans;
this.userender = userender;
}
public void addToTable() {
@@ -159,11 +164,15 @@ 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) {
return texmaps[(blkid<<4) + blkdata];
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 BlockTransparency getTransparency(int blkid) {
@@ -704,6 +713,7 @@ 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;
@@ -759,12 +769,15 @@ 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);
HDTextureMap map = new HDTextureMap(blkids, databits, faces, trans, userenderdata);
map.addToTable();
cnt++;
}
@@ -795,7 +808,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);
HDTextureMap map = HDTextureMap.getMap(blkid, blkdata, ps.getBlockRenderData());
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<String> baseZoomFilePrefixes() {
ArrayList<String> s = new ArrayList<String>();
public List<ZoomInfo> baseZoomFileInfo() {
ArrayList<ZoomInfo> s = new ArrayList<ZoomInfo>();
for(MapTileRenderer r : renderers) {
s.add("z" + r.getPrefix());
s.add(new ZoomInfo("z" + r.getPrefix(), 0));
if(r.isNightAndDayEnabled())
s.add("z" + r.getPrefix() + "_day");
s.add(new ZoomInfo("z" + r.getPrefix() + "_day", 0));
}
return s;
}
@@ -76,7 +76,14 @@ public class KzedMapTile extends MapTile {
}
public boolean render(MapChunkCache cache, String mapname) {
return map.render(cache, this, MapManager.mapman.getTileFile(this));
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;
}
public List<DynmapChunk> getRequiredChunks() {
@@ -0,0 +1,74 @@
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);
}
@@ -0,0 +1,50 @@
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