Merge dynmap-api into common dynmap

This commit is contained in:
Mike Primm 2018-08-11 23:42:08 -05:00
parent d2a0f65173
commit f66e63fe45
18 changed files with 260 additions and 53 deletions

1
dynmap-api/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build/

23
dynmap-api/build.gradle Normal file
View file

@ -0,0 +1,23 @@
description = "dynmap-api"
dependencies {
compile group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT'
compile "us.dynmap:DynmapCoreAPI:${project.version}"
}
jar {
classifier = 'unshaded'
}
shadowJar {
dependencies {
include(dependency("us.dynmap:DynmapCoreAPI:"))
}
destinationDir = file '../target'
classifier = ''
}
artifacts {
archives shadowJar
}

View file

@ -0,0 +1,16 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
</fileSets>
<files>
<file>
<source>${project.build.directory}/${artifactId}-${version}.jar</source>
<outputDirectory>/</outputDirectory>
<destName>dynmap-api.jar</destName>
</file>
</files>
</assembly>

View file

@ -0,0 +1,67 @@
package org.dynmap;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
/**
* This is the interface representing the published API for the Dynmap plugin for Bukkit. 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.
*
* This interface is Bukkit specific.
*/
public interface DynmapAPI extends DynmapCommonAPI {
/**
* 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 (@deprecated return value - just returns 1)
*/
public int triggerRenderOfVolume(Location l0, Location l1);
/**
* Set player visibility
* @param player - player
* @param is_visible - true if visible, false if hidden
*/
public void setPlayerVisiblity(Player player, boolean is_visible);
/**
* Test if player is visible
* @return true if visible, false if not
*/
public boolean getPlayerVisbility(Player player);
/**
* Post message from player to web
* @param player - player
* @param message - message text
*/
public void postPlayerMessageToWeb(Player player, String message);
/**
* Post join/quit message for player to web
* @param player - player
* @param isjoin - if true, join message; if false, quit message
*/
public void postPlayerJoinQuitToWeb(Player player, boolean isjoin);
/**
* Get version of dynmap plugin
* @return version - format is "major.minor-build" or "major.minor.patch-build"
*/
public String getDynmapVersion();
/**
* Set player visibility (transient - if player is configured to be visible, they are hidden if one or more plugins assert their invisiblity)
* @param player - player ID
* @param is_invisible - true if asserting player should be invisible, false if no assertion
* @param plugin - asserting plugin
*/
public void assertPlayerInvisibility(Player player, boolean is_invisible, Plugin plugin);
/**
* Set player visibility (transient - if player is configured to be hidden, they are made visibile if one or more plugins assert their visibility))
* @param player - player
* @param is_visible - true if asserting that hidden player should be visible, false if no assertion
* @param plugin - asserting plugin
*/
public void assertPlayerVisibility(Player player, boolean is_visible, Plugin plugin);
}

View file

@ -0,0 +1,51 @@
package org.dynmap;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Custom Bukkit event, corresponding to the receiving of a web-chat message from a web UI user
*
* This interface is Bukkit specific.
*/
public class DynmapWebChatEvent extends Event implements Cancellable {
public static final String CUSTOM_TYPE = "org.dynmap.DynmapWebChatEvent";
private static final HandlerList handlers = new HandlerList();
private String source;
private String name;
private String message;
private boolean cancelled;
private boolean isprocessed;
public DynmapWebChatEvent(String source, String name, String message) {
this.source = source;
this.name = name;
this.message = message;
this.cancelled = false;
this.isprocessed = false;
}
@Override
public boolean isCancelled() { return cancelled; }
@Override
public void setCancelled(boolean cancel) { cancelled = cancel; }
public String getSource() { return source; }
public String getName() { return name; }
public String getMessage() { return message; }
/* Processed flag is used to mark message as handled by listener - if set, dynmap will not send it using broadcastMessage() */
public boolean isProcessed() { return isprocessed; }
public void setProcessed() { isprocessed = true; }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}