From fd749b31d8776d4268c6a54f0925a334780556f5 Mon Sep 17 00:00:00 2001 From: tueem Date: Fri, 25 Oct 2024 21:04:10 +0200 Subject: [PATCH] add getUniqueExecutableDefinitions to ApplicationCommandDefinition --- .../commands/ApplicationCommandDefinition.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ApplicationCommandDefinition.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ApplicationCommandDefinition.java index ac87f27..ea1627f 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ApplicationCommandDefinition.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ApplicationCommandDefinition.java @@ -1,6 +1,7 @@ package net.tomatentum.marinara.interaction.commands; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import net.tomatentum.marinara.interaction.commands.annotation.ApplicationCommand; @@ -45,10 +46,15 @@ public class ApplicationCommandDefinition { return applicationCommand; } - public List getExecutableDefinitons() { - return executableDefinitons; + public ExecutableCommandDefinition[] getExecutableDefinitons() { + return executableDefinitons.toArray(new ExecutableCommandDefinition[0]); } + public ExecutableCommandDefinition[] getUniqueExecutableDefinitions() { + HashSet set = new HashSet<>(); + executableDefinitons.forEach(set::add); + return set.toArray(new ExecutableCommandDefinition[0]); + } public int getSubCommandGroupCount() { return subCommandGroupCount; }