aboutsummaryrefslogtreecommitdiff
path: root/spark-sponge/src/main
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2021-03-27 18:51:20 +0000
committerLuck <git@lucko.me>2021-03-27 18:51:31 +0000
commita3129bc834bf22b89f7ac545a960b89361b03459 (patch)
treeded73116fb2e775b24f229b01e891194b41d24b3 /spark-sponge/src/main
parentda2b2e3d948e7533379f039a6686d2b5e3722047 (diff)
downloadspark-a3129bc834bf22b89f7ac545a960b89361b03459.tar.gz
spark-a3129bc834bf22b89f7ac545a960b89361b03459.tar.bz2
spark-a3129bc834bf22b89f7ac545a960b89361b03459.zip
Execute commands async
Diffstat (limited to 'spark-sponge/src/main')
-rw-r--r--spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java
index 9437207..dbd0193 100644
--- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java
+++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java
@@ -74,6 +74,7 @@ public class SpongeSparkPlugin implements SparkPlugin {
private SpongeAudiences audienceFactory;
private SparkPlatform platform;
+ private final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread();
@Inject
public SpongeSparkPlugin(PluginContainer pluginContainer, Game game, @ConfigDir(sharedRoot = false) Path configDirectory, @AsynchronousExecutor SpongeExecutorService asyncExecutor) {
@@ -126,7 +127,7 @@ public class SpongeSparkPlugin implements SparkPlugin {
@Override
public ThreadDumper getDefaultThreadDumper() {
- return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()});
+ return this.threadDumper.get();
}
@Override
@@ -148,6 +149,7 @@ public class SpongeSparkPlugin implements SparkPlugin {
@Override
public CommandResult process(CommandSource source, String arguments) {
+ this.plugin.threadDumper.ensureSetup();
this.plugin.platform.executeCommand(new SpongeCommandSender(source, this.plugin.audienceFactory), arguments.split(" "));
return CommandResult.empty();
}