Migrate API code to dynmap-api

This commit is contained in:
Mike Primm 2011-11-16 13:37:31 +08:00 committed by mikeprimm
parent 616f46ba26
commit 040a604e0c
9 changed files with 10 additions and 520 deletions

11
pom.xml
View File

@ -7,10 +7,10 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<url>http://github.com/FrozenCow/dynmap/</url> <url>http://github.com/webbukkit/dynmap/</url>
<issueManagement> <issueManagement>
<system>GitHub</system> <system>GitHub</system>
<url>https://github.com/FrozenCow/dynmap/issues</url> <url>https://github.com/webbukkit/dynmap/issues</url>
</issueManagement> </issueManagement>
<build> <build>
<resources> <resources>
@ -79,5 +79,12 @@
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>0.25</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,42 +0,0 @@
package org.dynmap;
import org.bukkit.Location;
import org.dynmap.markers.MarkerAPI;
/**
* This is the interface representing the published API for the Dynmap plugin. Public methods of the
* DynmapPlugin class that are not defined in this interface are subject to change without notice, so
* be careful with forming dependencies beyond these. Plugins accessing dynmap 0.24 or later should
* do so by casting the Plugin to this interface.
*
*/
public interface DynmapAPI {
/**
* 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();
/**
* Test if the marker API has been initialized yet
*
* @return true if it has been initialized
*/
public boolean markerAPIInitialized();
/**
* Send generic message to all web users
* @param sender - label for sender of message ("Message from <plugin>:") - if null, no from notice
* @param msg - message to be sent
*/
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

@ -1,123 +0,0 @@
package org.dynmap.markers;
/**
* This defines the public interface to an area marker object, for use with the MarkerAPI
*/
public interface AreaMarker extends GenericMarker {
/**
* Get the marker's label
*/
public String getLabel();
/**
* Update the marker's label (plain text)
*/
public void setLabel(String lbl);
/**
* Update the marker's label and markup flag
* @param label - label string
* @param markup - if true, label is processed as HTML (innerHTML for <span> used for label); false implies plaintext
*/
public void setLabel(String lbl, boolean markup);
/**
* Test if marker label is processed as HTML
*/
public boolean isLabelMarkup();
/**
* Set marker description (HTML markup shown in popup when clicked)
* @param desc - HTML markup description
*/
public void setDescription(String desc);
/**
* Get marker description
* @return descrption
*/
public String getDescription();
/**
* Get top Y coordinate
* @return coordinate
*/
public double getTopY();
/**
* Get bottom Y coordinate
* @return coordinate
*/
public double getBottomY();
/**
* Set Y coordinate range
* @param ytop - y coordinate of top
* @param ybottom - y coordinate of bottom (=top for 2D)
*/
public void setRangeY(double ytop, double ybottom);
/**
* Get corner location count
*/
public int getCornerCount();
/**
* Get X coordinate of corner N
* @param n - corner index
* @return coordinate
*/
public double getCornerX(int n);
/**
* Get Z coordinate of corner N
* @param n - corner index
* @return coordinate
*/
public double getCornerZ(int n);
/**
* Set coordinates of corner N
* @param n - index of corner: append new corner if >= corner count, else replace existing
* @param x - x coordinate
* @param z - z coordinate
*/
public void setCornerLocation(int n, double x, double z);
/**
* Set/replace all corners
* @param x - list of x coordinates
* @param z - list of z coordinates
*/
public void setCornerLocations(double[] x, double[] z);
/**
* Delete corner N - shift corners after N forward
* @param n - index of corner
*/
public void deleteCorner(int n);
/**
* Set line style
* @param weight - stroke weight
* @param opacity - stroke opacity
* @param color - stroke color (0xRRGGBB)
*/
public void setLineStyle(int weight, double opacity, int color);
/**
* Get line weight
* @return weight
*/
public int getLineWeight();
/**
* Get line opacity
* @return opacity (0.0-1.0)
*/
public double getLineOpacity();
/**
* Get line color
* @return color (0xRRGGBB)
*/
public int getLineColor();
/**
* Set fill style
* @param opacity - fill color opacity
* @param color - fill color (0xRRGGBB)
*/
public void setFillStyle(double opacity, int color);
/**
* Get fill opacity
* @return opacity (0.0-1.0)
*/
public double getFillOpacity();
/**
* Get fill color
* @return color (0xRRGGBB)
*/
public int getFillColor();
}

View File

@ -1,32 +0,0 @@
package org.dynmap.markers;
import org.bukkit.Location;
/**
* This defines the public interface to a generic marker object, for use with the MarkerAPI
*/
public interface GenericMarker {
/**
* 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();
/**
* Test if marker is persistent
*/
public boolean isPersistentMarker();
}

View File

@ -1,71 +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 extends GenericMarker {
/**
* 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);
/**
* Get the marker's label
*/
public String getLabel();
/**
* Update the marker's label (plain text)
*/
public void setLabel(String lbl);
/**
* Update the marker's label and markup flag
* @param label - label string
* @param markup - if true, label is processed as HTML (innerHTML for <span> used for label); false implies plaintext
*/
public void setLabel(String lbl, boolean markup);
/**
* Test if marker label is processed as HTML
*/
public boolean isLabelMarkup();
/**
* Set marker description (HTML markup shown in popup when clicked)
* @param desc - HTML markup description
*/
public void setDescription(String desc);
/**
* Get marker description
* @return descrption
*/
public String getDescription();
}

View File

@ -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);
}

