Skip to content

Commit 42ecc44

Browse files
committed
- Async catcher configuration.
1 parent 7044a52 commit 42ecc44

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/main/java/catserver/server/AsyncCatcher.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ public static boolean isMainThread() {
1616
}
1717

1818
public static boolean checkAsync(String reason) {
19-
if (org.spigotmc.AsyncCatcher.enabled && !isMainThread()) {
19+
if (!CatServer.getConfig().disableAsyncCatcher && org.spigotmc.AsyncCatcher.enabled && !isMainThread()) {
2020
if (!CatServer.getConfig().disableAsyncCatchWarn) {
2121
CatServer.log.warn("A Mod/Plugin try to async " + reason + ", it will be executed safely on the main server thread until return!");
2222
CatServer.log.warn("Please check the stacktrace in debug.log and report the author.");
2323
}
2424
CatServer.log.debug("Try to async " + reason, new Throwable());
2525
return true;
2626
}
27+
if (CatServer.getConfig().disableAsyncCatcher) {
28+
if (!CatServer.getConfig().disableAsyncCatchWarn && !isMainThread()) {
29+
CatServer.log.warn("A Mod/Plugin try to async " + reason + ", async catcher is disabled!");
30+
CatServer.log.warn("Please check the stacktrace in debug.log and report the author.");
31+
CatServer.log.debug("Try to async " + reason, new Throwable());
32+
}
33+
}
2734
return false;
2835
}
2936

src/main/java/catserver/server/CatServerConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class CatServerConfig {
6969
public boolean enableAffinity = false;
7070
public BitSet affinity = Affinity.getAffinity();
7171

72+
public boolean disableAsyncCatcher = false;
73+
7274
public CatServerConfig(String file) {
7375
this.configFile = new File(file);
7476
}
@@ -133,6 +135,8 @@ public void loadConfig() {
133135
Affinity.setAffinity(affinity);
134136
MinecraftServer.LOGGER.info("[CatRoom] Server Thread is bound cpu: {}", affinity);
135137
}
138+
// disable async catcher
139+
disableAsyncCatcher = getOrWriteBooleanConfig("disableAsyncCatcher", disableAsyncCatcher);
136140
// remove old config
137141
config.set("vanilla.limitFastClickGUI", null);
138142
config.set("disableFMLHandshake", null);

0 commit comments

Comments
 (0)