From 455fc4955fbd66532a001c134dec48a2d25aef6a Mon Sep 17 00:00:00 2001 From: Tueem Date: Thu, 19 Dec 2024 22:11:06 +0100 Subject: [PATCH] fix ExecutableSlashCommandDefinition toString method with all various checks --- .../commands/ExecutableSlashCommandDefinition.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java index 579f3bc..e79f58b 100644 --- a/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java +++ b/lib/src/main/java/net/tomatentum/marinara/interaction/commands/ExecutableSlashCommandDefinition.java @@ -32,9 +32,13 @@ public record ExecutableSlashCommandDefinition( @Override public final String toString() { - return applicationCommand.name() + - subCommandGroup != null ? "::" + subCommand.name() : "" + - subCommand != null ? "::" + subCommand.name() : ""; + StringBuilder builder = new StringBuilder(); + builder.append(applicationCommand.name()); + if (subCommandGroup != null && subCommandGroup.name() != null) + builder.append("::").append(subCommandGroup.name()); + if (subCommand != null && subCommand.name() != null) + builder.append("::").append(subCommand.name()); + return builder.toString(); } public boolean isRootCommand() {