diff --git a/sources/src/main/java/io/akarin/server/mixin/core/MixinMinecraftServer.java b/sources/src/main/java/io/akarin/server/mixin/core/MixinMinecraftServer.java index b546cd866..078d46e7d 100644 --- a/sources/src/main/java/io/akarin/server/mixin/core/MixinMinecraftServer.java +++ b/sources/src/main/java/io/akarin/server/mixin/core/MixinMinecraftServer.java @@ -119,7 +119,7 @@ protected void l() throws InterruptedException { } for (WorldServer world : this.worlds) { - executor.take(); + if (world.getWorld().getKeepSpawnInMemory()) executor.take(); this.server.getPluginManager().callEvent(new WorldLoadEvent(world.getWorld())); } diff --git a/sources/src/main/java/io/akarin/server/mixin/cps/MixinChunkProviderServer.java b/sources/src/main/java/io/akarin/server/mixin/cps/MixinChunkProviderServer.java index 02e650fd6..c2c1d36de 100644 --- a/sources/src/main/java/io/akarin/server/mixin/cps/MixinChunkProviderServer.java +++ b/sources/src/main/java/io/akarin/server/mixin/cps/MixinChunkProviderServer.java @@ -1,7 +1,5 @@ package io.akarin.server.mixin.cps; -import java.util.Iterator; - import org.spigotmc.SlackActivityAccountant; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -64,7 +62,7 @@ public boolean unloadChunks() { continue; } - it.remove(); // Life is strange + it.remove(); if (--remainingChunks <= targetSize || activityAccountant.activityTimeIsExhausted()) break; // more slack since the target size not work as intended } } @@ -74,6 +72,14 @@ public boolean unloadChunks() { return false; } + @Redirect(method = "unloadChunk", at = @At( + value = "INVOKE", + target = "it/unimi/dsi/fastutil/longs/Long2ObjectOpenHashMap.remove(J)Ljava/lang/Object;" + )) + private Object remove(Long2ObjectOpenHashMap chunks, long chunkHash) { + return null; + } + @Overwrite public String getName() { return "ServerChunkCache: " + chunks.size();