Push BlueMapAPI

This commit is contained in:
Lukas Rieger (Blue) 2022-07-28 22:58:16 +02:00
parent 879e4f993d
commit cd3a607022
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
3 changed files with 74 additions and 1 deletions

@ -1 +1 @@
Subproject commit 99804c3aae0cb6e748506aa0fb9e0a6996fc4f01
Subproject commit 92c438e0996bd3f0a034d4cf90b192f2d7017eac

View File

@ -1,5 +1,6 @@
package de.bluecolored.bluemap.common.config;
import de.bluecolored.bluemap.api.markers.MarkerSet;
import de.bluecolored.bluemap.common.BlueMapConfigProvider;
import de.bluecolored.bluemap.common.config.storage.StorageConfig;
import de.bluecolored.bluemap.common.serverinterface.ServerInterface;
@ -273,6 +274,33 @@ public class BlueMapConfigs implements BlueMapConfigProvider {
return mapConfigs;
}
private synchronized Map<String, Map<String, MarkerSet>> loadMarkerConfigs() throws ConfigurationException {
Map<String, Map<String, MarkerSet>> markerConfigs = new HashMap<>();
Path markerFolder = Paths.get("markers");
Path markerConfigFolder = configManager.getConfigRoot().resolve(markerFolder);
if (!Files.exists(markerConfigFolder)){
try {
Files.createDirectories(markerConfigFolder);
for (var mapConfigEntry : mapConfigs.entrySet()) {
Files.writeString(
markerConfigFolder.resolve(mapConfigEntry.getKey() + ".conf"),
configManager.loadConfigTemplate("/de/bluecolored/bluemap/config/markers/markers.conf")
.setVariable("map", mapConfig.getId())
.build(),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
);
}
} catch (IOException | NullPointerException ex) {
throw new ConfigurationException("BlueMap failed to create default marker-configuration-files in\n" +
markerConfigFolder.toAbsolutePath().normalize() + "\n" +
"Check if BlueMap has the permission to create and read from this folder.",
ex);
}
}
}
private synchronized Map<String, StorageConfig> loadStorageConfigs(Path defaultWebroot) throws ConfigurationException {
Map<String, StorageConfig> storageConfigs = new HashMap<>();

View File

@ -0,0 +1,45 @@
## ##
## BlueMap ##
## Marker-Config ##
## ##
exampleMarkerSet {
label: "Example Marker Set"
toggleable: true
defaultHidden: false
markers {
examplePoiMarker {
type: "poi"
position: { x: 13, y: 62, z: -37 }
label: "Example Poi Marker"
icon: "assets/poi.svg"
anchor: { x: 25, y: 45 }
minDistance: 10.0
maxDistance: 1000.0
}
exampleShapeMarker {
type: "shape"
position: { x: 13, y: 62, z: -37 }
label: "Example Shape Marker"
detail: "This is a detail text for the marker."
shape: [
{ x: 23, z: 33 }
{ x: -15, z: 33 }
{ x: -15, z: -10 }
{ x: 23, z: -10 }
]
shapeY: 64
depthTest: false
lineWidth: 2
lineColor: { r: 255, g: 0, b: 0, a: 1.0 }
fillColor: { r: 200, g: 0, b: 0, a: 0.3 }
minDistance: 100.0
maxDistance: 100000.0
}
}
}