Fix server hang: run map loading off the main thread
The preloaded-maps completion callback was wired by calling ImageMapManager.loadMaps() directly on the main thread during onEnable. loadMaps()'s synchronous prefix loads saved maps via URLStaticImageMapLoader.load(), which blocks on future.get() for a MapUtils.createMap() task scheduled onto the main thread -> the main thread waits on itself and the server hangs while enabling ImageFrame. Restore the Scheduler.runTaskAsynchronously wrapper so loadMaps runs off the main thread (as upstream did), while keeping the completion callback so preloaded maps are still created only after saved maps finish loading. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c7fcba7e2b
commit
31cb6cc430
1 file changed
+1
-1
@@ -300,7 +300,7 @@ public class ImageFrame extends JavaPlugin {
|
||||
|
||||
ImageMapLoaders.init();
|
||||
|
||||
imageMapManager.loadMaps(ifPlayerManager, this::loadPreloadedMaps);
|
||||
Scheduler.runTaskAsynchronously(this, () -> imageMapManager.loadMaps(ifPlayerManager, this::loadPreloadedMaps));
|
||||
|
||||
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[ImageFrame] ImageFrame has been Enabled!");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user