Skip to content

Commit 85a1142

Browse files
committed
Fixed sub commands not detectable if base command exists with min and max params
1 parent 7a8da40 commit 85a1142

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/me/despical/commandframework/CommandFramework.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.comm
162162
for (Map.Entry<Command, Map.Entry<Method, Object>> entry : commands.entrySet()) {
163163
Command command = entry.getKey();
164164
String[] splitted = command.name().split("\\.");
165-
String allArgs = args.length == 0 ? "" : "." + String.join(".", Arrays.copyOfRange(args, 0, splitted.length - 1));
166-
String cmdName = (command.name().contains(".") ? splitted[0] : cmd.getName()) + allArgs;
165+
String allArgs = args.length == 0 ? "" : String.join(".", Arrays.copyOfRange(args, 0, splitted.length - 1));
166+
String cmdName = (command.name().contains(".") ? splitted[0] : cmd.getName()) + (splitted.length == 1 && allArgs.isEmpty() ? "" : "." + allArgs);
167167

168168
if (command.name().equalsIgnoreCase(cmdName) || Stream.of(command.aliases()).anyMatch(cmdName::equalsIgnoreCase)) {
169169
if (!sender.hasPermission(command.permission())) {

0 commit comments

Comments
 (0)