From 737c09973ab6a45cbaa5bdbad24632b0fb23ce07 Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 14 Dec 2020 21:02:46 +0000 Subject: Support spark command from Fabric console sources (#82) --- .../java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 3293853..fbdc2e9 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 @@ -73,7 +73,7 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman private static String /*Nullable*/ [] processArgs(CommandContext context) { String[] split = context.getInput().split(" "); - if (split.length == 0 || !split[0].equals("/spark")) { + if (split.length == 0 || !split[0].equals("/spark") && !split[0].equals("spark")) { return null; } @@ -87,7 +87,8 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman return 0; } - this.platform.executeCommand(new FabricCommandSender(context.getSource().getPlayer(), this), args); + CommandOutput source = context.getSource().getEntity() != null ? context.getSource().getEntity() : context.getSource().getMinecraftServer(); + this.platform.executeCommand(new FabricCommandSender(source, this), args); return Command.SINGLE_SUCCESS; } -- cgit