mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Preload chunks up to the configured limit, cancel preloading on EditSession complete
This commit is contained in:
parent
da7aca8ef8
commit
8c11ba7fea
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user