mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-12-11 20:06:46 +01:00
Fix queue instantiation
This commit is contained in:
parent
1cb4cb345f
commit
994856b8fd
@ -36,6 +36,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
@ -141,7 +142,7 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
|
||||
public boolean queueChunkLoad(int cx, int cz, RunnableVal<CHUNK> operation) {
|
||||
if (PAPER) {
|
||||
try {
|
||||
getImpWorld().getChunkAtAsync(cx, cz, new World.ChunkLoadCallback() {
|
||||
new PaperChunkCallback(getImpWorld(), cx, cz) {
|
||||
@Override
|
||||
public void onLoad(Chunk bukkitChunk) {
|
||||
try {
|
||||
@ -155,7 +156,7 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
|
||||
PAPER = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return true;
|
||||
} catch (Throwable ignore) {
|
||||
PAPER = false;
|
||||
|
@ -56,17 +56,17 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
|
||||
public boolean queueChunkLoad(int cx, int cz, RunnableVal<ChunkSnapshot> operation) {
|
||||
if (PAPER) {
|
||||
try {
|
||||
getImpWorld().getChunkAtAsync(cx, cz, new World.ChunkLoadCallback() {
|
||||
new PaperChunkCallback(getImpWorld(), cx, cz) {
|
||||
@Override
|
||||
public void onLoad(Chunk chunk) {
|
||||
try {
|
||||
ChunkSnapshot snapshot = chunk.getChunkSnapshot();
|
||||
operation.run(snapshot);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
PAPER = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return true;
|
||||
} catch (Throwable ignore) {
|
||||
PAPER = false;
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.boydti.fawe.bukkit.v0;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
public abstract class PaperChunkCallback {
|
||||
public PaperChunkCallback(World world, int x, int z) {
|
||||
world.getChunkAtAsync(x, z, chunk -> PaperChunkCallback.this.onLoad(chunk));
|
||||
}
|
||||
|
||||
public abstract void onLoad(Chunk chunk);
|
||||
}
|
Loading…
Reference in New Issue
Block a user