From 915793b0b16ca75dd1a332b1c311ed5c724d2a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berke=20Ak=C3=A7en?= Date: Tue, 25 Jun 2024 13:14:13 +0300 Subject: [PATCH] Improvements for unregistering commands --- .../java/me/despical/commandframework/CommandFramework.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/despical/commandframework/CommandFramework.java b/src/main/java/me/despical/commandframework/CommandFramework.java index 3341702..a98cce2 100644 --- a/src/main/java/me/despical/commandframework/CommandFramework.java +++ b/src/main/java/me/despical/commandframework/CommandFramework.java @@ -309,7 +309,7 @@ public void unregisterCommand(@NotNull String commandName) { } this.commands.remove(command); - 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 + this.subCommands.entrySet().removeIf(subEntry -> subEntry.getKey().name().startsWith(name)); }); }