View File

@ -1,44 +0,0 @@
package org.dynmap.markers;
import java.io.InputStream;
/**
* This defines the public interface to a marker icon, for use with the MarkerAPI
*/
public interface MarkerIcon {
/** Default marker icon - always exists */
public static final String DEFAULT = "default";
/** Default sign marker icon - always exists */
public static final String SIGN = "sign";
/** Default world marker icon - always exists */
public static final String WORLD = "world";
/**
* Get ID of the marker icon (unique among marker icons)
* @return ID
*/
public String getMarkerIconID();
/**
* Get label for marker icon (descriptive - for helping select icon, or for legend/key)
* @return icon label
*/
public String getMarkerIconLabel();
/**
* Set label for marker icon
*/
public void setMarkerIconLabel(String lbl);
/**
* Replace icon image for icon
* @param in - input stream for PNG file
*/
public void setMarkerIconImage(InputStream in);
/**
* Delete icon (not functional on builtin icons)
*/
public void deleteIcon();
/**
* Is builtin marker
* @return true
*/
public boolean isBuiltIn();
}

View File

@ -1,155 +0,0 @@
package org.dynmap.markers;
import java.util.Set;
/**
* This defines the public interface to a marker set object, for use with the MarkerAPI.
* This represents a logical set of markers, which are presented as a labelled layer on the web UI.
* Marker sets can be created as persistent or non-persistent, but only persistent marker sets can contain persistent markers.
*/
public interface MarkerSet {
public static final String DEFAULT = "markers"; /* Default set - always exists */
/**
* Get set of all markers currently in the set
* @return set of markers (set is copy - safe to iterate)
*/
public Set<Marker> getMarkers();
/**
* Get set of all area markers currently in the set
* @return set of area markers (set is copy - safe to iterate)
*/
public Set<AreaMarker> getAreaMarkers();
/**
* Create a new marker in the marker set
*
* @param id - ID of the marker - must be unique within the set: if null, unique ID is generated
* @param label - Label for the marker (plain text)
* @param world - world ID
* @param x - x coord
* @param y - y coord
* @param z - z coord
* @param icon - Icon for the marker
* @param is_persistent - if true, marker is persistent (saved and reloaded on restart). If set is not persistent, this must be false.
* @return created marker, or null if cannot be created.
*/
public Marker createMarker(String id, String label, String world, double x, double y, double z, MarkerIcon icon, boolean is_persistent);
/**
* Create a new marker in the marker set
*
* @param id - ID of the marker - must be unique within the set: if null, unique ID is generated
* @param label - Label for the marker
* @param markup - if true, label is processed as HTML. if false, label is processed as plain text.
* @param world - world ID
* @param x - x coord
* @param y - y coord
* @param z - z coord
* @param icon - Icon for the marker
* @param is_persistent - if true, marker is persistent (saved and reloaded on restart). If set is not persistent, this must be false.
* @return created marker, or null if cannot be created.
*/
public Marker createMarker(String id, String label, boolean markup, String world, double x, double y, double z, MarkerIcon icon, boolean is_persistent);
/**
* Get marker by ID
* @param id - ID of the marker
* @return marker, or null if cannot be found
*/
public Marker findMarker(String id);
/**
* Find marker by label - best matching substring
* @param lbl - label to find (same = best match)
* @return marker, or null if none found
*/
public Marker findMarkerByLabel(String lbl);
/**
* Create area marker
* @param id - marker ID
* @param lbl - label
* @param markup - if true, label is HTML markup
* @param world - world id
* @param x - x coord list
* @param z - z coord list
* @param persistent - true if persistent
*/
public AreaMarker createAreaMarker(String id, String lbl, boolean markup, String world, double x[], double z[], boolean persistent);
/**
* Get area marker by ID
* @param id - ID of the area marker
* @return marker, or null if cannot be found
*/
public AreaMarker findAreaMarker(String id);
/**
* Find area marker by label - best matching substring
* @param lbl - label to find (same = best match)
* @return marker, or null if none found
*/
public AreaMarker findAreaMarkerByLabel(String lbl);
/**
* Get ID of marker set - unique among marker sets
* @return ID
*/
public String getMarkerSetID();
/**
* Get label for marker set
* @return label
*/
public String getMarkerSetLabel();
/**
* Update label for marker set
* @param lbl - label for marker set
*/
public void setMarkerSetLabel(String lbl);
/**
* Test if marker set is persistent
* @return true if the set is persistent
*/
public boolean isMarkerSetPersistent();
/**
* Get marker icons allowed in set (if restricted)
* @return set of allowed marker icons
*/
public Set<MarkerIcon> getAllowedMarkerIcons();
/**
* Add marker icon to allowed set (must have been created restricted)
* @param icon - icon to be added
*/
public void addAllowedMarkerIcon(MarkerIcon icon);
/**
* Remove marker icon from allowed set (must have been created restricted)
* @param icon - icon to be added
*/
public void removeAllowedMarkerIcon(MarkerIcon icon);
/**
* Test if marker icon is allowed
* @param icon - marker icon
* @return true if allowed, false if not
*/
public boolean isAllowedMarkerIcon(MarkerIcon icon);
/**
* Get distinct set of marker icons used by set (based on markers currently in set)
* @return set of marker icons
*/
public Set<MarkerIcon> getMarkerIconsInUse();
/**
* Delete marker set
*/
public void deleteMarkerSet();
/**
* Set hide/show default
* @param hide - if true, layer for set will be hidden by default
*/
public void setHideByDefault(boolean hide);
/**
* Get hide/show default
* @return true if layer for set will be hidden by default
*/
public boolean getHideByDefault();
/**
* Set layer ordering priority (0=default, low before high in layer order)
*/
public void setLayerPriority(int prio);
/**
* Get layer ordering priority (0=default, low before high in layer order)
*/
public int getLayerPriority();
}

View File

@ -1,7 +1,7 @@
name: dynmap name: dynmap
main: org.dynmap.DynmapPlugin main: org.dynmap.DynmapPlugin
version: "${project.version}" version: "${project.version}"
authors: [FrozenCow, mikeprimm, zeeZ] authors: [FrozenCow, mikeprimm]
softdepend: [Permissions] softdepend: [Permissions]
commands: commands:
dynmap: dynmap: