aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric
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-fabric
parentda2b2e3d948e7533379f039a6686d2b5e3722047 (diff)
downloadspark-a3129bc834bf22b89f7ac545a960b89361b03459.tar.gz
spark-a3129bc834bf22b89f7ac545a960b89361b03459.tar.bz2
spark-a3129bc834bf22b89f7ac545a960b89361b03459.zip
Execute commands async
Diffstat (limited to 'spark-fabric')
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java1
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java1
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java3
3 files changed, 4 insertions, 1 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
index eec7b73..c7efb4e 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
@@ -105,6 +105,7 @@ public class FabricClientSparkPlugin extends FabricSparkPlugin implements Sugges
return false;
}
+ this.threadDumper.ensureSetup();
this.platform.executeCommand(new FabricCommandSender(this.minecraft.player, this), args);
this.minecraft.inGameHud.getChatHud().addToMessageHistory(chat);
return true;
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
index b8f94f5..7e88a24 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
@@ -81,6 +81,7 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman
return 0;
}
+ this.threadDumper.ensureSetup();
CommandOutput source = context.getSource().getEntity() != null ? context.getSource().getEntity() : context.getSource().getMinecraftServer();
this.platform.executeCommand(new FabricCommandSender(source, this), args);
return Command.SINGLE_SUCCESS;
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
index 3454365..59610b1 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricSparkPlugin.java
@@ -44,6 +44,7 @@ public abstract class FabricSparkPlugin implements SparkPlugin {
private final FabricSparkMod mod;
protected final ScheduledExecutorService scheduler;
protected final SparkPlatform platform;
+ protected final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread();
protected FabricSparkPlugin(FabricSparkMod mod) {
this.mod = mod;
@@ -85,7 +86,7 @@ public abstract class FabricSparkPlugin implements SparkPlugin {
@Override
public ThreadDumper getDefaultThreadDumper() {
- return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()});
+ return this.threadDumper.get();
}
protected static <T> void registerCommands(CommandDispatcher<T> dispatcher, Command<T> executor, SuggestionProvider<T> suggestor, String... aliases) {