Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 09:50:06 +01:00
Add folia workaround
Dieser Commit ist enthalten in:
Ursprung
f066939c0e
Commit
296baf0e81
@ -119,9 +119,20 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
private static Field LEVEL_CHUNK_ENTITIES;
|
||||
private static Field SERVER_LEVEL_ENTITY_MANAGER;
|
||||
|
||||
private static boolean FOLIA_SUPPORT;
|
||||
|
||||
static {
|
||||
final MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
try {
|
||||
boolean isFolia = false;
|
||||
try {
|
||||
// Assume API is present
|
||||
Class.forName("io.papermc.paper.threadedregions.scheduler.EntityScheduler");
|
||||
isFolia = true;
|
||||
} catch (Exception unused) {
|
||||
|
||||
}
|
||||
FOLIA_SUPPORT = isFolia;
|
||||
fieldData = PalettedContainer.class.getDeclaredField(Refraction.pickName("data", "d"));
|
||||
fieldData.setAccessible(true);
|
||||
|
||||
@ -263,7 +274,9 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
} else {
|
||||
LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ);
|
||||
if (nmsChunk != null) {
|
||||
addTicket(serverLevel, chunkX, chunkZ);
|
||||
if(!FOLIA_SUPPORT) {// TODO: Dirty folia workaround - Needs be discussed with FAWE members
|
||||
addTicket(serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
return nmsChunk;
|
||||
}
|
||||
nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ);
|
||||
@ -277,6 +290,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
}
|
||||
CompletableFuture<org.bukkit.Chunk> future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true);
|
||||
try {
|
||||
/*
|
||||
CraftChunk chunk = (CraftChunk) future.get();
|
||||
if(!FOLIA_SUPPORT) {// TODO: Dirty folia workaround - Needs be discussed with FAWE members
|
||||
addTicket(serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
*/
|
||||
CraftChunk chunk;
|
||||
try {
|
||||
chunk = (CraftChunk) future.get(10, TimeUnit.SECONDS);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren