Add API for other plugins to trigger map renders due to updated volumes

This commit is contained in:
Mike Primm 2011-10-23 06:05:21 +08:00 committed by mikeprimm
parent 36d8a701e0
commit 3455a8a3d4
2 changed files with 28 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package org.dynmap; package org.dynmap;
import org.bukkit.Location;
import org.dynmap.markers.MarkerAPI; import org.dynmap.markers.MarkerAPI;
/** /**
@ -29,4 +30,13 @@ public interface DynmapAPI {
* @param msg - message to be sent * @param msg - message to be sent
*/ */
public boolean sendBroadcastToWeb(String sender, String msg); public boolean sendBroadcastToWeb(String sender, String msg);
/**
* Trigger update on tiles associated with given locations. If two locations provided,
* the volume is the rectangular prism ("cuboid") with the two locations on opposite corners.
*
* @param l0 - first location (required)
* @param l1 - second location (if null, only single point invalidated (l0))
* @return number of tiles queued to be rerendered
*/
public int triggerRenderOfVolume(Location l0, Location l1);
} }

View File

@ -1306,6 +1306,24 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
} }
return false; return false;
} }
/**
* Trigger update on tiles associated with given locations. If two locations provided,
* the volume is the rectangular prism ("cuboid") with the two locations on opposite corners.
*
* @param l0 - first location (required)
* @param l1 - second location (if null, only single point invalidated (l0))
* @return number of tiles queued to be rerendered
*/
public int triggerRenderOfVolume(Location l0, Location l1) {
if(mapManager != null) {
if(l1 == null)
return mapManager.touch(l0);
else
return mapManager.touchVolume(l0, l1);
}
return 0;
}
/** /**
* Register markers API - used by component to supply marker API to plugin * Register markers API - used by component to supply marker API to plugin
*/ */