Provide command being executed to the cause before dispatching.
This allows events triggered by commands to have the command dispatched as a cause.
@@ -337,6 +337,7 @@ public CommandResult process(CommandSource source, String commandLine) throws Co
Sponge.getCauseStackManager().pushCause(pluginOwner.get());
}
final CommandCallable spec = mapping.getCallable();
+ Sponge.getCauseStackManager().pushCause(spec);
try {
return spec.process(source, arguments);
} catch (CommandNotFoundException e) {
@@ -345,6 +346,8 @@ public CommandResult process(CommandSource source, String commandLine) throws Co
if (pluginOwner.isPresent()) {
Sponge.getCauseStackManager().popCause();
}
+
+ Sponge.getCauseStackManager().popCause();
}
}
