From e39ac2d67eb86ec4693a5d851e9c8b393dc74319 Mon Sep 17 00:00:00 2001 From: tueem Date: Fri, 1 Nov 2024 17:37:36 +0100 Subject: [PATCH] fix random nulls in list --- .../tomatentum/marinara/registry/InteractionRegistry.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/main/java/net/tomatentum/marinara/registry/InteractionRegistry.java b/lib/src/main/java/net/tomatentum/marinara/registry/InteractionRegistry.java index c38da82..31e3ad1 100644 --- a/lib/src/main/java/net/tomatentum/marinara/registry/InteractionRegistry.java +++ b/lib/src/main/java/net/tomatentum/marinara/registry/InteractionRegistry.java @@ -3,7 +3,6 @@ package net.tomatentum.marinara.registry; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import java.util.Objects; import java.util.Optional; import net.tomatentum.marinara.interaction.InteractionHandler; @@ -26,14 +25,15 @@ public class InteractionRegistry { public void addInteractions(InteractionHandler interactionHandler) { for (Method method : interactionHandler.getClass().getMethods()) { - interactionMethods.add(InteractionMethod.create(method, interactionHandler, wrapper)); + InteractionMethod iMethod = InteractionMethod.create(method, interactionHandler, wrapper); + if (iMethod != null) + this.interactionMethods.add(iMethod); } } public void registerCommands() { List defs = new ArrayList<>(); List execDefs = interactionMethods.stream() - .filter(Objects::nonNull) .filter((x) -> x.getClass().isAssignableFrom(SlashCommandInteractionMethod.class)) .map((x) -> ((SlashCommandInteractionMethod)x).getCommandDefinition()) .toList();