aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric/src
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2020-12-14 21:02:46 +0000
committerLuck <git@lucko.me>2020-12-14 21:02:46 +0000
commit737c09973ab6a45cbaa5bdbad24632b0fb23ce07 (patch)
tree7f40cafd1d25fd44070a31d1db56b982a89336dc /spark-fabric/src
parent7497f91084b5a0b220e3c32612803fc0bfd2fc6e (diff)
downloadspark-737c09973ab6a45cbaa5bdbad24632b0fb23ce07.tar.gz
spark-737c09973ab6a45cbaa5bdbad24632b0fb23ce07.tar.bz2
spark-737c09973ab6a45cbaa5bdbad24632b0fb23ce07.zip
Support spark command from Fabric console sources (#82)
Diffstat (limited to 'spark-fabric/src')
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java5
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;
}