mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Handle manual edits of markers.yml, update of non-markup values
This commit is contained in:
parent
04ef31fa3b
commit
b85a159bda
@ -325,6 +325,9 @@ public class Client {
|
|||||||
case '>':
|
case '>':
|
||||||
str.append(">");
|
str.append(">");
|
||||||
break;
|
break;
|
||||||
|
case '\'':
|
||||||
|
str.append("'");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
str.append(c);
|
str.append(c);
|
||||||
break;
|
break;
|
||||||
|
@ -120,8 +120,8 @@ class AreaMarkerImpl implements AreaMarker, EnterExitMarker {
|
|||||||
* @param node - configuration node
|
* @param node - configuration node
|
||||||
*/
|
*/
|
||||||
boolean loadPersistentData(ConfigurationNode node) {
|
boolean loadPersistentData(ConfigurationNode node) {
|
||||||
label = node.getString("label", markerid);
|
|
||||||
markup = node.getBoolean("markup", false);
|
markup = node.getBoolean("markup", false);
|
||||||
|
label = MarkerAPIImpl.escapeForHTMLIfNeeded(node.getString("label", markerid), markup);
|
||||||
ytop = node.getDouble("ytop", 64.0);
|
ytop = node.getDouble("ytop", 64.0);
|
||||||
ybottom = node.getDouble("ybottom", 64.0);
|
ybottom = node.getDouble("ybottom", 64.0);
|
||||||
List<Double> xx = node.getList("x");
|
List<Double> xx = node.getList("x");
|
||||||
|
@ -102,8 +102,8 @@ class CircleMarkerImpl implements CircleMarker, EnterExitMarker {
|
|||||||
* @param node - configuration node
|
* @param node - configuration node
|
||||||
*/
|
*/
|
||||||
boolean loadPersistentData(ConfigurationNode node) {
|
boolean loadPersistentData(ConfigurationNode node) {
|
||||||
label = node.getString("label", markerid);
|
|
||||||
markup = node.getBoolean("markup", false);
|
markup = node.getBoolean("markup", false);
|
||||||
|
label = MarkerAPIImpl.escapeForHTMLIfNeeded(node.getString("label", markerid), markup);
|
||||||
world = node.getString("world", "world");
|
world = node.getString("world", "world");
|
||||||
normalized_world = DynmapWorld.normalizeWorldName(world);
|
normalized_world = DynmapWorld.normalizeWorldName(world);
|
||||||
x = node.getDouble("x", 0);
|
x = node.getDouble("x", 0);
|
||||||
|
@ -3558,4 +3558,22 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
|
|||||||
ms.addEnteredMarkers(entered, worldid, x, y, z);
|
ms.addEnteredMarkers(entered, worldid, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Check if loaded string needs to be escaped (if non-markup)
|
||||||
|
*/
|
||||||
|
public static String escapeForHTMLIfNeeded(String txt, boolean markup) {
|
||||||
|
if (markup) return txt; // Not needed for markup
|
||||||
|
// If escaped properly, these characters aren't present (all but ampersand of HTML active characrers
|
||||||
|
if (txt != null) {
|
||||||
|
if ((txt.indexOf('<') >= 0) || (txt.indexOf('>') >= 0) || (txt.indexOf('\'') >= 0) || (txt.indexOf('"') >= 0)) {
|
||||||
|
return Client.encodeForHTML(txt);
|
||||||
|
}
|
||||||
|
// If ampersand without semicolon after (simplistic check for ampersand without being escape sequence)
|
||||||
|
int idx = txt.lastIndexOf('&');
|
||||||
|
if ((idx >= 0) && (txt.indexOf(';', idx) < 0)) {
|
||||||
|
return Client.encodeForHTML(txt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,8 @@ class MarkerImpl implements Marker {
|
|||||||
* @param node - configuration node
|
* @param node - configuration node
|
||||||
*/
|
*/
|
||||||
boolean loadPersistentData(ConfigurationNode node) {
|
boolean loadPersistentData(ConfigurationNode node) {
|
||||||
label = node.getString("label", markerid);
|
|
||||||
markup = node.getBoolean("markup", false);
|
markup = node.getBoolean("markup", false);
|
||||||
|
label = MarkerAPIImpl.escapeForHTMLIfNeeded(node.getString("label", markerid), markup);
|
||||||
x = node.getDouble("x", 0);
|
x = node.getDouble("x", 0);
|
||||||
y = node.getDouble("y", 64);
|
y = node.getDouble("y", 64);
|
||||||
z = node.getDouble("z", 0);
|
z = node.getDouble("z", 0);
|
||||||
|
@ -87,8 +87,8 @@ class PolyLineMarkerImpl implements PolyLineMarker {
|
|||||||
* @param node - configuration node
|
* @param node - configuration node
|
||||||
*/
|
*/
|
||||||
boolean loadPersistentData(ConfigurationNode node) {
|
boolean loadPersistentData(ConfigurationNode node) {
|
||||||
label = node.getString("label", markerid);
|
|
||||||
markup = node.getBoolean("markup", false);
|
markup = node.getBoolean("markup", false);
|
||||||
|
label = MarkerAPIImpl.escapeForHTMLIfNeeded(node.getString("label", markerid), markup);
|
||||||
List<Double> xx = node.getList("x");
|
List<Double> xx = node.getList("x");
|
||||||
List<Double> yy = node.getList("y");
|
List<Double> yy = node.getList("y");
|
||||||
List<Double> zz = node.getList("z");
|
List<Double> zz = node.getList("z");
|
||||||
|
Loading…
Reference in New Issue
Block a user