From 1aa052a85b4a380ffeb418aa89667a4fd4663c09 Mon Sep 17 00:00:00 2001 From: tueem Date: Tue, 29 Oct 2024 19:51:37 +0100 Subject: [PATCH] minor refactoring and addition of isRootCommand() to SlashCommandDefinition --- .../commands/SlashCommandDefinition.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java index fbdbc0d..12a698f 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/SlashCommandDefinition.java @@ -40,20 +40,6 @@ public class SlashCommandDefinition { return this; } - public SlashCommand getSlashCommand() { - return slashCommand; - } - - public ExecutableSlashCommandDefinition[] getExecutableDefinitons() { - return executableDefinitons.toArray(new ExecutableSlashCommandDefinition[0]); - } - - public ExecutableSlashCommandDefinition[] getUniqueExecutableDefinitions() { - HashSet set = new HashSet<>(); - executableDefinitons.forEach(set::add); - return set.toArray(new ExecutableSlashCommandDefinition[0]); - } - public SubCommandGroup[] getSubCommandGroups() { HashSet subCommandGroups = new HashSet<>(); @@ -79,4 +65,22 @@ public class SlashCommandDefinition { else return (SubCommand[]) Arrays.asList(getUniqueExecutableDefinitions()).stream().filter((x) -> x.subCommandGroup().name().equals(group.name()) && x.subCommand() != null).toArray(); } + + public SlashCommand getSlashCommand() { + return slashCommand; + } + + public ExecutableSlashCommandDefinition[] getExecutableDefinitons() { + return executableDefinitons.toArray(new ExecutableSlashCommandDefinition[0]); + } + + public ExecutableSlashCommandDefinition[] getUniqueExecutableDefinitions() { + HashSet set = new HashSet<>(); + executableDefinitons.forEach(set::add); + return set.toArray(new ExecutableSlashCommandDefinition[0]); + } + + public boolean isRootCommand() { + return isRootCommand; + } }