Fix config formatting and render-thread-calculation

This commit is contained in:
Lukas Rieger (Blue) 2022-04-24 15:56:03 +02:00
parent e555d558b7
commit 492573c866
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
5 changed files with 11 additions and 4 deletions

View File

@ -26,6 +26,13 @@ public int getRenderThreadCount() {
return renderThreadCount;
}
public int resolveRenderThreadCount() {
if (renderThreadCount > 0)
return renderThreadCount;
return Runtime.getRuntime().availableProcessors() + renderThreadCount;
}
public boolean isMetrics() {
return metrics;
}

View File

@ -416,7 +416,7 @@ public boolean checkPausedByPlayerCount() {
return true;
} else {
if (!renderManager.isRunning() && getPluginState().isRenderThreadsEnabled())
renderManager.start(coreConfig.getRenderThreadCount());
renderManager.start(coreConfig.resolveRenderThreadCount());
return false;
}
}

View File

@ -590,7 +590,7 @@ public int startCommand(CommandContext<S> context) {
new Thread(() -> {
plugin.getPluginState().setRenderThreadsEnabled(true);
plugin.getRenderManager().start(plugin.getConfigs().getCoreConfig().getRenderThreadCount());
plugin.getRenderManager().start(plugin.getConfigs().getCoreConfig().resolveRenderThreadCount());
source.sendMessage(Text.of(TextColor.GREEN, "Render-Threads started!"));
plugin.save();

View File

@ -10,7 +10,7 @@ storage-type: SQL
# The JDBC-Connection URL that is used to connect to the database.
# The format for this url is: jdbc:[driver]://[host]:[port]/[database]
dbUrl: "jdbc:mysql://localhost:3306/bluemap"
db-url: "jdbc:mysql://localhost:3306/bluemap"
# The user that is used to connect to the database
user: "root"

View File

@ -107,7 +107,7 @@ public void renderMaps(BlueMapService blueMap, boolean watch, boolean forceRende
Logger.global.logInfo("Start updating " + maps.size() + " maps (" + totalRegions + " regions, ~" + totalRegions * 1024L + " chunks)...");
// start rendering
renderManager.start(blueMap.getConfigs().getCoreConfig().getRenderThreadCount());
renderManager.start(blueMap.getConfigs().getCoreConfig().resolveRenderThreadCount());
Timer timer = new Timer("BlueMap-CLI-Timer", true);
TimerTask updateInfoTask = new TimerTask() {