diff options
author | Luck <git@lucko.me> | 2020-12-14 21:02:46 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2020-12-14 21:02:46 +0000 |
commit | 737c09973ab6a45cbaa5bdbad24632b0fb23ce07 (patch) | |
tree | 7f40cafd1d25fd44070a31d1db56b982a89336dc | |
parent | 7497f91084b5a0b220e3c32612803fc0bfd2fc6e (diff) | |
download | spark-737c09973ab6a45cbaa5bdbad24632b0fb23ce07.tar.gz spark-737c09973ab6a45cbaa5bdbad24632b0fb23ce07.tar.bz2 spark-737c09973ab6a45cbaa5bdbad24632b0fb23ce07.zip |
Support spark command from Fabric console sources (#82)
-rw-r--r-- | spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java | 5 |
1 files 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<ServerCommandSource> 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; } |