diff --git a/src/de/craftinc/gates/dynmap/GateMarkerUtil.java b/src/de/craftinc/gates/dynmap/GateMarkerUtil.java index 31f0e65..9c2d216 100644 --- a/src/de/craftinc/gates/dynmap/GateMarkerUtil.java +++ b/src/de/craftinc/gates/dynmap/GateMarkerUtil.java @@ -16,6 +16,7 @@ */ package de.craftinc.gates.dynmap; +import static org.apache.commons.lang.StringEscapeUtils.escapeHtml; import de.craftinc.gates.Gate; import org.bukkit.Location; import org.dynmap.markers.Marker; @@ -80,6 +81,46 @@ public class GateMarkerUtil } + protected String getGateHTMLDescription(Gate gate) + { + final String gateId = "

"; + final String open = "

This gate is "; + final String hidden = " and hidden"; + final String preExitLink = "
Go to exit"; + final String end = "

"; + + String infoString = gateId + escapeHtml(gate.getId()) + open; + + if (gate.isOpen()) { + infoString += "open"; + } + else { + infoString = "closed"; + } + + if (gate.isHidden()) { + infoString += hidden; + } + + if (gate.getExit() != null) { + Location exit = gate.getExit(); + + infoString += preExitLink; + + infoString += "/?worldname=" + escapeHtml(exit.getWorld().getName()); + infoString += "&zoom=10&x=" + exit.getX(); + infoString += "&y=" + exit.getY(); + infoString += "&z=" + exit.getZ(); + + infoString += afterExitLink; + } + + infoString += end; + + return infoString; + } + public void addMarker(Gate gate) { if (gate.getLocation() == null) { @@ -91,7 +132,8 @@ public class GateMarkerUtil Location l = gate.getLocation(); MarkerIcon icon = this.gateIcon; - this.markerSet.createMarker(id, label, false, l.getWorld().getName(), l.getX(), l.getY(), l.getZ(), icon, false); + final Marker marker = this.markerSet.createMarker(id, label, false, l.getWorld().getName(), l.getX(), l.getY(), l.getZ(), icon, false); + marker.setDescription(this.getGateHTMLDescription(gate)); } @@ -113,6 +155,7 @@ public class GateMarkerUtil else { Location l = gate.getLocation(); m.setLocation(l.getWorld().getName(), l.getX(), l.getY(), l.getZ()); + m.setDescription(this.getGateHTMLDescription(gate)); } }