Add getFullSlashCommand() method to get the SlashCommand annotation instance that has options if it is a rootcommand
This commit is contained in:
		| @@ -3,7 +3,6 @@ package net.tomatentum.marinara.interaction.commands; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.HashMap; | ||||
| import java.util.HashSet; | ||||
| import java.util.List; | ||||
|  | ||||
| import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand; | ||||
| @@ -80,6 +79,17 @@ public class SlashCommandDefinition { | ||||
|         return (SubCommand[]) subCommandMap.values().toArray(); | ||||
|     } | ||||
|  | ||||
|     public SlashCommand getFullSlashCommand() { | ||||
|         if (isRootCommand()) | ||||
|             return getSlashCommand(); | ||||
|         for (ExecutableSlashCommandDefinition executableSlashCommandDefinition : executableDefinitons) { | ||||
|             if (executableSlashCommandDefinition.options().length > 0) | ||||
|                 return executableSlashCommandDefinition.applicationCommand(); | ||||
|         } | ||||
|  | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     public SlashCommand getSlashCommand() { | ||||
|         return slashCommand; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user