🤔
This commit is contained in:
@@ -6,7 +6,6 @@ import java.util.concurrent.ExecutorCompletionService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.FutureTask;
|
import java.util.concurrent.FutureTask;
|
||||||
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
|
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
|
||||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public abstract class MixinChunkProviderServer {
|
|||||||
long unloadAfter = world.paperConfig.delayChunkUnloadsBy;
|
long unloadAfter = world.paperConfig.delayChunkUnloadsBy;
|
||||||
SlackActivityAccountant activityAccountant = world.getMinecraftServer().slackActivityAccountant;
|
SlackActivityAccountant activityAccountant = world.getMinecraftServer().slackActivityAccountant;
|
||||||
activityAccountant.startActivity(0.5);
|
activityAccountant.startActivity(0.5);
|
||||||
|
|
||||||
ObjectIterator<Entry<Chunk>> it = chunks.long2ObjectEntrySet().fastIterator();
|
ObjectIterator<Entry<Chunk>> it = chunks.long2ObjectEntrySet().fastIterator();
|
||||||
int remainingChunks = chunks.size();
|
int remainingChunks = chunks.size();
|
||||||
int targetSize = Math.min(remainingChunks - 100, (int) (remainingChunks * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
|
int targetSize = Math.min(remainingChunks - 100, (int) (remainingChunks * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
|
||||||
@@ -49,22 +50,19 @@ public abstract class MixinChunkProviderServer {
|
|||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Entry<Chunk> entry = it.next();
|
Entry<Chunk> entry = it.next();
|
||||||
Chunk chunk = entry.getValue();
|
Chunk chunk = entry.getValue();
|
||||||
if (chunk == null) continue;
|
|
||||||
|
|
||||||
if (chunk.isUnloading()) {
|
if (chunk != null && chunk.isUnloading()) {
|
||||||
if (chunk.scheduledForUnload != null) {
|
if (chunk.scheduledForUnload != null) {
|
||||||
if (now - chunk.scheduledForUnload > unloadAfter) {
|
if (now - chunk.scheduledForUnload <= unloadAfter) continue;
|
||||||
if (unloadChunk(chunk, true)) {
|
|
||||||
chunk.scheduledForUnload = null;
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
chunk.setShouldUnload(false);
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--remainingChunks <= targetSize || activityAccountant.activityTimeIsExhausted()) break; // more slack since the target size not work as intended
|
if (unloadChunk(chunk, true)) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
chunk.setShouldUnload(false);
|
||||||
|
chunk.scheduledForUnload = null;
|
||||||
|
|
||||||
|
if (--remainingChunks <= targetSize && activityAccountant.activityTimeIsExhausted()) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activityAccountant.endActivity();
|
activityAccountant.endActivity();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import com.google.common.collect.Sets;
|
|||||||
// Paper end
|
// Paper end
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
|
|
||||||
|
import io.akarin.launcher.AkarinMixinConfig;
|
||||||
import io.akarin.server.core.AkarinGlobalConfig;
|
import io.akarin.server.core.AkarinGlobalConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3438,7 +3439,7 @@ public abstract class World implements IBlockAccess {
|
|||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
short keepLoadedRange = paperConfig.keepLoadedRange; // Paper
|
short keepLoadedRange = paperConfig.keepLoadedRange; // Paper
|
||||||
|
|
||||||
return k >= -keepLoadedRange && k <= keepLoadedRange && l >= -keepLoadedRange && l <= keepLoadedRange && this.keepSpawnInMemory; // CraftBukkit - Added 'this.keepSpawnInMemory' // Paper - Re-add range var
|
return k >= -keepLoadedRange && k <= keepLoadedRange && l >= -keepLoadedRange && l <= keepLoadedRange && this.keepSpawnInMemory && !AkarinMixinConfig.removeChunkUnloadQueue; // CraftBukkit - Added 'this.keepSpawnInMemory' // Paper - Re-add range var // Akarin
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet<?> packet) {
|
public void a(Packet<?> packet) {
|
||||||
|
|||||||
Reference in New Issue
Block a user