diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-09 01:42:27 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-09 01:42:27 +0100 |
commit | 5b9de0632fd1a9d14550804934785ef33df54134 (patch) | |
tree | 0957effcb8dd4263c01b4b0c9158af80a43bfabb /src/main | |
parent | e98a3a4deb284fca243c9f61c7d3755200d63364 (diff) | |
download | skyhanni-5b9de0632fd1a9d14550804934785ef33df54134.tar.gz skyhanni-5b9de0632fd1a9d14550804934785ef33df54134.tar.bz2 skyhanni-5b9de0632fd1a9d14550804934785ef33df54134.zip |
error when creating multiple commands with the same name
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt | 3 |
1 files changed, 3 insertions, 0 deletions
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<String>) -> 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)) } |