aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-09 01:42:27 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-09 01:42:27 +0100
commit5b9de0632fd1a9d14550804934785ef33df54134 (patch)
tree0957effcb8dd4263c01b4b0c9158af80a43bfabb /src/main/java/at
parente98a3a4deb284fca243c9f61c7d3755200d63364 (diff)
downloadskyhanni-5b9de0632fd1a9d14550804934785ef33df54134.tar.gz
skyhanni-5b9de0632fd1a9d14550804934785ef33df54134.tar.bz2
skyhanni-5b9de0632fd1a9d14550804934785ef33df54134.zip
error when creating multiple commands with the same name
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt3
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))
}