mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-28 19:47:45 +01:00
Handle fields in yaml config files with "/" - fix for #3533
This commit is contained in:
parent
2ef6bf35a5
commit
a40830434d
@ -6,7 +6,7 @@ dependencies {
|
||||
implementation 'org.eclipse.jetty:jetty-server:9.4.26.v20200117'
|
||||
implementation 'org.eclipse.jetty:jetty-servlet:9.4.26.v20200117'
|
||||
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
implementation 'org.yaml:snakeyaml:1.23'
|
||||
implementation 'org.yaml:snakeyaml:1.29'
|
||||
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1'
|
||||
implementation 'org.postgresql:postgresql:42.2.18'
|
||||
}
|
||||
|
@ -138,9 +138,11 @@ public class ConfigurationNode implements Map<String, Object> {
|
||||
public Object getObject(String path) {
|
||||
if (path.isEmpty())
|
||||
return entries;
|
||||
// Try get first (in case '/' is legit part
|
||||
Object v = get(path);
|
||||
int separator = path.indexOf('/');
|
||||
if (separator < 0)
|
||||
return get(path);
|
||||
if ((v != null) || (separator < 0)) return v;
|
||||
|
||||
String localKey = path.substring(0, separator);
|
||||
Object subvalue = get(localKey);
|
||||
if (subvalue == null)
|
||||
|
@ -452,10 +452,11 @@ class MarkerSetImpl implements MarkerSet {
|
||||
boolean loadPersistentData(ConfigurationNode node) {
|
||||
label = node.getString("label", setid); /* Get label */
|
||||
ConfigurationNode markernode = node.getNode("markers");
|
||||
if(markernode != null) {
|
||||
if (markernode != null) {
|
||||
for(String id : markernode.keySet()) {
|
||||
MarkerImpl marker = new MarkerImpl(id, this); /* Make and load marker */
|
||||
if(marker.loadPersistentData(markernode.getNode(id))) {
|
||||
ConfigurationNode cfg = markernode.getNode(id);
|
||||
if ((cfg != null) && marker.loadPersistentData(cfg)) {
|
||||
markers.put(id, marker);
|
||||
}
|
||||
else {
|
||||
@ -465,10 +466,11 @@ class MarkerSetImpl implements MarkerSet {
|
||||
}
|
||||
}
|
||||
ConfigurationNode areamarkernode = node.getNode("areas");
|
||||
if(areamarkernode != null) {
|
||||
if (areamarkernode != null) {
|
||||
for(String id : areamarkernode.keySet()) {
|
||||
AreaMarkerImpl marker = new AreaMarkerImpl(id, this); /* Make and load marker */
|
||||
if(marker.loadPersistentData(areamarkernode.getNode(id))) {
|
||||
ConfigurationNode cfg = areamarkernode.getNode(id);
|
||||
if ((cfg != null) && marker.loadPersistentData(cfg)) {
|
||||
areamarkers.put(id, marker);
|
||||
if(marker.getBoostFlag()) {
|
||||
if(boostingareamarkers == null) {
|
||||
@ -490,10 +492,11 @@ class MarkerSetImpl implements MarkerSet {
|
||||
}
|
||||
}
|
||||
ConfigurationNode linemarkernode = node.getNode("lines");
|
||||
if(linemarkernode != null) {
|
||||
if (linemarkernode != null) {
|
||||
for(String id : linemarkernode.keySet()) {
|
||||
PolyLineMarkerImpl marker = new PolyLineMarkerImpl(id, this); /* Make and load marker */
|
||||
if(marker.loadPersistentData(linemarkernode.getNode(id))) {
|
||||
ConfigurationNode cfg = linemarkernode.getNode(id);
|
||||
if ((cfg != null) && marker.loadPersistentData(cfg)) {
|
||||
linemarkers.put(id, marker);
|
||||
}
|
||||
else {
|
||||
@ -503,10 +506,11 @@ class MarkerSetImpl implements MarkerSet {
|
||||
}
|
||||
}
|
||||
ConfigurationNode circlemarkernode = node.getNode("circles");
|
||||
if(circlemarkernode != null) {
|
||||
if (circlemarkernode != null) {
|
||||
for(String id : circlemarkernode.keySet()) {
|
||||
CircleMarkerImpl marker = new CircleMarkerImpl(id, this); /* Make and load marker */
|
||||
if(marker.loadPersistentData(circlemarkernode.getNode(id))) {
|
||||
ConfigurationNode cfg = circlemarkernode.getNode(id);
|
||||
if ((cfg != null) && marker.loadPersistentData(cfg)) {
|
||||
circlemarkers.put(id, marker);
|
||||
if(marker.getBoostFlag()) {
|
||||
if(boostingcirclemarkers == null) {
|
||||
@ -528,7 +532,7 @@ class MarkerSetImpl implements MarkerSet {
|
||||
}
|
||||
}
|
||||
List<String> allowed = node.getList("allowedicons");
|
||||
if(allowed != null) {
|
||||
if (allowed != null) {
|
||||
for(String id : allowed) {
|
||||
MarkerIconImpl icon = MarkerAPIImpl.getMarkerIconImpl(id);
|
||||
if(icon != null)
|
||||
@ -542,12 +546,12 @@ class MarkerSetImpl implements MarkerSet {
|
||||
minzoom = node.getInteger("minzoom", -1);
|
||||
maxzoom = node.getInteger("maxzoom", -1);
|
||||
if (minzoom == 0) minzoom = -1;
|
||||
if(node.containsKey("showlabels"))
|
||||
if (node.containsKey("showlabels"))
|
||||
showlabels = node.getBoolean("showlabels", false);
|
||||
else
|
||||
showlabels = null;
|
||||
String defid = node.getString("deficon");
|
||||
if((defid != null) && (MarkerAPIImpl.api != null)) {
|
||||
if ((defid != null) && (MarkerAPIImpl.api != null)) {
|
||||
deficon = MarkerAPIImpl.getMarkerIconImpl(defid);
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user