From 5b9de0632fd1a9d14550804934785ef33df54134 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 9 Dec 2023 01:42:27 +0100 Subject: error when creating multiple commands with the same name --- src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/config') diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 268d0234d..cc8754d49 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -422,6 +422,9 @@ object Commands { } private fun registerCommand(name: String, description: String, function: (Array) -> Unit) { + if (commands.any { it.name.equals(name, ignoreCase = true) }) { + error("The command '$name is already registered!'") + } ClientCommandHandler.instance.registerCommand(SimpleCommand(name, createCommand(function))) commands.add(CommandInfo(name, description, currentCategory)) } -- cgit