3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 01:50:06 +01:00
Dieser Commit ist enthalten in:
NotMyFault 2021-08-05 15:55:20 +02:00
Ursprung 3ccb5e0aed
Commit c468d22120
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
3 geänderte Dateien mit 14 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -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" }

Datei anzeigen

@ -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)

Datei anzeigen

@ -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();