Skip to content

Commit

Permalink
Merge branch '1.20.4' into 1.20.6
Browse files Browse the repository at this point in the history
# Conflicts:
#	settings.gradle.kts
  • Loading branch information
rfresh2 committed Dec 7, 2024
2 parents 721225c + 019271d commit 65e514b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static net.minecraft.world.level.Level.*;
Expand Down Expand Up @@ -93,23 +94,25 @@ public LongList getHighlightsSnapshot(final ResourceKey<Level> dimensionId) {

@Override
public void handleWorldChange() {
try {
Futures.whenAllComplete(saveAllChunks())
Futures.whenAllComplete(saveAllChunks())
.run(() -> {
reset();
initializeWorld();
loadChunksInActualDimension();
}, Runnable::run)
.get();
} catch (final Exception e) {
XaeroPlus.LOGGER.error("Error handling {} cache world change", databaseName, e);
}
}, Globals.cacheRefreshExecutorService.get());
}

public synchronized void reset() {
this.worldCacheInitialized = false;
this.currentWorldId = null;
if (this.executorService != null) this.executorService.shutdown();
if (this.executorService != null) {
this.executorService.shutdown();
try {
this.executorService.awaitTermination(3L, TimeUnit.SECONDS);
} catch (final Throwable e) {
XaeroPlus.LOGGER.error("Timed out waiting for {} executor to shutdown", databaseName, e);
}
}
if (this.database != null) this.database.close();
this.dimensionCacheMap.clear();
this.database = null;
Expand Down Expand Up @@ -219,14 +222,9 @@ public void onEnable() {

@Override
public void onDisable() {
try {
Futures.whenAllComplete(saveAllChunks())
.run(() -> reset(),
Runnable::run)
.get();
} catch (Exception e) {
XaeroPlus.LOGGER.error("Error handling {} cache disable", databaseName, e);
}
Futures.whenAllComplete(saveAllChunks())
.run(() -> reset(),
Globals.cacheRefreshExecutorService.get());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pluginManagement {
}
}
gradle.extra.apply {
set("mod_version", "2.24.6")
set("mod_version", "2.24.7")
set("minecraft_version", "1.20.6")
set("parchment_version", "2024.06.16")
set("worldmap_version_fabric", "1.39.0")
Expand Down

0 comments on commit 65e514b

Please sign in to comment.