Skip to content

Commit 915793b

Browse files
committed
Improvements for unregistering commands
1 parent b673a02 commit 915793b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public void unregisterCommand(@NotNull String commandName) {
309309
}
310310

311311
this.commands.remove(command);
312-
new HashMap<>(this.subCommands).keySet().stream().filter(subCmd -> subCmd.name().startsWith(name)).forEach(this.subCommands::remove); // Copy elements to new map to avoid modification exception
312+
this.subCommands.entrySet().removeIf(subEntry -> subEntry.getKey().name().startsWith(name));
313313
});
314314
}
315315

0 commit comments

Comments
 (0)