Add more informative error message when world gen can't start due to world properties issues.
@@ -28,11 +28,12 @@ public class WorldGenListener implements ListenerBase {
@Listener
public void onWorldLoad(LoadWorldEvent event) {
if (Sponge.getGame().getState() == GameState.SERVER_STARTED) {
- onWorldLoad(event.getTargetWorld());
+ Task.builder().execute(() -> onWorldLoad(event.getTargetWorld())).delay(1, TimeUnit.SECONDS).submit(Nucleus.getNucleus());
}
}
private void onWorldLoad(final World world) {
+ try {
WorldHelper worldHelper = getServiceUnchecked(WorldHelper.class);
Nucleus.getNucleus().getWorldDataManager().getWorld(world).ifPresent(mws -> {
WorldgenWorldDataModule worldgenWorldDataModule = mws.get(WorldgenWorldDataModule.class);
@@ -49,5 +50,12 @@ public class WorldGenListener implements ListenerBase {
}
}
});
+
+ } catch (IllegalStateException e) {
+ Nucleus.getNucleus().getLogger().error(
+ "Could not determine World Generation restart status for world {}, WorldProperties could not be loaded from the Sponge "
+ + "World Manager (Sponge.getServer().getWorldProperties({}) returned empty.)", world.getName(), world.getUniqueId());
+ e.printStackTrace();
+ }
}
}
