From 7a40aebd6d621b0e9e467b114226f61593a46a32 Mon Sep 17 00:00:00 2001 From: Tueem Date: Thu, 19 Dec 2024 19:41:37 +0100 Subject: [PATCH] add Interactionmethod logging --- .../interaction/methods/InteractionMethod.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java index f9c5a1c..b4d7784 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/methods/InteractionMethod.java @@ -7,6 +7,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.apache.logging.log4j.Logger; + import net.tomatentum.marinara.Marinara; import net.tomatentum.marinara.checks.AppliedCheck; import net.tomatentum.marinara.interaction.InteractionHandler; @@ -16,6 +18,7 @@ import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; import net.tomatentum.marinara.interaction.commands.annotation.SubCommand; import net.tomatentum.marinara.parser.AnnotationParser; import net.tomatentum.marinara.parser.InteractionCheckParser; +import net.tomatentum.marinara.util.LoggerUtil; public abstract class InteractionMethod { @@ -33,6 +36,8 @@ public abstract class InteractionMethod { protected List parsers; protected List appliedChecks; + private Logger logger = LoggerUtil.getLogger(getClass()); + protected InteractionMethod(Method method, InteractionHandler handler, Marinara marinara @@ -82,11 +87,14 @@ public abstract class InteractionMethod { List parameters = new ArrayList<>(); for (int i = 0; i < parameterCount; i++) { + Object parameter; if (i == 0) { - parameters.add(context); - continue; - } - parameters.add(getParameter(context, i-1)); + parameter = context; + }else + parameter = getParameter(context, i-1); + + logger.trace("Found parameter {}={} for {}", parameter.getClass().toString(), parameter, getMethod().getClass().getName() + "." + getMethod().getName()); + parameters.add(parameter); } return parameters.toArray(); }