diff options
author | Luck <git@lucko.me> | 2022-07-12 22:37:59 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-07-12 22:37:59 +0100 |
commit | 73dd214ae66bab483ee8b4f0ed03881466da92e8 (patch) | |
tree | 11b433c6b9b15e75249732248c150c35af08c24f /spark-sponge8 | |
parent | a10f966a443d56845a5efb1e65232e6b87eabb96 (diff) | |
download | spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.tar.gz spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.tar.bz2 spark-73dd214ae66bab483ee8b4f0ed03881466da92e8.zip |
Improve/fix game thread dumper
Diffstat (limited to 'spark-sponge8')
-rw-r--r-- | spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java index 68e47e3..70e73b9 100644 --- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java +++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java @@ -69,9 +69,9 @@ public class Sponge8SparkPlugin implements SparkPlugin { private final Path configDirectory; private final ExecutorService asyncExecutor; private final ExecutorService syncExecutor; + private final ThreadDumper.GameThread gameThreadDumper = new ThreadDumper.GameThread(); private SparkPlatform platform; - private final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread(); @Inject public Sponge8SparkPlugin(PluginContainer pluginContainer, Logger logger, Game game, @ConfigDir(sharedRoot = false) Path configDirectory) { @@ -88,6 +88,8 @@ public class Sponge8SparkPlugin implements SparkPlugin { } else { throw new IllegalStateException("Server and client both unavailable"); } + + this.syncExecutor.execute(() -> this.gameThreadDumper.setThread(Thread.currentThread())); } @@ -159,7 +161,7 @@ public class Sponge8SparkPlugin implements SparkPlugin { @Override public ThreadDumper getDefaultThreadDumper() { - return this.threadDumper.get(); + return this.gameThreadDumper.get(); } @Override @@ -204,7 +206,6 @@ public class Sponge8SparkPlugin implements SparkPlugin { @Override public CommandResult process(CommandCause cause, ArgumentReader.Mutable arguments) { - this.plugin.threadDumper.ensureSetup(); this.plugin.platform.executeCommand(new Sponge8CommandSender(cause), arguments.input().split(" ")); return CommandResult.success(); } |