Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Synchronise on the nmsWorld so we're not attempting to load two chunks at the same time.
Possibly fixes #471
Dieser Commit ist enthalten in:
Ursprung
5be11c541b
Commit
31cc5e0b60
@ -136,7 +136,10 @@ public final class BukkitAdapter_1_14 extends NMSAdapter {
|
||||
}
|
||||
|
||||
public static Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int X, int Z) {
|
||||
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
Chunk nmsChunk;
|
||||
synchronized (nmsWorld) {
|
||||
nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
}
|
||||
if (nmsChunk != null) {
|
||||
return nmsChunk;
|
||||
}
|
||||
@ -144,6 +147,7 @@ public final class BukkitAdapter_1_14 extends NMSAdapter {
|
||||
return nmsWorld.getChunkAt(X, Z);
|
||||
}
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (nmsWorld) {
|
||||
CraftWorld craftWorld = nmsWorld.getWorld();
|
||||
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true);
|
||||
try {
|
||||
@ -153,6 +157,7 @@ public final class BukkitAdapter_1_14 extends NMSAdapter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO optimize
|
||||
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(X, Z));
|
||||
}
|
||||
|
@ -123,7 +123,10 @@ public final class BukkitAdapter_1_15 extends NMSAdapter {
|
||||
}
|
||||
|
||||
public static Chunk ensureLoaded(net.minecraft.server.v1_15_R1.World nmsWorld, int X, int Z) {
|
||||
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
Chunk nmsChunk;
|
||||
synchronized (nmsWorld) {
|
||||
nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
}
|
||||
if (nmsChunk != null) {
|
||||
return nmsChunk;
|
||||
}
|
||||
@ -131,6 +134,7 @@ public final class BukkitAdapter_1_15 extends NMSAdapter {
|
||||
return nmsWorld.getChunkAt(X, Z);
|
||||
}
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (nmsWorld) {
|
||||
CraftWorld craftWorld = nmsWorld.getWorld();
|
||||
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true);
|
||||
try {
|
||||
@ -140,6 +144,7 @@ public final class BukkitAdapter_1_15 extends NMSAdapter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO optimize
|
||||
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(X, Z));
|
||||
}
|
||||
|
@ -124,7 +124,10 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
||||
}
|
||||
|
||||
public static Chunk ensureLoaded(World nmsWorld, int X, int Z) {
|
||||
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
Chunk nmsChunk;
|
||||
synchronized (nmsWorld) {
|
||||
nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
||||
}
|
||||
if (nmsChunk != null) {
|
||||
return nmsChunk;
|
||||
}
|
||||
@ -132,6 +135,7 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
||||
return nmsWorld.getChunkAt(X, Z);
|
||||
}
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (nmsWorld) {
|
||||
CraftWorld craftWorld = nmsWorld.getWorld();
|
||||
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true);
|
||||
try {
|
||||
@ -141,6 +145,7 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO optimize
|
||||
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(X, Z));
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren