From 83b60d3c6f552137528208bc4830323621561121 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sat, 11 Nov 2023 15:49:49 +0800 Subject: [PATCH] PlotSquared: Don't allow loading chunks outside render distance for plot worlds --- .../axiom/packet/RequestChunkDataPacketListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/moulberry/axiom/packet/RequestChunkDataPacketListener.java b/src/main/java/com/moulberry/axiom/packet/RequestChunkDataPacketListener.java index 3b10061..893fa59 100644 --- a/src/main/java/com/moulberry/axiom/packet/RequestChunkDataPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/RequestChunkDataPacketListener.java @@ -4,6 +4,7 @@ import com.moulberry.axiom.AxiomConstants; import com.moulberry.axiom.AxiomPaper; import com.moulberry.axiom.buffer.CompressedBlockEntity; import com.moulberry.axiom.event.AxiomModifyWorldEvent; +import com.moulberry.axiom.integration.plotsquared.PlotSquaredIntegration; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.longs.*; import net.minecraft.core.BlockPos; @@ -92,6 +93,12 @@ public class RequestChunkDataPacketListener implements PluginMessageListener { Long2ObjectMap> sections = new Long2ObjectOpenHashMap<>(); int maxChunkLoadDistance = this.plugin.configuration.getInt("max-chunk-load-distance"); + + // Don't allow loading chunks outside render distance for plot worlds + if (PlotSquaredIntegration.isPlotWorld(level.getWorld())) { + maxChunkLoadDistance = 0; + } + if (maxChunkLoadDistance > 0) { count = friendlyByteBuf.readVarInt(); for (int i = 0; i < count; i++) {