diff --git a/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt b/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt index 710b3ac1..e186a700 100644 --- a/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt +++ b/game/src/main/kotlin/org/apollo/game/plugin/kotlin/KotlinPluginScript.kt @@ -67,19 +67,19 @@ class KotlinMessageHandler(val world: World, val context: PluginCon } -class KotlinCommandListener(val level: PrivilegeLevel, val function: (Player, Command) -> Unit) : CommandListener(level) { +class KotlinCommandListener(val level: PrivilegeLevel, val function: Command.(Player) -> Unit) : CommandListener(level) { override fun execute(player: Player, command: Command) { - function.invoke(player, command) + function.invoke(command, player) } } class KotlinCommandHandler(val world : World, val command: String, val privileges: PrivilegeLevel) { - var function: (Player, Command) -> Unit = { _, _ -> } + var function: Command.(Player) -> Unit = { _ -> } - fun then(function: (Player, Command) -> Unit) { + fun then(function: Command.(Player) -> Unit) { this.function = function world.commandDispatcher.register(command, KotlinCommandListener(privileges, function)) } diff --git a/game/src/plugins/cmd/src/bank-cmd.plugin.kts b/game/src/plugins/cmd/src/bank-cmd.plugin.kts index 84de8f0d..181a1194 100644 --- a/game/src/plugins/cmd/src/bank-cmd.plugin.kts +++ b/game/src/plugins/cmd/src/bank-cmd.plugin.kts @@ -2,4 +2,4 @@ import org.apollo.game.model.entity.setting.PrivilegeLevel // Opens the player's bank if they are an administrator. on_command("bank", PrivilegeLevel.ADMINISTRATOR) - .then { player, _ -> player.openBank() } \ No newline at end of file + .then { player -> player.openBank() } \ No newline at end of file