Preload chunks up to the configured limit, cancel preloading on EditSession complete

Dieser Commit ist enthalten in:
dordsor21 2021-08-17 12:07:48 +01:00
Ursprung da7aca8ef8
Commit 8c11ba7fea
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
2 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1,9 +1,12 @@
package com.fastasyncworldedit.core.queue.implementation.preloader;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.util.FaweTimer;
import com.fastasyncworldedit.core.util.TaskManager;
import com.fastasyncworldedit.core.util.collection.MutablePair;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -72,7 +75,7 @@ public class AsyncPreloader implements Preloader, Runnable {
}
synchronized (existing) { // Ensure key & value are mutated together
existing.setKey(world);
existing.setValue(region.getChunks());
existing.setValue(ImmutableSet.copyOf(Iterables.limit(region.getChunks(), Settings.IMP.QUEUE.PRELOAD_CHUNK_COUNT)));
}
synchronized (update) {
update.notify();

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.FaweCache;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.configuration.Settings;
@ -1250,6 +1251,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
player.print(Caption.of("fawe.error.lighting"));
e.printStackTrace();
}
// Cancel any preloader associated with the actor if present
if (getPlayer() != null) {
Fawe.imp().getPreloader(false).cancel(getPlayer());
}
// Enqueue it
if (getChangeSet() != null) {
if (Settings.IMP.HISTORY.COMBINE_STAGES) {