Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 04:20:08 +01:00
Fix plugins calling getChunkAtAsync asynchronously
While this method has async in it's name, it's not actually meant to be called asynchronously.... It just means IT will load the chunk asynchronously without blocking main. So fix this so that if a plugin calls it async, it forces the request back to main thread.
Dieser Commit ist enthalten in:
Ursprung
c8055836e8
Commit
8b2a437b9e
@ -4127,7 +4127,7 @@ index 58018bfcee5396d440b0f022a7aa9ed452e67ec5..f84248ad9f90aaaf02afa35a4147fb11
|
||||
}
|
||||
public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 50467656df0b54c2dcba8696b5677a2fc975b178..711bb5c5f4a37357007e8c6441b61c474952ba4d 100644
|
||||
index 50467656df0b54c2dcba8696b5677a2fc975b178..1c5154f8f1b02d8e84fc54afeacb56a86e244ec3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -75,6 +75,7 @@ import net.minecraft.server.GroupDataEntity;
|
||||
@ -4170,7 +4170,7 @@ index 50467656df0b54c2dcba8696b5677a2fc975b178..711bb5c5f4a37357007e8c6441b61c47
|
||||
|
||||
// fall through to load
|
||||
// we do this so we do not re-read the chunk data on disk
|
||||
@@ -2443,6 +2445,22 @@ public class CraftWorld implements World {
|
||||
@@ -2443,6 +2445,34 @@ public class CraftWorld implements World {
|
||||
|
||||
return new CraftDragonBattle(((WorldProviderTheEnd) worldProvider).o()); // PAIL rename getDragonBattle
|
||||
}
|
||||
@ -4182,6 +4182,18 @@ index 50467656df0b54c2dcba8696b5677a2fc975b178..711bb5c5f4a37357007e8c6441b61c47
|
||||
+ if (immediate != null) {
|
||||
+ return CompletableFuture.completedFuture(immediate.getBukkitChunk());
|
||||
+ }
|
||||
+ } else {
|
||||
+ CompletableFuture<Chunk> future = new CompletableFuture<Chunk>();
|
||||
+ world.getMinecraftServer().execute(() -> {
|
||||
+ getChunkAtAsync(x, z, gen, urgent).whenComplete((chunk, err) -> {
|
||||
+ if (err != null) {
|
||||
+ future.completeExceptionally(err);
|
||||
+ } else {
|
||||
+ future.complete(chunk);
|
||||
+ }
|
||||
+ });
|
||||
+ });
|
||||
+ return future;
|
||||
+ }
|
||||
+
|
||||
+ return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> {
|
||||
|
@ -589,10 +589,10 @@ index 899c535c4056cd2375ab8f834f03267d405f4bda..0e6368d0fb3beccb492ae3867fb4e228
|
||||
|
||||
if (!this.isClientSide && (i & 1) != 0) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index b184f8ed8ce86965c3ef9aef179126a4d69275e8..bbfbfeed12890c9d20d78a9661ab172c901f008c 100644
|
||||
index c77c59223eb652346502b9a896e0ad536395e444..5f180bb77b736220c848357b2cac4d0d2b99e3df 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2482,10 +2482,39 @@ public class CraftWorld implements World {
|
||||
@@ -2494,10 +2494,39 @@ public class CraftWorld implements World {
|
||||
// Spigot start
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
|
@ -819,11 +819,11 @@ index 8055f5998213ab1c6c10d03d88d2b14d220a5e40..24ec5d77ca7fdf12585c1bb744255438
|
||||
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
|
||||
return new TicketType<>(s, comparator, 0L);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index bbfbfeed12890c9d20d78a9661ab172c901f008c..7230ddbf6eb765390543bdb3ff8c08d383bb2666 100644
|
||||
index 5f180bb77b736220c848357b2cac4d0d2b99e3df..d3c5b7d1904a6cbd65db406639ed2ba90ec9fd2a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2472,6 +2472,10 @@ public class CraftWorld implements World {
|
||||
}
|
||||
@@ -2484,6 +2484,10 @@ public class CraftWorld implements World {
|
||||
return future;
|
||||
}
|
||||
|
||||
+ if (!urgent) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren