From f36e77ed31df0a9474adfed708db85621de9e770 Mon Sep 17 00:00:00 2001 From: DaMachinator Date: Thu, 15 Feb 2018 11:43:11 -0500 Subject: [PATCH] Should work now --- .../matterlink/bridge/command/BridgeCommandRegistry.kt | 8 ++++++++ .../matterlink/bridge/command/PassthroughCommand.kt | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/matterlink/bridge/command/BridgeCommandRegistry.kt b/core/src/main/kotlin/matterlink/bridge/command/BridgeCommandRegistry.kt index 9f08948..38c779d 100644 --- a/core/src/main/kotlin/matterlink/bridge/command/BridgeCommandRegistry.kt +++ b/core/src/main/kotlin/matterlink/bridge/command/BridgeCommandRegistry.kt @@ -44,4 +44,12 @@ object BridgeCommandRegistry { val commandList: String get() = commandMap.keys.joinToString(separator = ", ") + + fun reloadCommands() { + commandMap.clear() + registerAll(HelpCommand,PlayerListCommand,UptimeCommand) + for (key : String in cfg!!.command.commandMapping.keys) { + register(PassthroughCommand(key, cfg!!.command.commandMapping.get(key)!!)) + } + } } \ No newline at end of file diff --git a/core/src/main/kotlin/matterlink/bridge/command/PassthroughCommand.kt b/core/src/main/kotlin/matterlink/bridge/command/PassthroughCommand.kt index 1e27d4e..cbac315 100644 --- a/core/src/main/kotlin/matterlink/bridge/command/PassthroughCommand.kt +++ b/core/src/main/kotlin/matterlink/bridge/command/PassthroughCommand.kt @@ -1,9 +1,11 @@ package matterlink.bridge.command -class PassthroughCommand(override val name: String) : IBridgeCommand { +import matterlink.instance + +class PassthroughCommand(override val name: String, val cmd: String) : IBridgeCommand { override fun call(args: String): Boolean { - return true + return instance.commandSender.execute("$name $args",100) } override val help: String = "No help available for this command."