Fix Caffeine using wrong thread-pool and add sorting to initial map-update

This commit is contained in:
Lukas Rieger (Blue) 2022-07-31 18:45:30 +02:00
parent cef202ebba
commit ae992419bb
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 6 additions and 2 deletions

View File

@ -27,9 +27,11 @@ public class BlueMapAPIImpl extends BlueMapAPI {
public BlueMapAPIImpl(Plugin plugin) {
this.plugin = plugin;
this.worldCache = Caffeine.newBuilder()
.executor(BlueMap.THREAD_POOL)
.weakKeys()
.build(this::getWorldUncached);
this.mapCache = Caffeine.newBuilder()
.executor(BlueMap.THREAD_POOL)
.weakKeys()
.build(this::getMapUncached);
}

View File

@ -194,11 +194,13 @@ public void load() throws IOException {
renderManager = new RenderManager();
//update all maps
for (BmMap map : maps.values()) {
maps.values().stream()
.sorted(Comparator.comparing(bmMap -> bmMap.getMapSettings().getSorting()))
.forEach(map -> {
if (pluginState.getMapState(map).isUpdateEnabled()) {
renderManager.scheduleRenderTask(new MapUpdateTask(map));
}
}
});
//start render-manager
if (pluginState.isRenderThreadsEnabled()) {