geforkt von Mirrors/FastAsyncWorldEdit
Fixes #1208
Dieser Commit ist enthalten in:
Ursprung
3ccb5e0aed
Commit
c468d22120
@ -64,7 +64,6 @@ gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
|
||||
#Platform expectations
|
||||
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
||||
spigot = { group = "org.spigotmc", name = "spigot", version.ref = "paper" }
|
||||
|
||||
# Plugins
|
||||
vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" }
|
||||
|
@ -62,9 +62,6 @@ dependencies {
|
||||
isTransitive = false
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
compileOnly(libs.spigot) {
|
||||
because("Remove if #1208 has been addressed")
|
||||
}
|
||||
|
||||
// Logging
|
||||
implementation(libs.log4j)
|
||||
|
@ -5,8 +5,8 @@ import com.fastasyncworldedit.bukkit.listener.ChunkListener;
|
||||
import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spigotmc.AsyncCatcher;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BukkitQueueHandler extends QueueHandler {
|
||||
@ -16,12 +16,18 @@ public class BukkitQueueHandler extends QueueHandler {
|
||||
private volatile boolean timingsEnabled;
|
||||
private static boolean alertTimingsChange = true;
|
||||
|
||||
private static Method methodCheck;
|
||||
private static Method timingsCheck;
|
||||
private static Field asyncCatcher;
|
||||
|
||||
static {
|
||||
try {
|
||||
methodCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
|
||||
methodCheck.setAccessible(true);
|
||||
timingsCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
|
||||
timingsCheck.setAccessible(true);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
try {
|
||||
asyncCatcher = Class.forName("org.spigotmc.AsyncCatcher").getDeclaredField("enabled");
|
||||
asyncCatcher.setAccessible(true);
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
@ -31,7 +37,7 @@ public class BukkitQueueHandler extends QueueHandler {
|
||||
ChunkListener.physicsFreeze = true;
|
||||
if (parallel) {
|
||||
try {
|
||||
AsyncCatcher.enabled = false;
|
||||
asyncCatcher.setBoolean(asyncCatcher, false);
|
||||
timingsEnabled = Timings.isTimingsEnabled();
|
||||
if (timingsEnabled) {
|
||||
if (alertTimingsChange) {
|
||||
@ -39,7 +45,7 @@ public class BukkitQueueHandler extends QueueHandler {
|
||||
LOGGER.debug("Having `parallel-threads` > 1 interferes with the timings.");
|
||||
}
|
||||
Timings.setTimingsEnabled(false);
|
||||
methodCheck.invoke(null);
|
||||
timingsCheck.invoke(null);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -52,10 +58,10 @@ public class BukkitQueueHandler extends QueueHandler {
|
||||
ChunkListener.physicsFreeze = false;
|
||||
if (parallel) {
|
||||
try {
|
||||
AsyncCatcher.enabled = true;
|
||||
asyncCatcher.setBoolean(asyncCatcher, true);
|
||||
if (timingsEnabled) {
|
||||
Timings.setTimingsEnabled(true);
|
||||
methodCheck.invoke(null);
|
||||
timingsCheck.invoke(null);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren