Fix F3 levels not closing with multiverse

This commit is contained in:
James Seibel
2024-05-04 15:12:26 -05:00
parent aad095ca1a
commit f34e67e6bb
@@ -208,14 +208,18 @@ public class SubDimensionLevelMatcher implements AutoCloseable
for (File testLevelFolder : this.potentialLevelFolders)
{
LOGGER.info("Testing level folder: [" + LodUtil.shortenString(testLevelFolder.getName(), 8) + "]");
FullDataSourceV2 testFullDataSource = null;
try
{
// get the data source to compare against
IDhLevel tempLevel = new DhClientLevel(new ClientOnlySaveStructure(), this.currentClientLevel, testLevelFolder, false);
FullDataSourceV2 testFullDataSource = tempLevel.getFullDataProvider().getAsync(new DhSectionPos(this.playerData.playerBlockPos)).join();
if (testFullDataSource == null)
try (IDhLevel tempLevel = new DhClientLevel(new ClientOnlySaveStructure(), this.currentClientLevel, testLevelFolder, false))
{
continue;
testFullDataSource = tempLevel.getFullDataProvider().getAsync(new DhSectionPos(this.playerData.playerBlockPos)).join();
if (testFullDataSource == null)
{
continue;
}
}
@@ -334,6 +338,13 @@ public class SubDimensionLevelMatcher implements AutoCloseable
// for now we are just assuming it is an unrelated file
LOGGER.warn("Error checking level: "+e.getMessage(), e);
}
finally
{
if (testFullDataSource != null)
{
try { testFullDataSource.close(); } catch (Exception ignore) {}
}
}
}