mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-02-03 06:01:28 +01:00
Add default configs, generalize CLI and Plugins into BlueMapService and reimplement Plugin and CLI
This commit is contained in:
parent
b9763a0963
commit
b6c4971420
@ -1,17 +0,0 @@
|
||||
accept-download: false
|
||||
metrics: true
|
||||
renderThreadCount: -2
|
||||
data: "bluemap"
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
webserver {
|
||||
enabled: true
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
liveUpdates {
|
||||
enabled: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapBukkit/src/main/resources/core-defaults.conf
Normal file
4
BlueMapBukkit/src/main/resources/core-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
accept-download: false
|
||||
renderThreadCount: -2
|
||||
metrics: true
|
||||
data: "bluemap"
|
31
BlueMapBukkit/src/main/resources/core.conf
Normal file
31
BlueMapBukkit/src/main/resources/core.conf
Normal file
@ -0,0 +1,31 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Core-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"bukkit","version":"%version%"}
|
||||
# Default is true
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
# Default is "bluemap"
|
||||
data: "bluemap"
|
5
BlueMapBukkit/src/main/resources/plugin-defaults.conf
Normal file
5
BlueMapBukkit/src/main/resources/plugin-defaults.conf
Normal file
@ -0,0 +1,5 @@
|
||||
liveUpdates: true
|
||||
skinDownload: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
27
BlueMapBukkit/src/main/resources/plugin.conf
Normal file
27
BlueMapBukkit/src/main/resources/plugin.conf
Normal file
@ -0,0 +1,27 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Plugin-Config ##
|
||||
## ##
|
||||
|
||||
# If the server should send live-updates and player-positions.
|
||||
# This only works if the integrated webserver is enabled.
|
||||
# Default is true
|
||||
liveUpdates: true
|
||||
|
||||
# Download the skin from mojang-serves when a player joins your server, so it can be used for the player-markers.
|
||||
# Default is true
|
||||
skinDownload: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
3
BlueMapBukkit/src/main/resources/render-defaults.conf
Normal file
3
BlueMapBukkit/src/main/resources/render-defaults.conf
Normal file
@ -0,0 +1,3 @@
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
maps: []
|
@ -1,68 +1,16 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## ##
|
||||
## by Blue (Lukas Rieger) ##
|
||||
## http://bluecolored.de/ ##
|
||||
## Render-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"bukkit","version":"%version%"}
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
data: "bluemap"
|
||||
|
||||
# The webroot of the website that displays the map.
|
||||
# The folder (webroot) where the map-data and web-application files will be saved.
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# Unncomment this to override the path where bluemap stores the data-files.
|
||||
# Default is "<webroot>/data"
|
||||
#webdata: "path/to/data/folder"
|
||||
|
||||
# If the web-application should use cookies to save the configurations of a user.
|
||||
# Default is true
|
||||
useCookies: true
|
||||
|
||||
webserver {
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "127.0.0.1"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
|
||||
# This is an array with multiple configured maps.
|
||||
# You can define multiple maps, for different worlds with different render-settings here
|
||||
maps: [
|
||||
@ -129,6 +77,16 @@ maps: [
|
||||
# Changing this value requires a re-render of the map.
|
||||
# Default is true
|
||||
useCompression: true
|
||||
|
||||
# Normally BlueMap detects if a chunk has not yet generated it's light-data and omits rendering those chunks.
|
||||
# If this is set to true BlueMap will render Chunks even if there is no light-data!
|
||||
# This can be usefull for example if some mod prevents light-data from being saved correctly.
|
||||
# However, this also has a few drawbacks:
|
||||
# - For those chunks, every block will always be fully lit
|
||||
# - Night-mode might not work correctly
|
||||
# - Caves will always be rendered (ignoring the 'renderCaves' setting)
|
||||
# Default is false
|
||||
ignoreMissingLightData: false
|
||||
}
|
||||
|
||||
# Here another example for the End-Map
|
||||
@ -166,23 +124,3 @@ maps: [
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
liveUpdates {
|
||||
# If the server should send live-updates and player-positions.
|
||||
# Default is true
|
||||
enabled: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapBukkit/src/main/resources/webserver-defaults.conf
Normal file
4
BlueMapBukkit/src/main/resources/webserver-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
enabled: true
|
||||
webroot: "bluemap/web"
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
29
BlueMapBukkit/src/main/resources/webserver.conf
Normal file
29
BlueMapBukkit/src/main/resources/webserver.conf
Normal file
@ -0,0 +1,29 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Webserver-Config ##
|
||||
## ##
|
||||
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The webroot that the server will host to the web.
|
||||
# Usually this should be set to the same directory like in the Core-Config!
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "123.45.6.78"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
@ -10,7 +10,7 @@ jar {
|
||||
}
|
||||
|
||||
build.dependsOn shadowJar {
|
||||
destinationDir = file '../build/release'
|
||||
destinationDir = file '../build/unsupported'
|
||||
archiveFileName = "BlueMap-${version}-cli.jar"
|
||||
|
||||
//relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math' //DON'T relocate this, because the API depends on it
|
||||
|
@ -32,14 +32,7 @@
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
@ -50,137 +43,47 @@
|
||||
import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
|
||||
import com.flowpowered.math.GenericMath;
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import de.bluecolored.bluemap.common.BlueMapWebServer;
|
||||
import de.bluecolored.bluemap.common.BlueMapService;
|
||||
import de.bluecolored.bluemap.common.MapType;
|
||||
import de.bluecolored.bluemap.common.MissingResourcesException;
|
||||
import de.bluecolored.bluemap.common.RenderManager;
|
||||
import de.bluecolored.bluemap.common.RenderTask;
|
||||
import de.bluecolored.bluemap.core.config.ConfigManager;
|
||||
import de.bluecolored.bluemap.core.config.CoreConfig;
|
||||
import de.bluecolored.bluemap.core.config.CoreConfig.MapConfig;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.config.WebServerConfig;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.mca.MCAWorld;
|
||||
import de.bluecolored.bluemap.core.metrics.Metrics;
|
||||
import de.bluecolored.bluemap.core.render.RenderSettings;
|
||||
import de.bluecolored.bluemap.core.render.TileRenderer;
|
||||
import de.bluecolored.bluemap.core.render.hires.HiresModelManager;
|
||||
import de.bluecolored.bluemap.core.render.lowres.LowresModelManager;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ResourcePack;
|
||||
import de.bluecolored.bluemap.core.web.WebFilesManager;
|
||||
import de.bluecolored.bluemap.core.web.FileRequestHandler;
|
||||
import de.bluecolored.bluemap.core.web.WebSettings;
|
||||
import de.bluecolored.bluemap.core.world.SlicedWorld;
|
||||
import de.bluecolored.bluemap.core.world.World;
|
||||
import de.bluecolored.bluemap.core.webserver.HttpRequestHandler;
|
||||
import de.bluecolored.bluemap.core.webserver.WebServer;
|
||||
|
||||
public class BlueMapCLI {
|
||||
|
||||
private ConfigManager configManager;
|
||||
private File configFolder;
|
||||
private ResourcePack resourcePack;
|
||||
private boolean forceRender;
|
||||
|
||||
public BlueMapCLI(ConfigManager configManager, File configFolder, boolean forceRender) {
|
||||
this.configManager = configManager;
|
||||
this.configFolder = configFolder;
|
||||
this.forceRender = forceRender;
|
||||
this.resourcePack = null;
|
||||
}
|
||||
|
||||
public void renderMaps() throws IOException {
|
||||
Preconditions.checkNotNull(resourcePack);
|
||||
public void renderMaps(BlueMapService blueMap, boolean forceRender, boolean forceGenerateWebapp) throws IOException {
|
||||
blueMap.createOrUpdateWebApp(forceGenerateWebapp);
|
||||
WebSettings webSettings = blueMap.updateWebAppSettings();
|
||||
|
||||
CoreConfig config = configManager.getCoreConfig();
|
||||
configManager.loadResourceConfigs(resourcePack);
|
||||
RenderManager renderManager = new RenderManager(blueMap.getCoreConfig().getRenderThreadCount());
|
||||
File rmstate = new File(blueMap.getCoreConfig().getDataFolder(), "rmstate");
|
||||
|
||||
config.getWebDataPath().toFile().mkdirs();
|
||||
|
||||
Map<String, MapType> maps = new HashMap<>();
|
||||
|
||||
for (MapConfig mapConfig : config.getMapConfigs()) {
|
||||
File worldFolder = new File(mapConfig.getWorldPath());
|
||||
if (!worldFolder.exists() || !worldFolder.isDirectory()) {
|
||||
throw new IOException("Save folder '" + worldFolder + "' does not exist or is not a directory!");
|
||||
}
|
||||
|
||||
Logger.global.logInfo("Preparing renderer for map '" + mapConfig.getId() + "' ...");
|
||||
World world = MCAWorld.load(worldFolder.toPath(), UUID.randomUUID(), configManager.getBlockIdConfig(), configManager.getBlockPropertiesConfig(), configManager.getBiomeConfig());
|
||||
|
||||
//slice world if configured
|
||||
if (!mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) || !mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX)) {
|
||||
if (mapConfig.isRenderEdges()) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
} else {
|
||||
world = new SlicedWorld(
|
||||
world,
|
||||
mapConfig.getMin().min(mapConfig.getMin().sub(2, 2, 2)), // protect from int-overflow
|
||||
mapConfig.getMax().max(mapConfig.getMax().add(2, 2, 2)) // protect from int-overflow
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HiresModelManager hiresModelManager = new HiresModelManager(
|
||||
config.getWebDataPath().resolve(mapConfig.getId()).resolve("hires"),
|
||||
resourcePack,
|
||||
mapConfig,
|
||||
new Vector2i(mapConfig.getHiresTileSize(), mapConfig.getHiresTileSize())
|
||||
);
|
||||
|
||||
LowresModelManager lowresModelManager = new LowresModelManager(
|
||||
config.getWebDataPath().resolve(mapConfig.getId()).resolve("lowres"),
|
||||
new Vector2i(mapConfig.getLowresPointsPerLowresTile(), mapConfig.getLowresPointsPerLowresTile()),
|
||||
new Vector2i(mapConfig.getLowresPointsPerHiresTile(), mapConfig.getLowresPointsPerHiresTile()),
|
||||
mapConfig.useGzipCompression()
|
||||
);
|
||||
|
||||
TileRenderer tileRenderer = new TileRenderer(hiresModelManager, lowresModelManager);
|
||||
|
||||
MapType mapType = new MapType(mapConfig.getId(), mapConfig.getName(), world, tileRenderer);
|
||||
maps.put(mapConfig.getId(), mapType);
|
||||
}
|
||||
|
||||
Logger.global.logInfo("Writing settings.json ...");
|
||||
WebSettings webSettings = new WebSettings(config.getWebDataPath().resolve("settings.json").toFile());
|
||||
webSettings.set(config.isUseCookies(), "useCookies");
|
||||
webSettings.setAllMapsEnabled(false);
|
||||
for (MapType map : maps.values()) {
|
||||
webSettings.setMapEnabled(true, map.getId());
|
||||
webSettings.setFrom(map.getTileRenderer(), map.getId());
|
||||
webSettings.setFrom(map.getWorld(), map.getId());
|
||||
}
|
||||
int ordinal = 0;
|
||||
for (MapConfig map : config.getMapConfigs()) {
|
||||
if (!maps.containsKey(map.getId())) continue; //don't add not loaded maps
|
||||
webSettings.setOrdinal(ordinal++, map.getId());
|
||||
webSettings.setFrom(map, map.getId());
|
||||
}
|
||||
webSettings.save();
|
||||
|
||||
Logger.global.logInfo("Writing textures.json ...");
|
||||
File textureExportFile = config.getWebDataPath().resolve("textures.json").toFile();
|
||||
resourcePack.saveTextureFile(textureExportFile);
|
||||
|
||||
RenderManager renderManager = new RenderManager(config.getRenderThreadCount());
|
||||
File rmstate = new File(configFolder, "rmstate");
|
||||
|
||||
if (rmstate.exists()) {
|
||||
if (!forceRender && rmstate.exists()) {
|
||||
try (
|
||||
InputStream in = new GZIPInputStream(new FileInputStream(rmstate));
|
||||
DataInputStream din = new DataInputStream(in);
|
||||
){
|
||||
renderManager.readState(din, maps.values());
|
||||
Logger.global.logInfo("Found unfinished render, continuing ... (If you want to start a new render, delete the this file: " + rmstate.getCanonicalPath());
|
||||
renderManager.readState(din, blueMap.getMaps().values());
|
||||
Logger.global.logInfo("Found unfinished render, continuing ... (If you want to start a new render, delete the this file: " + rmstate.getCanonicalPath() + " or force a full render using -f)");
|
||||
} catch (IOException ex) {
|
||||
Logger.global.logError("Failed to read saved render-state! Remove the file " + rmstate.getCanonicalPath() + " to start a new render.", ex);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
for (MapType map : maps.values()) {
|
||||
for (MapType map : blueMap.getMaps().values()) {
|
||||
Logger.global.logInfo("Creating render-task for map '" + map.getId() + "' ...");
|
||||
Logger.global.logInfo("Collecting tiles ...");
|
||||
|
||||
@ -214,6 +117,30 @@ public void renderMaps() throws IOException {
|
||||
Logger.global.logInfo("Starting render ...");
|
||||
renderManager.start();
|
||||
|
||||
Thread shutdownHook = new Thread(() -> {
|
||||
Logger.global.logInfo("Stopping render ...");
|
||||
renderManager.stop();
|
||||
|
||||
Logger.global.logInfo("Saving tiles ...");
|
||||
RenderTask currentTask = renderManager.getCurrentRenderTask();
|
||||
if (currentTask != null){
|
||||
currentTask.getMapType().getTileRenderer().save();
|
||||
}
|
||||
|
||||
Logger.global.logInfo("Saving render-state ...");
|
||||
try (
|
||||
OutputStream os = new GZIPOutputStream(new FileOutputStream(rmstate));
|
||||
DataOutputStream dos = new DataOutputStream(os);
|
||||
){
|
||||
renderManager.writeState(dos);
|
||||
|
||||
Logger.global.logInfo("Render saved and stopped! Restart the render (without using -f) to resume.");
|
||||
} catch (IOException ex) {
|
||||
Logger.global.logError("Failed to save render-state!", ex);
|
||||
}
|
||||
});
|
||||
Runtime.getRuntime().addShutdownHook(shutdownHook);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
long lastLogUpdate = startTime;
|
||||
@ -266,12 +193,16 @@ public void renderMaps() throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
renderManager.stop();
|
||||
//render finished and saved, so this is no longer needed
|
||||
Runtime.getRuntime().removeShutdownHook(shutdownHook);
|
||||
|
||||
//stop render-threads
|
||||
renderManager.stop();
|
||||
|
||||
//render finished, so remove render state file
|
||||
rmstate.delete();
|
||||
|
||||
for (MapType map : maps.values()) {
|
||||
for (MapType map : blueMap.getMaps().values()) {
|
||||
webSettings.set(startTime, "maps", map.getId(), "last-render");
|
||||
}
|
||||
|
||||
@ -284,134 +215,112 @@ public void renderMaps() throws IOException {
|
||||
Logger.global.logInfo("Render finished!");
|
||||
}
|
||||
|
||||
public void startWebserver() throws IOException {
|
||||
public void startWebserver(BlueMapService blueMap) throws IOException {
|
||||
Logger.global.logInfo("Starting webserver ...");
|
||||
|
||||
BlueMapWebServer webserver = new BlueMapWebServer(configManager.getCoreConfig());
|
||||
webserver.start();
|
||||
WebServerConfig config = blueMap.getWebServerConfig();
|
||||
HttpRequestHandler requestHandler = new FileRequestHandler(config.getWebRoot().toPath(), "BlueMap v" + BlueMap.VERSION);
|
||||
|
||||
WebServer webServer = new WebServer(
|
||||
config.getWebserverPort(),
|
||||
config.getWebserverMaxConnections(),
|
||||
config.getWebserverBindAdress(),
|
||||
requestHandler
|
||||
);
|
||||
webServer.start();
|
||||
}
|
||||
|
||||
private boolean loadResources() throws IOException, ParseResourceException {
|
||||
Logger.global.logInfo("Loading resources ...");
|
||||
|
||||
CoreConfig config = configManager.getCoreConfig();
|
||||
|
||||
File defaultResourceFile = config.getDataPath().resolve("minecraft-client-" + ResourcePack.MINECRAFT_CLIENT_VERSION + ".jar").toFile();
|
||||
File resourceExtensionsFile = config.getDataPath().resolve("resourceExtensions.zip").toFile();
|
||||
File textureExportFile = config.getWebDataPath().resolve("textures.json").toFile();
|
||||
|
||||
if (!defaultResourceFile.exists()) {
|
||||
if (!handleMissingResources(defaultResourceFile)) return false;
|
||||
}
|
||||
|
||||
resourceExtensionsFile.delete();
|
||||
FileUtils.copyURLToFile(BlueMapCLI.class.getResource("/resourceExtensions.zip"), resourceExtensionsFile, 10000, 10000);
|
||||
|
||||
//find more resource packs
|
||||
File resourcePackFolder = configFolder.toPath().resolve("resourcepacks").toFile();
|
||||
resourcePackFolder.mkdirs();
|
||||
File[] resourcePacks = resourcePackFolder.listFiles();
|
||||
Arrays.sort(resourcePacks); //load resource packs in alphabetical order so you can reorder them by renaming
|
||||
|
||||
List<File> resources = new ArrayList<>(resourcePacks.length + 1);
|
||||
resources.add(defaultResourceFile);
|
||||
for (File file : resourcePacks) resources.add(file);
|
||||
resources.add(resourceExtensionsFile);
|
||||
|
||||
resourcePack = new ResourcePack();
|
||||
if (textureExportFile.exists()) resourcePack.loadTextureFile(textureExportFile);
|
||||
resourcePack.load(resources);
|
||||
resourcePack.saveTextureFile(textureExportFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleMissingResources(File resourceFile) throws IOException {
|
||||
if (configManager.getCoreConfig().isDownloadAccepted()) {
|
||||
try {
|
||||
Logger.global.logInfo("Downloading " + ResourcePack.MINECRAFT_CLIENT_URL + " to " + resourceFile.getCanonicalPath() + " ...");
|
||||
ResourcePack.downloadDefaultResource(resourceFile);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("Failed to download resources!", e);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Logger.global.logWarning("BlueMap is missing important resources!");
|
||||
Logger.global.logWarning("You need to accept the download of the required files in order of BlueMap to work!");
|
||||
Logger.global.logWarning("Please check " + configManager.getCoreConfigFile().getCanonicalPath() + " and try again!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, ParseResourceException {
|
||||
public static void main(String[] args) {
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
|
||||
BlueMapCLI cli = new BlueMapCLI();
|
||||
BlueMapService blueMap = null;
|
||||
|
||||
try {
|
||||
CommandLine cmd = parser.parse(BlueMapCLI.createOptions(), args, false);
|
||||
|
||||
|
||||
//help
|
||||
if (cmd.hasOption("h")) {
|
||||
BlueMapCLI.printHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
//load config
|
||||
//config folder
|
||||
File configFolder = new File(".");
|
||||
if (cmd.hasOption("c")) {
|
||||
configFolder = new File(cmd.getOptionValue("c"));
|
||||
configFolder.mkdirs();
|
||||
}
|
||||
|
||||
URL cliConfigUrl = BlueMapCLI.class.getResource("/bluemap-cli.conf");
|
||||
URL cliDefaultsUrl = BlueMapCLI.class.getResource("/bluemap-cli-defaults.conf");
|
||||
|
||||
ConfigManager config = new ConfigManager(configFolder, cliConfigUrl, cliDefaultsUrl);
|
||||
boolean configCreated = !config.getCoreConfigFile().exists();
|
||||
config.loadMainConfig();
|
||||
|
||||
if (configCreated) {
|
||||
Logger.global.logInfo("No config file found! Created default config here: " + config.getCoreConfigFile().getCanonicalPath());
|
||||
return;
|
||||
}
|
||||
|
||||
WebFilesManager webFilesManager = new WebFilesManager(config.getCoreConfig().getWebRoot());
|
||||
if (webFilesManager.needsUpdate()) {
|
||||
Logger.global.logInfo("Updating webfiles in " + config.getCoreConfig().getWebRoot().normalize() + "...");
|
||||
webFilesManager.updateFiles();
|
||||
}
|
||||
|
||||
BlueMapCLI bluemap = new BlueMapCLI(config, configFolder, cmd.hasOption("f"));
|
||||
|
||||
if (config.getCoreConfig().isWebserverEnabled()) {
|
||||
//start webserver
|
||||
bluemap.startWebserver();
|
||||
blueMap = new BlueMapService(configFolder);
|
||||
boolean noActions = true;
|
||||
|
||||
//wait a second to let the webserver start, looks nicer in the log
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ignore) { Thread.currentThread().interrupt(); }
|
||||
if (cmd.hasOption("w")) {
|
||||
noActions = false;
|
||||
|
||||
cli.startWebserver(blueMap);
|
||||
Thread.sleep(1000); //wait a second to let the webserver start, looks nicer in the log if anything comes after that
|
||||
}
|
||||
|
||||
|
||||
if (!config.getCoreConfig().getMapConfigs().isEmpty()) {
|
||||
//load resources
|
||||
if (bluemap.loadResources()) {
|
||||
|
||||
//metrics
|
||||
if (config.getCoreConfig().isMetricsEnabled()) Metrics.sendReportAsync("CLI");
|
||||
|
||||
//render maps
|
||||
bluemap.renderMaps();
|
||||
|
||||
//since we don't need it any more, free some memory
|
||||
bluemap.resourcePack = null;
|
||||
if (cmd.hasOption("r")) {
|
||||
noActions = false;
|
||||
|
||||
boolean force = cmd.hasOption("f");
|
||||
cli.renderMaps(blueMap, force, cmd.hasOption("g"));
|
||||
} else {
|
||||
if (cmd.hasOption("g")) {
|
||||
noActions = false;
|
||||
blueMap.createOrUpdateWebApp(true);
|
||||
}
|
||||
if (cmd.hasOption("s")) {
|
||||
noActions = false;
|
||||
blueMap.updateWebAppSettings();
|
||||
}
|
||||
}
|
||||
|
||||
// if nothing has been defined to do
|
||||
if (noActions) {
|
||||
|
||||
if (
|
||||
!blueMap.getCoreConfigFile().exists() ||
|
||||
!blueMap.getRenderConfigFile().exists() ||
|
||||
!blueMap.getWebServerConfigFile().exists()
|
||||
) {
|
||||
Logger.global.logInfo("Generating default config files for you, here: " + configFolder.getCanonicalPath().toString() + "\n");
|
||||
}
|
||||
|
||||
//generate all configs
|
||||
blueMap.getCoreConfig();
|
||||
blueMap.getRenderConfig();
|
||||
blueMap.getWebServerConfig();
|
||||
|
||||
//print help
|
||||
BlueMapCLI.printHelp();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (MissingResourcesException e) {
|
||||
Logger.global.logWarning("BlueMap is missing important resources!");
|
||||
Logger.global.logWarning("You need to accept the download of the required files in order of BlueMap to work!");
|
||||
try { Logger.global.logWarning("Please check: " + blueMap.getCoreConfigFile().getCanonicalPath()); } catch (NullPointerException | IOException ignored) {}
|
||||
System.exit(2);
|
||||
return;
|
||||
} catch (ParseException e) {
|
||||
Logger.global.logError("Failed to parse provided arguments!", e);
|
||||
BlueMapCLI.printHelp();
|
||||
System.exit(1);
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("An IO-error occurred!", e);
|
||||
System.exit(1);
|
||||
return;
|
||||
} catch (InterruptedException ex) {
|
||||
System.exit(1);
|
||||
return;
|
||||
} catch (RuntimeException e) {
|
||||
Logger.global.logError("An unexpected error occurred!", e);
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -429,7 +338,13 @@ private static Options createOptions() {
|
||||
.desc("Sets path of the folder containing the configuration-files to use (configurations will be generated here if they don't exist)")
|
||||
.build()
|
||||
);
|
||||
|
||||
options.addOption("w", "webserver", false, "Starts the web-server, configured in the 'webserver.conf' file");
|
||||
|
||||
options.addOption("g", "generate-webapp", false, "Generates the files for the web-app to the folder, configured in the 'render.conf' file (this is done automatically when rendering if the 'index.html' file in the webroot can't be found)");
|
||||
options.addOption("s", "generate-websettings", false, "Generates the settings for the web-app, using the settings from the 'render.conf' file (this is done automatically when rendering)");
|
||||
|
||||
options.addOption("r", "render", false, "Renders the maps configured in the 'render.conf' file");
|
||||
options.addOption("f", "force-render", false, "Forces rendering everything, instead of only rendering chunks that have been modified since the last render");
|
||||
|
||||
return options;
|
||||
@ -438,7 +353,7 @@ private static Options createOptions() {
|
||||
private static void printHelp() {
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
|
||||
String filename = "bluemapcli.jar";
|
||||
String filename = "bluemap-cli.jar";
|
||||
try {
|
||||
File file = new File(BlueMapCLI.class.getProtectionDomain()
|
||||
.getCodeSource()
|
||||
@ -452,11 +367,22 @@ private static void printHelp() {
|
||||
filename = file.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {}
|
||||
} catch (IOException ignore) {}
|
||||
|
||||
String command = "java -jar " + filename;
|
||||
|
||||
formatter.printHelp(command + " [options]", "\nOptions:", createOptions(), "");
|
||||
StringBuilder footer = new StringBuilder();
|
||||
footer.append("Examples:\n\n");
|
||||
footer.append(command + " -c './config/'\n");
|
||||
footer.append("Generates the default/example configurations in a folder named 'config' if they are not already present\n\n");
|
||||
footer.append(command + " -r\n");
|
||||
footer.append("Render the configured maps\n\n");
|
||||
footer.append(command + " -w\n");
|
||||
footer.append("Start only the webserver without doing anything else\n\n");
|
||||
footer.append(command + " -gs\n");
|
||||
footer.append("Generate the web-app and settings without starting a render\n\n");
|
||||
|
||||
formatter.printHelp(command + " [options]", "\nOptions:", createOptions(), "\n" + footer.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
accept-download: false
|
||||
metrics: true
|
||||
renderThreadCount: 0
|
||||
data: "."
|
||||
webroot: "web"
|
||||
useCookies: true
|
||||
webserver {
|
||||
enabled: false
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
||||
}
|
4
BlueMapCLI/src/main/resources/core-defaults.conf
Normal file
4
BlueMapCLI/src/main/resources/core-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
accept-download: false
|
||||
renderThreadCount: 0
|
||||
metrics: true
|
||||
data: "data"
|
31
BlueMapCLI/src/main/resources/core.conf
Normal file
31
BlueMapCLI/src/main/resources/core.conf
Normal file
@ -0,0 +1,31 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Core-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is 0
|
||||
renderThreadCount: 0
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"bukkit","version":"%version%"}
|
||||
# Default is true
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
# Default is "data"
|
||||
data: "data"
|
3
BlueMapCLI/src/main/resources/render-defaults.conf
Normal file
3
BlueMapCLI/src/main/resources/render-defaults.conf
Normal file
@ -0,0 +1,3 @@
|
||||
webroot: "web"
|
||||
useCookies: true
|
||||
maps: []
|
@ -1,66 +1,16 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## ##
|
||||
## by Blue (Lukas Rieger) ##
|
||||
## http://bluecolored.de/ ##
|
||||
## Render-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is 0
|
||||
renderThreadCount: 0
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"cli","version":"%version%"}
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime
|
||||
data: "."
|
||||
|
||||
# The webroot of the website that displays the map.
|
||||
# The folder (webroot) where the map-data and web-application files will be saved.
|
||||
# Default is "web"
|
||||
webroot: "web"
|
||||
|
||||
# Unncomment this to override the path where bluemap stores the data-files.
|
||||
# Default is "<webroot>/data"
|
||||
#webdata: "path/to/data/folder"
|
||||
|
||||
# If the web-application should use cookies to save the configurations of a user.
|
||||
# Default is true
|
||||
useCookies: true
|
||||
|
||||
webserver {
|
||||
# With this setting you can enable the integrated web-server.
|
||||
# Default is disabled
|
||||
enabled: false
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "127.0.0.1"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
|
||||
# This is an array with multiple configured maps.
|
||||
# You can define multiple maps, for different worlds with different render-settings here
|
||||
maps: [
|
||||
@ -127,6 +77,16 @@ maps: [
|
||||
# Changing this value requires a re-render of the map.
|
||||
# Default is true
|
||||
useCompression: true
|
||||
|
||||
# Normally BlueMap detects if a chunk has not yet generated it's light-data and omits rendering those chunks.
|
||||
# If this is set to true BlueMap will render Chunks even if there is no light-data!
|
||||
# This can be usefull for example if some mod prevents light-data from being saved correctly.
|
||||
# However, this also has a few drawbacks:
|
||||
# - For those chunks, every block will always be fully lit
|
||||
# - Night-mode might not work correctly
|
||||
# - Caves will always be rendered (ignoring the 'renderCaves' setting)
|
||||
# Default is false
|
||||
ignoreMissingLightData: false
|
||||
}
|
||||
|
||||
# Here another example for the End-Map
|
4
BlueMapCLI/src/main/resources/webserver-defaults.conf
Normal file
4
BlueMapCLI/src/main/resources/webserver-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
enabled: true
|
||||
webroot: "web"
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
24
BlueMapCLI/src/main/resources/webserver.conf
Normal file
24
BlueMapCLI/src/main/resources/webserver.conf
Normal file
@ -0,0 +1,24 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Webserver-Config ##
|
||||
## ##
|
||||
|
||||
# The webroot that the server will host to the web.
|
||||
# Usually this should be set to the same directory like in the Core-Config!
|
||||
# Default is "web"
|
||||
webroot: "web"
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "123.45.6.78"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
@ -0,0 +1,336 @@
|
||||
/*
|
||||
* This file is part of BlueMap, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package de.bluecolored.bluemap.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
|
||||
import de.bluecolored.bluemap.common.plugin.Plugin;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.core.config.ConfigManager;
|
||||
import de.bluecolored.bluemap.core.config.CoreConfig;
|
||||
import de.bluecolored.bluemap.core.config.MapConfig;
|
||||
import de.bluecolored.bluemap.core.config.RenderConfig;
|
||||
import de.bluecolored.bluemap.core.config.WebServerConfig;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.mca.MCAWorld;
|
||||
import de.bluecolored.bluemap.core.render.RenderSettings;
|
||||
import de.bluecolored.bluemap.core.render.TileRenderer;
|
||||
import de.bluecolored.bluemap.core.render.hires.HiresModelManager;
|
||||
import de.bluecolored.bluemap.core.render.lowres.LowresModelManager;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ResourcePack;
|
||||
import de.bluecolored.bluemap.core.web.WebFilesManager;
|
||||
import de.bluecolored.bluemap.core.web.WebSettings;
|
||||
import de.bluecolored.bluemap.core.world.SlicedWorld;
|
||||
import de.bluecolored.bluemap.core.world.World;
|
||||
|
||||
/**
|
||||
* This is the attempt to generalize as many actions as possible to have CLI and Plugins run on the same general setup-code.
|
||||
*/
|
||||
public class BlueMapService {
|
||||
private File configFolder;
|
||||
private ThrowingFunction<File, UUID, IOException> worldUUIDProvider;
|
||||
private ThrowingFunction<UUID, String, IOException> worldNameProvider;
|
||||
|
||||
private ConfigManager configManager;
|
||||
private boolean resourceConfigLoaded = false;
|
||||
|
||||
private CoreConfig coreConfig;
|
||||
private RenderConfig renderConfig;
|
||||
private WebServerConfig webServerConfig;
|
||||
|
||||
private ResourcePack resourcePack;
|
||||
|
||||
private Map<UUID, World> worlds;
|
||||
private Map<String, MapType> maps;
|
||||
|
||||
public BlueMapService(File configFolder) {
|
||||
this.configFolder = configFolder;
|
||||
|
||||
Map<File, UUID> uuids = new HashMap<>();
|
||||
this.worldUUIDProvider = file -> {
|
||||
UUID uuid = uuids.get(file);
|
||||
if (uuid == null) {
|
||||
uuid = UUID.randomUUID();
|
||||
uuids.put(file, uuid);
|
||||
}
|
||||
return uuid;
|
||||
};
|
||||
|
||||
this.worldNameProvider = uuid -> null;
|
||||
|
||||
configManager = new ConfigManager();
|
||||
}
|
||||
|
||||
public BlueMapService(ServerInterface serverInterface) {
|
||||
this.configFolder = serverInterface.getConfigFolder();
|
||||
this.worldUUIDProvider = serverInterface::getUUIDForWorld;
|
||||
this.worldNameProvider = serverInterface::getWorldName;
|
||||
|
||||
this.configManager = new ConfigManager();
|
||||
}
|
||||
|
||||
public synchronized void createOrUpdateWebApp(boolean force) throws IOException {
|
||||
WebFilesManager webFilesManager = new WebFilesManager(getRenderConfig().getWebRoot());
|
||||
if (force || webFilesManager.needsUpdate()) {
|
||||
webFilesManager.updateFiles();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized WebSettings updateWebAppSettings() throws IOException {
|
||||
WebSettings webSettings = new WebSettings(new File(getRenderConfig().getWebRoot(), "data" + File.separator + "settings.json"));
|
||||
webSettings.set(getRenderConfig().isUseCookies(), "useCookies");
|
||||
webSettings.setAllMapsEnabled(false);
|
||||
for (MapType map : getMaps().values()) {
|
||||
webSettings.setMapEnabled(true, map.getId());
|
||||
webSettings.setFrom(map.getTileRenderer(), map.getId());
|
||||
webSettings.setFrom(map.getWorld(), map.getId());
|
||||
}
|
||||
int ordinal = 0;
|
||||
for (MapConfig map : getRenderConfig().getMapConfigs()) {
|
||||
if (!getMaps().containsKey(map.getId())) continue; //don't add not loaded maps
|
||||
webSettings.setOrdinal(ordinal++, map.getId());
|
||||
webSettings.setFrom(map, map.getId());
|
||||
}
|
||||
webSettings.save();
|
||||
|
||||
return webSettings;
|
||||
}
|
||||
|
||||
public synchronized Map<UUID, World> getWorlds() throws IOException {
|
||||
if (worlds == null) loadWorldsAndMaps();
|
||||
return worlds;
|
||||
}
|
||||
|
||||
public synchronized Map<String, MapType> getMaps() throws IOException {
|
||||
if (maps == null) loadWorldsAndMaps();
|
||||
return maps;
|
||||
}
|
||||
|
||||
private synchronized void loadWorldsAndMaps() throws IOException {
|
||||
maps = new HashMap<>();
|
||||
worlds = new HashMap<>();
|
||||
|
||||
for (MapConfig mapConfig : getRenderConfig().getMapConfigs()) {
|
||||
String id = mapConfig.getId();
|
||||
String name = mapConfig.getName();
|
||||
|
||||
File worldFolder = new File(mapConfig.getWorldPath());
|
||||
if (!worldFolder.exists() || !worldFolder.isDirectory()) {
|
||||
Logger.global.logWarning("Failed to load map '" + id + "': '" + worldFolder.getCanonicalPath() + "' does not exist or is no directory!");
|
||||
continue;
|
||||
}
|
||||
|
||||
UUID worldUUID;
|
||||
try {
|
||||
worldUUID = worldUUIDProvider.apply(worldFolder);
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("Failed to load map '" + id + "': Failed to get UUID for the world!", e);
|
||||
continue;
|
||||
}
|
||||
|
||||
World world = worlds.get(worldUUID);
|
||||
if (world == null) {
|
||||
try {
|
||||
world = MCAWorld.load(worldFolder.toPath(), worldUUID, getConfigManager().getBlockIdConfig(), getConfigManager().getBlockPropertiesConfig(), getConfigManager().getBiomeConfig(), worldNameProvider.apply(worldUUID), true);
|
||||
worlds.put(worldUUID, world);
|
||||
} catch (MissingResourcesException e) {
|
||||
throw e; // rethrow this to stop loading and display resource-missing message
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("Failed to load map '" + id + "': Failed to read level.dat", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//slice world if configured
|
||||
if (!mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) || !mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX)) {
|
||||
if (mapConfig.isRenderEdges()) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
} else {
|
||||
world = new SlicedWorld(
|
||||
world,
|
||||
mapConfig.getMin().min(mapConfig.getMin().sub(2, 2, 2)), // protect from int-overflow
|
||||
mapConfig.getMax().max(mapConfig.getMax().add(2, 2, 2)) // protect from int-overflow
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HiresModelManager hiresModelManager = new HiresModelManager(
|
||||
getRenderConfig().getWebRoot().toPath().resolve("data").resolve(id).resolve("hires"),
|
||||
getResourcePack(),
|
||||
mapConfig,
|
||||
new Vector2i(mapConfig.getHiresTileSize(), mapConfig.getHiresTileSize())
|
||||
);
|
||||
|
||||
LowresModelManager lowresModelManager = new LowresModelManager(
|
||||
getRenderConfig().getWebRoot().toPath().resolve("data").resolve(id).resolve("lowres"),
|
||||
new Vector2i(mapConfig.getLowresPointsPerLowresTile(), mapConfig.getLowresPointsPerLowresTile()),
|
||||
new Vector2i(mapConfig.getLowresPointsPerHiresTile(), mapConfig.getLowresPointsPerHiresTile()),
|
||||
mapConfig.useGzipCompression()
|
||||
);
|
||||
|
||||
TileRenderer tileRenderer = new TileRenderer(hiresModelManager, lowresModelManager);
|
||||
|
||||
MapType mapType = new MapType(id, name, world, tileRenderer);
|
||||
maps.put(id, mapType);
|
||||
}
|
||||
|
||||
worlds = Collections.unmodifiableMap(worlds);
|
||||
maps = Collections.unmodifiableMap(maps);
|
||||
}
|
||||
|
||||
public synchronized ResourcePack getResourcePack() throws IOException, MissingResourcesException {
|
||||
if (resourcePack == null) {
|
||||
File defaultResourceFile = new File(getCoreConfig().getDataFolder(), "minecraft-client-" + ResourcePack.MINECRAFT_CLIENT_VERSION + ".jar");
|
||||
File resourceExtensionsFile = new File(getCoreConfig().getDataFolder(), "resourceExtensions.zip");
|
||||
|
||||
File textureExportFile = new File(getRenderConfig().getWebRoot(), "data" + File.separator + "textures.json");
|
||||
|
||||
if (!defaultResourceFile.exists()) {
|
||||
if (getCoreConfig().isDownloadAccepted()) {
|
||||
|
||||
//download file
|
||||
try {
|
||||
Logger.global.logInfo("Downloading " + ResourcePack.MINECRAFT_CLIENT_URL + " to " + defaultResourceFile + " ...");
|
||||
ResourcePack.downloadDefaultResource(defaultResourceFile);
|
||||
} catch (IOException e) {
|
||||
throw new IOException("Failed to download resources!", e);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new MissingResourcesException();
|
||||
}
|
||||
}
|
||||
|
||||
Logger.global.logInfo("Loading resources...");
|
||||
|
||||
resourceExtensionsFile.delete();
|
||||
FileUtils.copyURLToFile(Plugin.class.getResource("/resourceExtensions.zip"), resourceExtensionsFile, 10000, 10000);
|
||||
|
||||
//find more resource packs
|
||||
File resourcePackFolder = new File(configFolder, "resourcepacks");
|
||||
resourcePackFolder.mkdirs();
|
||||
File[] resourcePacks = resourcePackFolder.listFiles();
|
||||
Arrays.sort(resourcePacks); //load resource packs in alphabetical order so you can reorder them by renaming
|
||||
|
||||
List<File> resources = new ArrayList<>(resourcePacks.length + 1);
|
||||
resources.add(defaultResourceFile);
|
||||
for (File file : resourcePacks) resources.add(file);
|
||||
resources.add(resourceExtensionsFile);
|
||||
|
||||
try {
|
||||
resourcePack = new ResourcePack();
|
||||
if (textureExportFile.exists()) resourcePack.loadTextureFile(textureExportFile);
|
||||
resourcePack.load(resources);
|
||||
resourcePack.saveTextureFile(textureExportFile);
|
||||
} catch (ParseResourceException e) {
|
||||
throw new IOException("Failed to parse resources!", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return resourcePack;
|
||||
}
|
||||
|
||||
public synchronized ConfigManager getConfigManager() throws IOException {
|
||||
if (!resourceConfigLoaded) {
|
||||
configManager.loadResourceConfigs(configFolder, getResourcePack());
|
||||
resourceConfigLoaded = true;
|
||||
}
|
||||
|
||||
return configManager;
|
||||
}
|
||||
|
||||
public File getCoreConfigFile() {
|
||||
return new File(configFolder, "core.conf");
|
||||
}
|
||||
|
||||
public synchronized CoreConfig getCoreConfig() throws IOException {
|
||||
if (coreConfig == null) {
|
||||
coreConfig = new CoreConfig(configManager.loadOrCreate(
|
||||
getCoreConfigFile(),
|
||||
Plugin.class.getResource("/core.conf"),
|
||||
Plugin.class.getResource("/core-defaults.conf"),
|
||||
true,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
return coreConfig;
|
||||
}
|
||||
|
||||
public File getRenderConfigFile() {
|
||||
return new File(configFolder, "render.conf");
|
||||
}
|
||||
|
||||
public synchronized RenderConfig getRenderConfig() throws IOException {
|
||||
if (renderConfig == null) {
|
||||
renderConfig = new RenderConfig(configManager.loadOrCreate(
|
||||
getRenderConfigFile(),
|
||||
Plugin.class.getResource("/render.conf"),
|
||||
Plugin.class.getResource("/render-defaults.conf"),
|
||||
true,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
return renderConfig;
|
||||
}
|
||||
|
||||
public File getWebServerConfigFile() {
|
||||
return new File(configFolder, "webserver.conf");
|
||||
}
|
||||
|
||||
public synchronized WebServerConfig getWebServerConfig() throws IOException {
|
||||
if (webServerConfig == null) {
|
||||
webServerConfig = new WebServerConfig(configManager.loadOrCreate(
|
||||
getWebServerConfigFile(),
|
||||
Plugin.class.getResource("/webserver.conf"),
|
||||
Plugin.class.getResource("/webserver-defaults.conf"),
|
||||
true,
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
return webServerConfig;
|
||||
}
|
||||
|
||||
public File getConfigFolder() {
|
||||
return configFolder;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of BlueMap, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package de.bluecolored.bluemap.common;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class MissingResourcesException extends IOException {
|
||||
private static final long serialVersionUID = 2084565069965755048L;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of BlueMap, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package de.bluecolored.bluemap.common;
|
||||
|
||||
public interface ThrowingFunction<T, R, E extends Throwable> {
|
||||
|
||||
R apply(T t) throws E;
|
||||
|
||||
}
|
@ -30,234 +30,96 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
|
||||
import de.bluecolored.bluemap.common.BlueMapService;
|
||||
import de.bluecolored.bluemap.common.MapType;
|
||||
import de.bluecolored.bluemap.common.MissingResourcesException;
|
||||
import de.bluecolored.bluemap.common.RenderManager;
|
||||
import de.bluecolored.bluemap.common.api.BlueMapAPIImpl;
|
||||
import de.bluecolored.bluemap.common.live.LiveAPIRequestHandler;
|
||||
import de.bluecolored.bluemap.common.plugin.serverinterface.ServerInterface;
|
||||
import de.bluecolored.bluemap.common.plugin.skins.PlayerSkinUpdater;
|
||||
import de.bluecolored.bluemap.core.BlueMap;
|
||||
import de.bluecolored.bluemap.core.config.ConfigManager;
|
||||
import de.bluecolored.bluemap.core.config.CoreConfig;
|
||||
import de.bluecolored.bluemap.core.config.MapConfig;
|
||||
import de.bluecolored.bluemap.core.config.RenderConfig;
|
||||
import de.bluecolored.bluemap.core.config.WebServerConfig;
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.mca.MCAWorld;
|
||||
import de.bluecolored.bluemap.core.metrics.Metrics;
|
||||
import de.bluecolored.bluemap.core.render.RenderSettings;
|
||||
import de.bluecolored.bluemap.core.render.TileRenderer;
|
||||
import de.bluecolored.bluemap.core.render.hires.HiresModelManager;
|
||||
import de.bluecolored.bluemap.core.render.lowres.LowresModelManager;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
|
||||
import de.bluecolored.bluemap.core.resourcepack.ResourcePack;
|
||||
import de.bluecolored.bluemap.core.web.FileRequestHandler;
|
||||
import de.bluecolored.bluemap.core.web.WebFilesManager;
|
||||
import de.bluecolored.bluemap.core.web.WebSettings;
|
||||
import de.bluecolored.bluemap.core.webserver.HttpRequestHandler;
|
||||
import de.bluecolored.bluemap.core.webserver.WebServer;
|
||||
import de.bluecolored.bluemap.core.world.SlicedWorld;
|
||||
import de.bluecolored.bluemap.core.world.World;
|
||||
|
||||
public class Plugin {
|
||||
|
||||
public static final String PLUGIN_ID = "bluemap";
|
||||
public static final String PLUGIN_NAME = "BlueMap";
|
||||
|
||||
private BlueMapAPIImpl api;
|
||||
|
||||
|
||||
private String implementationType;
|
||||
|
||||
private ServerInterface serverInterface;
|
||||
|
||||
private ConfigManager configManager;
|
||||
private CoreConfig coreConfig;
|
||||
private RenderConfig renderConfig;
|
||||
private WebServerConfig webServerConfig;
|
||||
private PluginConfig pluginConfig;
|
||||
|
||||
private ResourcePack resourcePack;
|
||||
|
||||
private BlueMapService blueMap;
|
||||
private BlueMapAPIImpl api;
|
||||
|
||||
private Map<UUID, World> worlds;
|
||||
private Map<String, MapType> maps;
|
||||
|
||||
private MapUpdateHandler updateHandler;
|
||||
private PlayerSkinUpdater skinUpdater;
|
||||
|
||||
private RenderManager renderManager;
|
||||
private WebServer webServer;
|
||||
|
||||
private Thread periodicalSaveThread;
|
||||
private Thread metricsThread;
|
||||
|
||||
|
||||
private PluginConfig pluginConfig;
|
||||
private MapUpdateHandler updateHandler;
|
||||
private PlayerSkinUpdater skinUpdater;
|
||||
|
||||
private boolean loaded = false;
|
||||
|
||||
public Plugin(String implementationType, ServerInterface serverInterface) {
|
||||
this.implementationType = implementationType.toLowerCase();
|
||||
|
||||
this.serverInterface = serverInterface;
|
||||
|
||||
this.maps = new HashMap<>();
|
||||
this.worlds = new HashMap<>();
|
||||
}
|
||||
|
||||
public synchronized void load() throws IOException, ParseResourceException {
|
||||
if (loaded) return;
|
||||
unload(); //ensure nothing is left running (from a failed load or something)
|
||||
|
||||
configManager = new ConfigManager();
|
||||
|
||||
//load core config
|
||||
File coreConfigFile = new File(serverInterface.getConfigFolder(), "core.conf");
|
||||
coreConfig = new CoreConfig(configManager.loadOrCreate(
|
||||
coreConfigFile,
|
||||
Plugin.class.getResource("/core.conf"),
|
||||
Plugin.class.getResource("/core-defaults.conf"),
|
||||
true,
|
||||
true
|
||||
));
|
||||
blueMap = new BlueMapService(serverInterface);
|
||||
|
||||
//load resources
|
||||
File defaultResourceFile = new File(coreConfig.getDataFolder(), "minecraft-client-" + ResourcePack.MINECRAFT_CLIENT_VERSION + ".jar");
|
||||
File resourceExtensionsFile = new File(coreConfig.getDataFolder(), "resourceExtensions.zip");
|
||||
File textureExportFile = new File(coreConfig.getDataFolder(), "textures.json");
|
||||
CoreConfig coreConfig = blueMap.getCoreConfig();
|
||||
RenderConfig renderConfig = blueMap.getRenderConfig();
|
||||
WebServerConfig webServerConfig = blueMap.getWebServerConfig();
|
||||
|
||||
if (!defaultResourceFile.exists()) {
|
||||
if (coreConfig.isDownloadAccepted()) {
|
||||
|
||||
//download file
|
||||
try {
|
||||
Logger.global.logInfo("Downloading " + ResourcePack.MINECRAFT_CLIENT_URL + " to " + defaultResourceFile + " ...");
|
||||
ResourcePack.downloadDefaultResource(defaultResourceFile);
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("Failed to download resources!", e);
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
Logger.global.logWarning("BlueMap is missing important resources!");
|
||||
Logger.global.logWarning("You need to accept the download of the required files in order of BlueMap to work!");
|
||||
try { Logger.global.logWarning("Please check: " + coreConfigFile.getCanonicalPath()); } catch (IOException ignored) {}
|
||||
Logger.global.logInfo("If you have changed the config you can simply reload the plugin using: /bluemap reload");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
resourceExtensionsFile.delete();
|
||||
FileUtils.copyURLToFile(Plugin.class.getResource("/resourceExtensions.zip"), resourceExtensionsFile, 10000, 10000);
|
||||
|
||||
//find more resource packs
|
||||
File resourcePackFolder = new File(serverInterface.getConfigFolder(), "resourcepacks");
|
||||
resourcePackFolder.mkdirs();
|
||||
File[] resourcePacks = resourcePackFolder.listFiles();
|
||||
Arrays.sort(resourcePacks); //load resource packs in alphabetical order so you can reorder them by renaming
|
||||
|
||||
List<File> resources = new ArrayList<>(resourcePacks.length + 1);
|
||||
resources.add(defaultResourceFile);
|
||||
for (File file : resourcePacks) resources.add(file);
|
||||
resources.add(resourceExtensionsFile);
|
||||
|
||||
resourcePack = new ResourcePack();
|
||||
if (textureExportFile.exists()) resourcePack.loadTextureFile(textureExportFile);
|
||||
resourcePack.load(resources);
|
||||
resourcePack.saveTextureFile(textureExportFile);
|
||||
|
||||
configManager.loadResourceConfigs(serverInterface.getConfigFolder(), resourcePack);
|
||||
|
||||
//load render-config
|
||||
renderConfig = new RenderConfig(configManager.loadOrCreate(
|
||||
new File(serverInterface.getConfigFolder(), "render.conf"),
|
||||
Plugin.class.getResource("/render.conf"),
|
||||
Plugin.class.getResource("/render-defaults.conf"),
|
||||
true,
|
||||
true
|
||||
));
|
||||
|
||||
//load maps
|
||||
for (MapConfig mapConfig : renderConfig.getMapConfigs()) {
|
||||
String id = mapConfig.getId();
|
||||
String name = mapConfig.getName();
|
||||
//try load resources
|
||||
try {
|
||||
blueMap.getResourcePack();
|
||||
} catch (MissingResourcesException ex) {
|
||||
Logger.global.logWarning("BlueMap is missing important resources!");
|
||||
Logger.global.logWarning("You need to accept the download of the required files in order of BlueMap to work!");
|
||||
try { Logger.global.logWarning("Please check: " + blueMap.getCoreConfigFile().getCanonicalPath()); } catch (IOException ignored) {}
|
||||
Logger.global.logInfo("If you have changed the config you can simply reload the plugin using: /bluemap reload");
|
||||
|
||||
File worldFolder = new File(mapConfig.getWorldPath());
|
||||
if (!worldFolder.exists() || !worldFolder.isDirectory()) {
|
||||
Logger.global.logError("Failed to load map '" + id + "': '" + worldFolder.getCanonicalPath() + "' does not exist or is no directory!", new IOException());
|
||||
continue;
|
||||
}
|
||||
|
||||
UUID worldUUID;
|
||||
try {
|
||||
worldUUID = serverInterface.getUUIDForWorld(worldFolder);
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("Failed to load map '" + id + "': Failed to get UUID for the world!", e);
|
||||
continue;
|
||||
}
|
||||
|
||||
World world = worlds.get(worldUUID);
|
||||
if (world == null) {
|
||||
try {
|
||||
world = MCAWorld.load(worldFolder.toPath(), worldUUID, configManager.getBlockIdConfig(), configManager.getBlockPropertiesConfig(), configManager.getBiomeConfig(), serverInterface.getWorldName(worldUUID), true);
|
||||
worlds.put(worldUUID, world);
|
||||
} catch (IOException e) {
|
||||
Logger.global.logError("Failed to load map '" + id + "': Failed to read level.dat", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//slice world if configured
|
||||
if (!mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) || !mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX)) {
|
||||
if (mapConfig.isRenderEdges()) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
} else {
|
||||
world = new SlicedWorld(
|
||||
world,
|
||||
mapConfig.getMin().min(mapConfig.getMin().sub(2, 2, 2)), // protect from int-overflow
|
||||
mapConfig.getMax().max(mapConfig.getMax().add(2, 2, 2)) // protect from int-overflow
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HiresModelManager hiresModelManager = new HiresModelManager(
|
||||
renderConfig.getWebRoot().toPath().resolve("data").resolve(id).resolve("hires"),
|
||||
resourcePack,
|
||||
mapConfig,
|
||||
new Vector2i(mapConfig.getHiresTileSize(), mapConfig.getHiresTileSize())
|
||||
);
|
||||
|
||||
LowresModelManager lowresModelManager = new LowresModelManager(
|
||||
renderConfig.getWebRoot().toPath().resolve("data").resolve(id).resolve("lowres"),
|
||||
new Vector2i(mapConfig.getLowresPointsPerLowresTile(), mapConfig.getLowresPointsPerLowresTile()),
|
||||
new Vector2i(mapConfig.getLowresPointsPerHiresTile(), mapConfig.getLowresPointsPerHiresTile()),
|
||||
mapConfig.useGzipCompression()
|
||||
);
|
||||
|
||||
TileRenderer tileRenderer = new TileRenderer(hiresModelManager, lowresModelManager);
|
||||
|
||||
MapType mapType = new MapType(id, name, world, tileRenderer);
|
||||
maps.put(id, mapType);
|
||||
}
|
||||
|
||||
if (maps.isEmpty()) {
|
||||
Logger.global.logWarning("There are no valid maps configured, please check your render-config! Disabling BlueMap...");
|
||||
unload();
|
||||
return;
|
||||
}
|
||||
|
||||
//load worlds and maps
|
||||
worlds = blueMap.getWorlds();
|
||||
maps = blueMap.getMaps();
|
||||
|
||||
//warn if no maps are configured
|
||||
if (maps.isEmpty()) {
|
||||
Logger.global.logWarning("There are no valid maps configured, please check your render-config! Disabling BlueMap...");
|
||||
}
|
||||
|
||||
//initialize render manager
|
||||
renderManager = new RenderManager(coreConfig.getRenderThreadCount());
|
||||
renderManager.start();
|
||||
@ -296,31 +158,12 @@ public synchronized void load() throws IOException, ParseResourceException {
|
||||
this.updateHandler = new MapUpdateHandler(this);
|
||||
serverInterface.registerListener(updateHandler);
|
||||
|
||||
//create/update web-app
|
||||
WebFilesManager webFilesManager = new WebFilesManager(renderConfig.getWebRoot());
|
||||
if (webFilesManager.needsUpdate()) {
|
||||
webFilesManager.updateFiles();
|
||||
}
|
||||
|
||||
//create/update web-app settings
|
||||
WebSettings webSettings = new WebSettings(new File(renderConfig.getWebRoot(), "data" + File.separator + "settings.json"));
|
||||
webSettings.set(renderConfig.isUseCookies(), "useCookies");
|
||||
webSettings.setAllMapsEnabled(false);
|
||||
for (MapType map : maps.values()) {
|
||||
webSettings.setMapEnabled(true, map.getId());
|
||||
webSettings.setFrom(map.getTileRenderer(), map.getId());
|
||||
webSettings.setFrom(map.getWorld(), map.getId());
|
||||
}
|
||||
int ordinal = 0;
|
||||
for (MapConfig map : renderConfig.getMapConfigs()) {
|
||||
if (!maps.containsKey(map.getId())) continue; //don't add not loaded maps
|
||||
webSettings.setOrdinal(ordinal++, map.getId());
|
||||
webSettings.setFrom(map, map.getId());
|
||||
}
|
||||
webSettings.save();
|
||||
//update webapp and settings
|
||||
blueMap.createOrUpdateWebApp(false);
|
||||
blueMap.updateWebAppSettings();
|
||||
|
||||
//load plugin config
|
||||
pluginConfig = new PluginConfig(configManager.loadOrCreate(
|
||||
pluginConfig = new PluginConfig(blueMap.getConfigManager().loadOrCreate(
|
||||
new File(serverInterface.getConfigFolder(), "plugin.conf"),
|
||||
Plugin.class.getResource("/plugin.conf"),
|
||||
Plugin.class.getResource("/plugin-defaults.conf"),
|
||||
@ -334,15 +177,6 @@ public synchronized void load() throws IOException, ParseResourceException {
|
||||
serverInterface.registerListener(skinUpdater);
|
||||
}
|
||||
|
||||
//load webserver config
|
||||
webServerConfig = new WebServerConfig(configManager.loadOrCreate(
|
||||
new File(serverInterface.getConfigFolder(), "webserver.conf"),
|
||||
Plugin.class.getResource("/webserver.conf"),
|
||||
Plugin.class.getResource("/webserver-defaults.conf"),
|
||||
true,
|
||||
true
|
||||
));
|
||||
|
||||
//create and start webserver
|
||||
if (webServerConfig.isWebserverEnabled()) {
|
||||
HttpRequestHandler requestHandler = new FileRequestHandler(webServerConfig.getWebRoot().toPath(), "BlueMap v" + BlueMap.VERSION);
|
||||
@ -368,6 +202,7 @@ public synchronized void load() throws IOException, ParseResourceException {
|
||||
|
||||
while (true) {
|
||||
if (serverInterface.isMetricsEnabled(coreConfig.isMetricsEnabled())) Metrics.sendReport(this.implementationType);
|
||||
|
||||
Thread.sleep(TimeUnit.MINUTES.toMillis(30));
|
||||
}
|
||||
} catch (InterruptedException ex){
|
||||
@ -423,21 +258,20 @@ public synchronized void unload() {
|
||||
}
|
||||
|
||||
//save renders
|
||||
for (MapType map : maps.values()) {
|
||||
map.getTileRenderer().save();
|
||||
if (maps != null) {
|
||||
for (MapType map : maps.values()) {
|
||||
map.getTileRenderer().save();
|
||||
}
|
||||
}
|
||||
|
||||
//clear resources and configs
|
||||
blueMap = null;
|
||||
worlds = null;
|
||||
maps = null;
|
||||
renderManager = null;
|
||||
webServer = null;
|
||||
updateHandler = null;
|
||||
resourcePack = null;
|
||||
coreConfig = null;
|
||||
renderConfig = null;
|
||||
webServerConfig = null;
|
||||
pluginConfig = null;
|
||||
maps.clear();
|
||||
worlds.clear();
|
||||
|
||||
loaded = false;
|
||||
}
|
||||
@ -462,24 +296,24 @@ public ServerInterface getServerInterface() {
|
||||
return serverInterface;
|
||||
}
|
||||
|
||||
public CoreConfig getCoreConfig() {
|
||||
return coreConfig;
|
||||
public CoreConfig getCoreConfig() throws IOException {
|
||||
return blueMap.getCoreConfig();
|
||||
}
|
||||
|
||||
public RenderConfig getRenderConfig() {
|
||||
return renderConfig;
|
||||
public RenderConfig getRenderConfig() throws IOException {
|
||||
return blueMap.getRenderConfig();
|
||||
}
|
||||
|
||||
public WebServerConfig getWebServerConfig() {
|
||||
return webServerConfig;
|
||||
public WebServerConfig getWebServerConfig() throws IOException {
|
||||
return blueMap.getWebServerConfig();
|
||||
}
|
||||
|
||||
public PluginConfig getPluginConfig() {
|
||||
return pluginConfig;
|
||||
}
|
||||
|
||||
public ResourcePack getResourcePack() {
|
||||
return resourcePack;
|
||||
public ResourcePack getResourcePack() throws IOException {
|
||||
return blueMap.getResourcePack();
|
||||
}
|
||||
|
||||
public World getWorld(UUID uuid){
|
||||
@ -498,10 +332,10 @@ public RenderManager getRenderManager() {
|
||||
return renderManager;
|
||||
}
|
||||
|
||||
public File getRenderManagerSaveFile() {
|
||||
if (coreConfig == null) return null;
|
||||
public File getRenderManagerSaveFile() throws IOException {
|
||||
if (blueMap == null) return null;
|
||||
|
||||
File saveFile = new File(coreConfig.getDataFolder(), "rmstate");
|
||||
File saveFile = new File(blueMap.getCoreConfig().getDataFolder(), "rmstate");
|
||||
saveFile.getParentFile().mkdirs();
|
||||
|
||||
return saveFile;
|
||||
|
@ -19,7 +19,7 @@ dependencies {
|
||||
|
||||
processResources {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'core.json'
|
||||
include 'version.json'
|
||||
|
||||
expand (
|
||||
version: project.version
|
||||
|
@ -250,7 +250,6 @@ public static File toFolder(String pathString) throws IOException {
|
||||
|
||||
File file = new File(pathString);
|
||||
if (file.exists() && !file.isDirectory()) throw new IOException("Invalid configuration: Path '" + file.getAbsolutePath() + "' is a file (should be a directory)");
|
||||
if (!file.exists() && !file.mkdirs()) throw new IOException("Invalid configuration: Folders to path '" + file.getAbsolutePath() + "' could not be created");
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ public CoreConfig(ConfigurationNode node) throws IOException {
|
||||
}
|
||||
|
||||
public File getDataFolder() {
|
||||
if (!dataFolder.exists()) dataFolder.mkdirs();
|
||||
return dataFolder;
|
||||
}
|
||||
|
||||
|
@ -49,13 +49,14 @@ public RenderConfig(ConfigurationNode node) throws IOException {
|
||||
|
||||
//maps
|
||||
mapConfigs = new ArrayList<>();
|
||||
for (ConfigurationNode mapConfigNode : node.getChildrenList()) {
|
||||
for (ConfigurationNode mapConfigNode : node.getNode("maps").getChildrenList()) {
|
||||
mapConfigs.add(new MapConfig(mapConfigNode));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public File getWebRoot() {
|
||||
if (!webRoot.exists()) webRoot.mkdirs();
|
||||
return webRoot;
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ public boolean isWebserverEnabled() {
|
||||
}
|
||||
|
||||
public File getWebRoot() {
|
||||
if (!webRoot.exists()) webRoot.mkdirs();
|
||||
return webRoot;
|
||||
}
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
accept-download: false
|
||||
metrics: true
|
||||
renderThreadCount: -2
|
||||
data: "bluemap"
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
webserver {
|
||||
enabled: true
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
liveUpdates {
|
||||
enabled: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapFabric/src/main/resources/core-defaults.conf
Normal file
4
BlueMapFabric/src/main/resources/core-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
accept-download: false
|
||||
renderThreadCount: -2
|
||||
metrics: true
|
||||
data: "bluemap"
|
31
BlueMapFabric/src/main/resources/core.conf
Normal file
31
BlueMapFabric/src/main/resources/core.conf
Normal file
@ -0,0 +1,31 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Core-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"bukkit","version":"%version%"}
|
||||
# Default is true
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
# Default is "bluemap"
|
||||
data: "bluemap"
|
5
BlueMapFabric/src/main/resources/plugin-defaults.conf
Normal file
5
BlueMapFabric/src/main/resources/plugin-defaults.conf
Normal file
@ -0,0 +1,5 @@
|
||||
liveUpdates: true
|
||||
skinDownload: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
27
BlueMapFabric/src/main/resources/plugin.conf
Normal file
27
BlueMapFabric/src/main/resources/plugin.conf
Normal file
@ -0,0 +1,27 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Plugin-Config ##
|
||||
## ##
|
||||
|
||||
# If the server should send live-updates and player-positions.
|
||||
# This only works if the integrated webserver is enabled.
|
||||
# Default is true
|
||||
liveUpdates: true
|
||||
|
||||
# Download the skin from mojang-serves when a player joins your server, so it can be used for the player-markers.
|
||||
# Default is true
|
||||
skinDownload: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
3
BlueMapFabric/src/main/resources/render-defaults.conf
Normal file
3
BlueMapFabric/src/main/resources/render-defaults.conf
Normal file
@ -0,0 +1,3 @@
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
maps: []
|
@ -1,62 +1,16 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## ##
|
||||
## by Blue (Lukas Rieger) ##
|
||||
## http://bluecolored.de/ ##
|
||||
## Render-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
data: "bluemap"
|
||||
|
||||
# The webroot of the website that displays the map.
|
||||
# The folder (webroot) where the map-data and web-application files will be saved.
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# Unncomment this to override the path where bluemap stores the data-files.
|
||||
# Default is "<webroot>/data"
|
||||
#webdata: "path/to/data/folder"
|
||||
|
||||
# If the web-application should use cookies to save the configurations of a user.
|
||||
# Default is true
|
||||
useCookies: true
|
||||
|
||||
webserver {
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "127.0.0.1"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
|
||||
# This is an array with multiple configured maps.
|
||||
# You can define multiple maps, for different worlds with different render-settings here
|
||||
maps: [
|
||||
@ -123,6 +77,16 @@ maps: [
|
||||
# Changing this value requires a re-render of the map.
|
||||
# Default is true
|
||||
useCompression: true
|
||||
|
||||
# Normally BlueMap detects if a chunk has not yet generated it's light-data and omits rendering those chunks.
|
||||
# If this is set to true BlueMap will render Chunks even if there is no light-data!
|
||||
# This can be usefull for example if some mod prevents light-data from being saved correctly.
|
||||
# However, this also has a few drawbacks:
|
||||
# - For those chunks, every block will always be fully lit
|
||||
# - Night-mode might not work correctly
|
||||
# - Caves will always be rendered (ignoring the 'renderCaves' setting)
|
||||
# Default is false
|
||||
ignoreMissingLightData: false
|
||||
}
|
||||
|
||||
# Here another example for the End-Map
|
||||
@ -160,23 +124,3 @@ maps: [
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
liveUpdates {
|
||||
# If the server should send live-updates and player-positions.
|
||||
# Default is true
|
||||
enabled: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapFabric/src/main/resources/webserver-defaults.conf
Normal file
4
BlueMapFabric/src/main/resources/webserver-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
enabled: true
|
||||
webroot: "bluemap/web"
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
29
BlueMapFabric/src/main/resources/webserver.conf
Normal file
29
BlueMapFabric/src/main/resources/webserver.conf
Normal file
@ -0,0 +1,29 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Webserver-Config ##
|
||||
## ##
|
||||
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The webroot that the server will host to the web.
|
||||
# Usually this should be set to the same directory like in the Core-Config!
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "123.45.6.78"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
@ -1,17 +0,0 @@
|
||||
accept-download: false
|
||||
metrics: true
|
||||
renderThreadCount: -2
|
||||
data: "bluemap"
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
webserver {
|
||||
enabled: true
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
liveUpdates {
|
||||
enabled: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapForge/src/main/resources/core-defaults.conf
Normal file
4
BlueMapForge/src/main/resources/core-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
accept-download: false
|
||||
renderThreadCount: -2
|
||||
metrics: true
|
||||
data: "bluemap"
|
31
BlueMapForge/src/main/resources/core.conf
Normal file
31
BlueMapForge/src/main/resources/core.conf
Normal file
@ -0,0 +1,31 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Core-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"bukkit","version":"%version%"}
|
||||
# Default is true
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
# Default is "bluemap"
|
||||
data: "bluemap"
|
5
BlueMapForge/src/main/resources/plugin-defaults.conf
Normal file
5
BlueMapForge/src/main/resources/plugin-defaults.conf
Normal file
@ -0,0 +1,5 @@
|
||||
liveUpdates: true
|
||||
skinDownload: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
27
BlueMapForge/src/main/resources/plugin.conf
Normal file
27
BlueMapForge/src/main/resources/plugin.conf
Normal file
@ -0,0 +1,27 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Plugin-Config ##
|
||||
## ##
|
||||
|
||||
# If the server should send live-updates and player-positions.
|
||||
# This only works if the integrated webserver is enabled.
|
||||
# Default is true
|
||||
liveUpdates: true
|
||||
|
||||
# Download the skin from mojang-serves when a player joins your server, so it can be used for the player-markers.
|
||||
# Default is true
|
||||
skinDownload: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
3
BlueMapForge/src/main/resources/render-defaults.conf
Normal file
3
BlueMapForge/src/main/resources/render-defaults.conf
Normal file
@ -0,0 +1,3 @@
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
maps: []
|
@ -1,68 +1,16 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## ##
|
||||
## by Blue (Lukas Rieger) ##
|
||||
## http://bluecolored.de/ ##
|
||||
## Render-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"forge","version":"%version%"}
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
data: "bluemap"
|
||||
|
||||
# The webroot of the website that displays the map.
|
||||
# The folder (webroot) where the map-data and web-application files will be saved.
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# Unncomment this to override the path where bluemap stores the data-files.
|
||||
# Default is "<webroot>/data"
|
||||
#webdata: "path/to/data/folder"
|
||||
|
||||
# If the web-application should use cookies to save the configurations of a user.
|
||||
# Default is true
|
||||
useCookies: true
|
||||
|
||||
webserver {
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "127.0.0.1"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
|
||||
# This is an array with multiple configured maps.
|
||||
# You can define multiple maps, for different worlds with different render-settings here
|
||||
maps: [
|
||||
@ -129,6 +77,16 @@ maps: [
|
||||
# Changing this value requires a re-render of the map.
|
||||
# Default is true
|
||||
useCompression: true
|
||||
|
||||
# Normally BlueMap detects if a chunk has not yet generated it's light-data and omits rendering those chunks.
|
||||
# If this is set to true BlueMap will render Chunks even if there is no light-data!
|
||||
# This can be usefull for example if some mod prevents light-data from being saved correctly.
|
||||
# However, this also has a few drawbacks:
|
||||
# - For those chunks, every block will always be fully lit
|
||||
# - Night-mode might not work correctly
|
||||
# - Caves will always be rendered (ignoring the 'renderCaves' setting)
|
||||
# Default is false
|
||||
ignoreMissingLightData: false
|
||||
}
|
||||
|
||||
# Here another example for the End-Map
|
||||
@ -166,23 +124,3 @@ maps: [
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
liveUpdates {
|
||||
# If the server should send live-updates and player-positions.
|
||||
# Default is true
|
||||
enabled: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapForge/src/main/resources/webserver-defaults.conf
Normal file
4
BlueMapForge/src/main/resources/webserver-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
enabled: true
|
||||
webroot: "bluemap/web"
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
29
BlueMapForge/src/main/resources/webserver.conf
Normal file
29
BlueMapForge/src/main/resources/webserver.conf
Normal file
@ -0,0 +1,29 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Webserver-Config ##
|
||||
## ##
|
||||
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The webroot that the server will host to the web.
|
||||
# Usually this should be set to the same directory like in the Core-Config!
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "123.45.6.78"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
@ -1,17 +0,0 @@
|
||||
accept-download: false
|
||||
metrics: false
|
||||
renderThreadCount: -2
|
||||
data: "bluemap"
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
webserver {
|
||||
enabled: true
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
liveUpdates {
|
||||
enabled: true
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapSponge/src/main/resources/core-defaults.conf
Normal file
4
BlueMapSponge/src/main/resources/core-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
accept-download: false
|
||||
renderThreadCount: -2
|
||||
metrics: false
|
||||
data: "bluemap"
|
25
BlueMapSponge/src/main/resources/core.conf
Normal file
25
BlueMapSponge/src/main/resources/core.conf
Normal file
@ -0,0 +1,25 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Core-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
# Default is "bluemap"
|
||||
data: "bluemap"
|
5
BlueMapSponge/src/main/resources/plugin-defaults.conf
Normal file
5
BlueMapSponge/src/main/resources/plugin-defaults.conf
Normal file
@ -0,0 +1,5 @@
|
||||
liveUpdates: true
|
||||
skinDownload: false
|
||||
hiddenGameModes: []
|
||||
hideInvisible: true
|
||||
hideSneaking: false
|
27
BlueMapSponge/src/main/resources/plugin.conf
Normal file
27
BlueMapSponge/src/main/resources/plugin.conf
Normal file
@ -0,0 +1,27 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Plugin-Config ##
|
||||
## ##
|
||||
|
||||
# If the server should send live-updates and player-positions.
|
||||
# This only works if the integrated webserver is enabled.
|
||||
# Default is true
|
||||
liveUpdates: true
|
||||
|
||||
# Download the skin from mojang-serves when a player joins your server, so it can be used for the player-markers.
|
||||
# Default is false
|
||||
skinDownload: false
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
3
BlueMapSponge/src/main/resources/render-defaults.conf
Normal file
3
BlueMapSponge/src/main/resources/render-defaults.conf
Normal file
@ -0,0 +1,3 @@
|
||||
webroot: "bluemap/web"
|
||||
useCookies: true
|
||||
maps: []
|
@ -1,68 +1,16 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## ##
|
||||
## by Blue (Lukas Rieger) ##
|
||||
## http://bluecolored.de/ ##
|
||||
## Render-Config ##
|
||||
## ##
|
||||
|
||||
# By changing the setting (accept-download) below to TRUE you are indicating that you have accepted mojang's EULA (https://account.mojang.com/documents/minecraft_eula),
|
||||
# you confirm that you own a license to Minecraft (Java Edition)
|
||||
# and you agree that BlueMap will download and use this file for you: %minecraft-client-url%
|
||||
# (Alternatively you can download the file yourself and store it here: <data>/minecraft-client-%minecraft-client-version%.jar)
|
||||
# This file contains resources that belong to mojang and you must not redistribute it or do anything else that is not compliant with mojang's EULA.
|
||||
# BlueMap uses resources in this file to generate the 3D-Models used for the map and texture them. (BlueMap will not work without those resources.)
|
||||
# %datetime-iso%
|
||||
accept-download: false
|
||||
|
||||
# This changes the amount of threads that BlueMap will use to render the maps.
|
||||
# A higher value can improve render-speed but could impact performance on the host machine.
|
||||
# This should be always below or equal to the number of available processor-cores.
|
||||
# Zero or a negative value means the amount of of available processor-cores subtracted by the value.
|
||||
# (So a value of -2 with 6 cores results in 4 render-processes)
|
||||
# Default is -2
|
||||
renderThreadCount: -2
|
||||
|
||||
# If this is true, BlueMap might send really basic metrics reports containg only the implementation-type and the version that is being used to https://metrics.bluecolored.de/bluemap/
|
||||
# This allows me to track the basic usage of BlueMap and helps me stay motivated to further develop this tool! Please leave it on :)
|
||||
# An example report looks like this: {"implementation":"forge","version":"%version%"}
|
||||
metrics: true
|
||||
|
||||
# The folder where bluemap saves data-files it needs during runtime or to save e.g. the render-progress to resume it later.
|
||||
data: "bluemap"
|
||||
|
||||
# The webroot of the website that displays the map.
|
||||
# The folder (webroot) where the map-data and web-application files will be saved.
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# Unncomment this to override the path where bluemap stores the data-files.
|
||||
# Default is "<webroot>/data"
|
||||
#webdata: "path/to/data/folder"
|
||||
|
||||
# If the web-application should use cookies to save the configurations of a user.
|
||||
# Default is true
|
||||
useCookies: true
|
||||
|
||||
webserver {
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "127.0.0.1"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
||||
}
|
||||
|
||||
# This is an array with multiple configured maps.
|
||||
# You can define multiple maps, for different worlds with different render-settings here
|
||||
maps: [
|
||||
@ -129,6 +77,16 @@ maps: [
|
||||
# Changing this value requires a re-render of the map.
|
||||
# Default is true
|
||||
useCompression: true
|
||||
|
||||
# Normally BlueMap detects if a chunk has not yet generated it's light-data and omits rendering those chunks.
|
||||
# If this is set to true BlueMap will render Chunks even if there is no light-data!
|
||||
# This can be usefull for example if some mod prevents light-data from being saved correctly.
|
||||
# However, this also has a few drawbacks:
|
||||
# - For those chunks, every block will always be fully lit
|
||||
# - Night-mode might not work correctly
|
||||
# - Caves will always be rendered (ignoring the 'renderCaves' setting)
|
||||
# Default is false
|
||||
ignoreMissingLightData: false
|
||||
}
|
||||
|
||||
# Here another example for the End-Map
|
||||
@ -166,23 +124,3 @@ maps: [
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
liveUpdates {
|
||||
# If the server should send live-updates and player-positions.
|
||||
# Default is true
|
||||
enabled: true
|
||||
|
||||
# A list of gamemodes that will prevent a player from appearing on the map.
|
||||
# Possible values are: survival, creative, spectator, adventure
|
||||
hiddenGameModes: [
|
||||
"spectator"
|
||||
]
|
||||
|
||||
# If this is true, players that have an invisibility (potion-)effect will be hidden on the map.
|
||||
# Default is true
|
||||
hideInvisible: true
|
||||
|
||||
# If this is true, players that are sneaking will be hidden on the map.
|
||||
# Default is false
|
||||
hideSneaking: false
|
||||
}
|
4
BlueMapSponge/src/main/resources/webserver-defaults.conf
Normal file
4
BlueMapSponge/src/main/resources/webserver-defaults.conf
Normal file
@ -0,0 +1,4 @@
|
||||
enabled: true
|
||||
webroot: "bluemap/web"
|
||||
port: 8100
|
||||
maxConnectionCount: 100
|
29
BlueMapSponge/src/main/resources/webserver.conf
Normal file
29
BlueMapSponge/src/main/resources/webserver.conf
Normal file
@ -0,0 +1,29 @@
|
||||
## ##
|
||||
## BlueMap ##
|
||||
## Webserver-Config ##
|
||||
## ##
|
||||
|
||||
# With this setting you can disable the integrated web-server.
|
||||
# This is usefull if you want to only render the map-data for later use, or if you setup your own webserver.
|
||||
# Default is enabled
|
||||
enabled: true
|
||||
|
||||
# The webroot that the server will host to the web.
|
||||
# Usually this should be set to the same directory like in the Core-Config!
|
||||
# Default is "bluemap/web"
|
||||
webroot: "bluemap/web"
|
||||
|
||||
# The IP-Adress that the webserver binds to.
|
||||
# Use "0.0.0.0" to bind to all available local adresses.
|
||||
# If you only want to access it locally use "localhost".
|
||||
# Default is "0.0.0.0"
|
||||
#ip: "localhost"
|
||||
#ip: "123.45.6.78"
|
||||
|
||||
# The port that the webserver listenes to.
|
||||
# Default is 8100
|
||||
port: 8100
|
||||
|
||||
# Max number of simultaneous connections that the webserver allows
|
||||
# Default is 100
|
||||
maxConnectionCount: 100
|
Loading…
Reference in New Issue
Block a user