aboutsummaryrefslogtreecommitdiff
path: root/spark-forge
diff options
context:
space:
mode:
authorDarkere <Dark-277@web.de>2020-04-02 11:06:04 +0200
committerGitHub <noreply@github.com>2020-04-02 10:06:04 +0100
commite227e22ed3999182b450dd897669e7ad9922d03e (patch)
tree666f0aa93887ad7aa0ec774d06086b063b3fd232 /spark-forge
parent66c983aa47be8395cd6d163f43842fd2042f4f3d (diff)
downloadspark-e227e22ed3999182b450dd897669e7ad9922d03e.tar.gz
spark-e227e22ed3999182b450dd897669e7ad9922d03e.tar.bz2
spark-e227e22ed3999182b450dd897669e7ad9922d03e.zip
Make spark work from Forge console (#40)
Diffstat (limited to 'spark-forge')
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java
index 27489fb..c017d95 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java
@@ -67,7 +67,7 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
private static String /* Nullable */[] processArgs(CommandContext<CommandSource> 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;
}
@@ -79,8 +79,8 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin implements Command<
String[] args = processArgs(context);
if (args == null)
return 0;
-
- this.platform.executeCommand(new ForgeCommandSender(context.getSource().asPlayer(), this), args);
+ ICommandSource source = context.getSource().getEntity() instanceof ServerPlayerEntity ? context.getSource().asPlayer() : context.getSource().getServer();
+ this.platform.executeCommand(new ForgeCommandSender(source, this), args);
return Command.SINGLE_SUCCESS;
}