+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package revxrsal.commands.hook;
+
+import org.jetbrains.annotations.NotNull;
+import revxrsal.commands.command.CommandActor;
+import revxrsal.commands.command.ExecutableCommand;
+import revxrsal.commands.node.ExecutionContext;
+
+/**
+ * A hook that gets called when a command is executed.
+ *
+ * This hook is only fired for commands that have been successfully executed.
+ * Any command that errors in the process will not be invoked here.
+ */
+@FunctionalInterface
+public interface PostCommandExecutedHook extends Hook {
+
+ /**
+ * Invokes the hook for a command whose action has been successfully executed
+ *
+ * @param command The command that will be executed
+ * @param context The execution context
+ */
+ void onPostExecuted(@NotNull ExecutableCommand command, @NotNull ExecutionContext context);
+
+}
diff --git a/common/src/main/java/revxrsal/commands/node/parser/ReflectionAction.java b/common/src/main/java/revxrsal/commands/node/parser/ReflectionAction.java
index 0dc26669..746c80a6 100644
--- a/common/src/main/java/revxrsal/commands/node/parser/ReflectionAction.java
+++ b/common/src/main/java/revxrsal/commands/node/parser/ReflectionAction.java
@@ -67,6 +67,7 @@ public void execute(ExecutionContext context) {
//noinspection rawtypes
function.responseHandler().handleResponse(result, (ExecutionContext) context);
}
+ context.lamp().hooks().onPostCommandExecuted(context.command(), context);
} catch (Throwable t) {
context.lamp().handleException(t, ErrorContext.executingFunction(context));
}