Yatopia/patches/Tuinity/patches/server/0031-Revert-getChunkAt-Asyn...

37 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Tue, 9 Jun 2020 14:02:06 -0700
Subject: [PATCH] Revert getChunkAt(Async) retaining chunks for long periods of
time
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7e377eb7ad2710b2541eaab0885c07c56602a1f6..996042cfe0bbb49675bc5fcb84dc2c5fa79d95a3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -423,14 +423,7 @@ public class CraftWorld implements World {
@Override
public Chunk getChunkAt(int x, int z) {
- // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
- net.minecraft.world.level.chunk.Chunk chunk = world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z);
- if (chunk == null) {
- addTicket(x, z);
- chunk = this.world.getChunkProvider().getChunkAt(x, z, true);
- }
- return chunk.bukkitChunk;
- // Paper end
+ return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk; // Tuinity - revert paper diff
}
// Paper start
@@ -2589,7 +2582,7 @@ public class CraftWorld implements World {
}
return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> {
net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null);
- if (chunk != null) addTicket(x, z); // Paper
+ if (false && chunk != null) addTicket(x, z); // Paper // Tuinity - revert
return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
}, net.minecraft.server.MinecraftServer.getServer());
}