Skip to content

Commit

Permalink
build(deps): bump the versions group with 11 updates (#34)
Browse files Browse the repository at this point in the history
* build(deps): bump the versions group with 11 updates

Bumps the versions group with 11 updates:

| Package | From | To |
| --- | --- | --- |
| [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) | `3.46.0.0` | `3.46.0.1` |
| [org.jetbrains.exposed:exposed-java-time](https://github.com/JetBrains/Exposed) | `0.52.0` | `0.53.0` |
| [org.jetbrains.exposed:exposed-jdbc](https://github.com/JetBrains/Exposed) | `0.52.0` | `0.53.0` |
| [org.jetbrains.exposed:exposed-dao](https://github.com/JetBrains/Exposed) | `0.52.0` | `0.53.0` |
| [org.jetbrains.exposed:exposed-core](https://github.com/JetBrains/Exposed) | `0.52.0` | `0.53.0` |
| [ru.astrainteractive.astralibs:orm](https://github.com/Astra-Interactive/AstraLibs) | `3.10.0` | `3.12.0` |
| [ru.astrainteractive.astralibs:core](https://github.com/Astra-Interactive/AstraLibs) | `3.10.0` | `3.12.0` |
| [ru.astrainteractive.astralibs:menu-bukkit](https://github.com/Astra-Interactive/AstraLibs) | `3.10.0` | `3.12.0` |
| [ru.astrainteractive.astralibs:core-bukkit](https://github.com/Astra-Interactive/AstraLibs) | `3.10.0` | `3.12.0` |
| [ru.astrainteractive.astralibs:command](https://github.com/Astra-Interactive/AstraLibs) | `3.10.0` | `3.12.0` |
| [ru.astrainteractive.astralibs:command-bukkit](https://github.com/Astra-Interactive/AstraLibs) | `3.10.0` | `3.12.0` |


Updates `org.xerial:sqlite-jdbc` from 3.46.0.0 to 3.46.0.1
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](xerial/sqlite-jdbc@3.46.0.0...3.46.0.1)

Updates `org.jetbrains.exposed:exposed-java-time` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `org.jetbrains.exposed:exposed-jdbc` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `org.jetbrains.exposed:exposed-dao` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `org.jetbrains.exposed:exposed-core` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `org.jetbrains.exposed:exposed-jdbc` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `org.jetbrains.exposed:exposed-dao` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `org.jetbrains.exposed:exposed-core` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/JetBrains/Exposed/releases)
- [Changelog](https://github.com/JetBrains/Exposed/blob/main/CHANGELOG.md)
- [Commits](JetBrains/Exposed@0.52.0...0.53.0)

Updates `ru.astrainteractive.astralibs:orm` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:core` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:menu-bukkit` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:core-bukkit` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:command` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:command-bukkit` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:core` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:menu-bukkit` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:core-bukkit` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:command` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

Updates `ru.astrainteractive.astralibs:command-bukkit` from 3.10.0 to 3.12.0
- [Release notes](https://github.com/Astra-Interactive/AstraLibs/releases)
- [Commits](Astra-Interactive/AstraLibs@3.10.0...3.12.0)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-java-time
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-jdbc
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-dao
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-jdbc
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-dao
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: org.jetbrains.exposed:exposed-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:orm
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:core
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:menu-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:core-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:command
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:command-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:core
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:menu-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:core-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:command
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
- dependency-name: ru.astrainteractive.astralibs:command-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: versions
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update gradle.properties

* fix build

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Roman Makeev <57789105+makeevrserg@users.noreply.github.com>
Co-authored-by: makeevrserg <makeevrserg@gmail.com>
  • Loading branch information
3 people authored Aug 9, 2024
1 parent 190a537 commit 5a4ce2c
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 103 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ makeevrserg.java.ktarget=21
# Project
makeevrserg.project.name=AstraRating
makeevrserg.project.group=ru.astrainteractive.astrarating
makeevrserg.project.version.string=1.18.3
makeevrserg.project.version.string=1.18.4
makeevrserg.project.description=Rating plugin for EmpireProjekt
makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com
makeevrserg.project.url=https://empireprojekt.ru
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kotlin-json = "1.7.1" # https://github.com/Kotlin/kotlinx.serialization
kotlin-kaml = "0.61.0" # https://github.com/charleskorn/kaml

# Drivers
driver-jdbc = "3.46.0.0" # https://github.com/xerial/sqlite-jdbc
driver-jdbc = "3.46.0.1" # https://github.com/xerial/sqlite-jdbc
driver-mysql = "8.0.33" # https://github.com/mysql/mysql-connector-j

# klibs
Expand All @@ -20,7 +20,7 @@ minecraft-spigot = "1.21-R0.1-SNAPSHOT" # https://github.com/PaperMC/Paper
minecraft-papi = "2.11.6" # https://github.com/PlaceholderAPI/PlaceholderAPI
minecraft-protocollib = "5.1.0" # https://github.com/dmulloy2/ProtocolLib
minecraft-vault = "1.7.1" # https://github.com/MilkBowl/VaultAPI
minecraft-astralibs = "3.10.0" # https://github.com/Astra-Interactive/AstraLibs
minecraft-astralibs = "3.12.0" # https://github.com/Astra-Interactive/AstraLibs
minecraft-bstats = "3.0.2" # https://github.com/Bastian/bStats
minecraft-mockbukkit = "3.96.1" #https://github.com/MockBukkit/MockBukkit

Expand All @@ -29,7 +29,7 @@ gradle-buildconfig = "5.4.0" # https://github.com/gmazzo/gradle-buildconfig-plug


# Exposed
exposed = "0.52.0" # https://github.com/JetBrains/Exposed
exposed = "0.53.0" # https://github.com/JetBrains/Exposed

[libraries]
# Kotlin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package ru.astrainteractive.astrarating.command.rating
import org.bukkit.OfflinePlayer
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import ru.astrainteractive.astralibs.command.api.command.BukkitCommand
import ru.astrainteractive.astralibs.command.api.exception.CommandException

internal interface RatingCommand : BukkitCommand {
internal interface RatingCommand {
sealed interface Result {
data object WrongUsage : Result
class ChangeRating(
val value: Int,
val message: String,
Expand All @@ -18,6 +17,9 @@ internal interface RatingCommand : BukkitCommand {
class OpenPlayerRatingGui(val player: Player, val selectedPlayerName: String) : Result
class OpenRatingsGui(val executor: Player) : Result
class Reload(val executor: CommandSender) : Result
data object NotPlayer : Result
}
sealed class Error(message: String) : CommandException(message) {
data object NotPlayer : Error("Not Player")
data object WrongUsage : Error("Wrong usage")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ internal class RatingCommandExecutor(
is RatingCommand.Result.Reload -> {
reload(input)
}

RatingCommand.Result.NotPlayer,
RatingCommand.Result.WrongUsage -> Unit
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import org.bukkit.Bukkit
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import ru.astrainteractive.astralibs.command.api.context.BukkitCommandContext
import ru.astrainteractive.astralibs.command.api.parser.BukkitCommandParser
import ru.astrainteractive.astralibs.command.api.parser.CommandParser

internal class RatingCommandParser : BukkitCommandParser<RatingCommand.Result> {
internal class RatingCommandParser : CommandParser<RatingCommand.Result, BukkitCommandContext> {

@Suppress("ThrowsCount")
private fun parseChangeRating(
label: String,
args: Array<out String>,
Expand All @@ -16,13 +17,13 @@ internal class RatingCommandParser : BukkitCommandParser<RatingCommand.Result> {
val amount = when (label) {
"like", "+" -> 1
"dislike", "-" -> -1
else -> return RatingCommand.Result.WrongUsage
else -> throw RatingCommand.Error.WrongUsage
}

val commandExecutor = (sender as? Player) ?: return RatingCommand.Result.NotPlayer
val commandExecutor = (sender as? Player) ?: throw RatingCommand.Error.NotPlayer

val ratedPlayer = args.getOrNull(1)
?.let(Bukkit::getOfflinePlayer) ?: return RatingCommand.Result.WrongUsage
?.let(Bukkit::getOfflinePlayer) ?: throw RatingCommand.Error.WrongUsage

val message = args.toList().subList(2, args.size).joinToString(" ")
return RatingCommand.Result.ChangeRating(
Expand All @@ -45,14 +46,14 @@ internal class RatingCommandParser : BukkitCommandParser<RatingCommand.Result> {
}

"rating" -> {
if (sender !is Player) return RatingCommand.Result.NotPlayer
if (sender !is Player) throw RatingCommand.Error.NotPlayer
commandContext.args.getOrNull(1)?.takeIf(String::isNotBlank)?.let { requestedPlayer ->
RatingCommand.Result.OpenPlayerRatingGui(sender, requestedPlayer)
} ?: RatingCommand.Result.OpenRatingsGui(sender)
}

"reload" -> RatingCommand.Result.Reload(sender)
else -> RatingCommand.Result.WrongUsage
else -> throw RatingCommand.Error.WrongUsage
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package ru.astrainteractive.astrarating.command.rating

import kotlinx.coroutines.CoroutineScope
import org.bukkit.plugin.java.JavaPlugin
import ru.astrainteractive.astralibs.command.api.commandfactory.BukkitCommandFactory
import ru.astrainteractive.astralibs.command.api.registry.BukkitCommandRegistry
import ru.astrainteractive.astralibs.command.api.registry.BukkitCommandRegistryContext.Companion.toCommandRegistryContext
import ru.astrainteractive.astralibs.command.api.error.ErrorHandler
import ru.astrainteractive.astralibs.command.api.util.PluginExt.registerCommand
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer
import ru.astrainteractive.astralibs.logging.JUtiltLogger
import ru.astrainteractive.astralibs.logging.Logger
import ru.astrainteractive.astrarating.core.PluginTranslation
import ru.astrainteractive.astrarating.feature.changerating.domain.usecase.AddRatingUseCase
import ru.astrainteractive.astrarating.gui.router.GuiRouter
Expand All @@ -20,11 +21,12 @@ internal class RatingCommandRegistry(
private val dispatchers: KotlinDispatchers,
private val kyoriComponentSerializer: KyoriComponentSerializer,
private val guiRouter: GuiRouter
) {
) : Logger by JUtiltLogger("RatingCommandRegistry") {

fun register() {
val command = BukkitCommandFactory.create(
plugin.registerCommand(
alias = "arating",
commandParser = RatingCommandParser(),
commandExecutor = RatingCommandExecutor(
addRatingUseCase = addRatingUseCase,
translation = translation,
Expand All @@ -33,53 +35,17 @@ internal class RatingCommandRegistry(
kyoriComponentSerializer = kyoriComponentSerializer,
router = guiRouter
),
commandParser = RatingCommandParser(),
commandSideEffect = { context, result ->
when (result) {
RatingCommand.Result.NotPlayer -> with(kyoriComponentSerializer) {
context.sender.sendMessage(translation.onlyPlayerCommand.let(::toComponent))
}

RatingCommand.Result.WrongUsage -> with(kyoriComponentSerializer) {
context.sender.sendMessage(translation.wrongUsage.let(::toComponent))
}

is RatingCommand.Result.OpenPlayerRatingGui,
is RatingCommand.Result.Reload,
is RatingCommand.Result.OpenRatingsGui,
is RatingCommand.Result.ChangeRating -> Unit
}
},
mapper = {
when (it) {
is RatingCommand.Result.OpenRatingsGui -> {
RatingCommand.Result.OpenRatingsGui(it.executor)
}

is RatingCommand.Result.Reload -> {
RatingCommand.Result.Reload(it.executor)
errorHandler = ErrorHandler { commandContext, throwable ->
when (throwable) {
is RatingCommand.Error.NotPlayer -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.onlyPlayerCommand.component)
}

is RatingCommand.Result.ChangeRating -> {
RatingCommand.Result.ChangeRating(
value = it.value,
message = it.message,
executor = it.executor,
ratedPlayer = it.ratedPlayer
)
}

RatingCommand.Result.WrongUsage -> null
RatingCommand.Result.NotPlayer -> null
is RatingCommand.Result.OpenPlayerRatingGui -> {
RatingCommand.Result.OpenPlayerRatingGui(
it.player,
it.selectedPlayerName
)
is RatingCommand.Error.WrongUsage -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.wrongUsage.component)
}
else -> warn { "#register unhandled exception ${throwable::class}" }
}
}
)
BukkitCommandRegistry.register(command, plugin.toCommandRegistryContext())
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package ru.astrainteractive.astrarating.command.reload

import org.bukkit.command.CommandSender
import ru.astrainteractive.astralibs.command.api.command.BukkitCommand

internal interface ReloadCommand : BukkitCommand {
sealed interface Result {
data object NoPermission : Result
class Success(val sender: CommandSender) : Result
}

class Input(val sender: CommandSender)
internal interface ReloadCommand {
class Result(val sender: CommandSender)
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package ru.astrainteractive.astrarating.command.reload

import ru.astrainteractive.astralibs.command.api.commandfactory.BukkitCommandFactory
import ru.astrainteractive.astralibs.command.api.parser.BukkitCommandParser
import ru.astrainteractive.astralibs.command.api.registry.BukkitCommandRegistry
import ru.astrainteractive.astralibs.command.api.registry.BukkitCommandRegistryContext.Companion.toCommandRegistryContext
import ru.astrainteractive.astralibs.command.api.context.BukkitCommandContextExt.requirePermission
import ru.astrainteractive.astralibs.command.api.error.ErrorHandler
import ru.astrainteractive.astralibs.command.api.exception.NoPermissionException
import ru.astrainteractive.astralibs.command.api.executor.CommandExecutor
import ru.astrainteractive.astralibs.command.api.parser.CommandParser
import ru.astrainteractive.astralibs.command.api.util.PluginExt.registerCommand
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer
import ru.astrainteractive.astralibs.permission.BukkitPermissibleExt.toPermissible
import ru.astrainteractive.astrarating.LifecyclePlugin
import ru.astrainteractive.astrarating.core.PluginTranslation
import ru.astrainteractive.astrarating.core.RatingPermission
Expand All @@ -17,31 +18,24 @@ internal class ReloadCommandRegistry(
) : KyoriComponentSerializer by kyoriComponentSerializer {

fun register() {
val command = BukkitCommandFactory.create(
plugin.registerCommand(
alias = "aratingreload",
commandParser = BukkitCommandParser { context ->
val hasPermission = context.sender.toPermissible().hasPermission(RatingPermission.Reload)
if (!hasPermission) return@BukkitCommandParser ReloadCommand.Result.NoPermission
ReloadCommand.Result.Success(context.sender)
},
commandExecutor = {
commandExecutor = CommandExecutor<ReloadCommand.Result> {
it.sender.sendMessage(translation.reload.let(::toComponent))
plugin.onReload()
it.sender.sendMessage(translation.reloadComplete.let(::toComponent))
},
commandSideEffect = { context, result ->
when (result) {
ReloadCommand.Result.NoPermission -> {
context.sender.sendMessage(translation.noPermission.let(::toComponent))
commandParser = CommandParser { context ->
context.requirePermission(RatingPermission.Reload)
ReloadCommand.Result(context.sender)
},
errorHandler = ErrorHandler { commandContext, throwable ->
when (throwable) {
is NoPermissionException -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.noPermission.component)
}

is ReloadCommand.Result.Success -> Unit
}
},
mapper = {
(it as? ReloadCommand.Result.Success)?.sender?.let(ReloadCommand::Input)
}
)
BukkitCommandRegistry.register(command, plugin.toCommandRegistryContext())
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ru.astrainteractive.astrarating.core.di

import ru.astrainteractive.astralibs.async.AsyncComponent
import ru.astrainteractive.astralibs.filemanager.impl.JVMResourceFileManager
import ru.astrainteractive.astralibs.lifecycle.Lifecycle
import ru.astrainteractive.astralibs.serialization.StringFormatExt.parse
import ru.astrainteractive.astralibs.serialization.StringFormatExt.writeIntoFile
Expand All @@ -27,21 +26,21 @@ interface CoreModule {
) : CoreModule {

override val translation: Reloadable<PluginTranslation> = Reloadable {
val fileManager = JVMResourceFileManager("translations.yml", dataFolder, this::class.java)
val file = dataFolder.resolve("translations.yml")
val serializer = YamlStringFormat()
serializer.parse<PluginTranslation>(fileManager.configFile)
serializer.parse<PluginTranslation>(file)
.onFailure(Throwable::printStackTrace)
.getOrElse { PluginTranslation() }
.also { serializer.writeIntoFile(it, fileManager.configFile) }
.also { serializer.writeIntoFile(it, file) }
}

override val config: Reloadable<EmpireConfig> = Reloadable {
val fileManager = JVMResourceFileManager("config.yml", dataFolder, this::class.java)
val file = dataFolder.resolve("config.yml")
val serializer = YamlStringFormat()
serializer.parse<EmpireConfig>(fileManager.configFile)
serializer.parse<EmpireConfig>(file)
.onFailure(Throwable::printStackTrace)
.getOrElse { EmpireConfig() }
.also { serializer.writeIntoFile(it, fileManager.configFile) }
.also { serializer.writeIntoFile(it, file) }
}
override val scope: Dependency<AsyncComponent> = Single {
AsyncComponent.Default()
Expand Down

0 comments on commit 5a4ce2c

Please sign in to comment.