From 3d5201329b21baa7bcdd1c0114bdaf39296ed5f3 Mon Sep 17 00:00:00 2001 From: tueem Date: Fri, 1 Nov 2024 16:05:33 +0100 Subject: [PATCH] Add missing initialisation and nonNull filter --- .../net/tomatentum/marinara/registry/InteractionRegistry.java | 3 +++ 1 file changed, 3 insertions(+) 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 d64fa22..c38da82 100644 --- a/lib/src/main/java/net/tomatentum/marinara/registry/InteractionRegistry.java +++ b/lib/src/main/java/net/tomatentum/marinara/registry/InteractionRegistry.java @@ -3,6 +3,7 @@ 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; @@ -18,6 +19,7 @@ public class InteractionRegistry { private LibraryWrapper wrapper; public InteractionRegistry(LibraryWrapper wrapper) { + this.interactionMethods = new ArrayList<>(); this.wrapper = wrapper; wrapper.subscribeInteractions(this::handle); } @@ -31,6 +33,7 @@ public class InteractionRegistry { 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();