Skip to content

Commit

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

Bumps the versions group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) | `3.46.0.0` | `3.46.0.1` |
| [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 `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: 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] <[email protected]>

* Update gradle.properties

* fix build

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Roman Makeev <[email protected]>
Co-authored-by: makeevrserg <[email protected]>
  • Loading branch information
3 people authored Aug 9, 2024
1 parent a47cbd1 commit 5c89483
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 77 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=AstraMarket
makeevrserg.project.group=ru.astrainteractive.astramarket
makeevrserg.project.version.string=1.16.8
makeevrserg.project.version.string=1.16.9
makeevrserg.project.description=Market plugin for EmpireSMP
makeevrserg.project.developers=makeevrserg|Makeev Roman|[email protected]
makeevrserg.project.url=https://empireprojekt.ru
4 changes: 2 additions & 2 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ package ru.astrainteractive.astramarket.command.auction

import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import ru.astrainteractive.astralibs.command.api.command.BukkitCommand
import ru.astrainteractive.astralibs.command.api.exception.CommandException
import java.util.UUID

internal interface AuctionCommand : BukkitCommand {
internal interface AuctionCommand {
sealed interface Result {
data object NoPermission : Result
data object WrongUsage : Result
data object NotPlayer : Result
data object WrongPrice : Result
class OpenSlots(
val player: Player,
val isExpired: Boolean,
Expand All @@ -25,4 +21,10 @@ internal interface AuctionCommand : BukkitCommand {
val price: Float
) : Result
}

sealed class Error(message: String) : CommandException(message) {
data object WrongUsage : Error("Wrong usage")
data object NotPlayer : Error("Not player")
data object WrongPrice : Error("Wrong price")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package ru.astrainteractive.astramarket.command.auction

import ru.astrainteractive.astralibs.command.api.context.BukkitCommandContext
import ru.astrainteractive.astralibs.command.api.error.ErrorHandler
import ru.astrainteractive.astralibs.command.api.exception.NoPermissionException
import ru.astrainteractive.astramarket.command.auction.di.AuctionCommandDependencies

internal class AuctionCommandErrorHandler(
private val dependencies: AuctionCommandDependencies
) : ErrorHandler<BukkitCommandContext>,
AuctionCommandDependencies by dependencies {
override fun handle(commandContext: BukkitCommandContext, throwable: Throwable) {
when (throwable) {
is NoPermissionException -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.general.noPermissions.component)
}

AuctionCommand.Error.NotPlayer -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.general.onlyForPlayers.component)
}

AuctionCommand.Error.WrongPrice -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.auction.wrongPrice.component)
}

AuctionCommand.Error.WrongUsage -> with(kyoriComponentSerializer) {
commandContext.sender.sendMessage(translation.general.wrongArgs.component)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ internal class AuctionCommandExecutor(
if (!useCaseResult) itemInstance.amount += calculatedAmount
}
}

AuctionCommand.Result.WrongUsage,
AuctionCommand.Result.NoPermission,
AuctionCommand.Result.NotPlayer,
AuctionCommand.Result.WrongPrice -> Unit
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ package ru.astrainteractive.astramarket.command.auction
import org.bukkit.Bukkit
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.permission.BukkitPermissibleExt.toPermissible
import ru.astrainteractive.astralibs.command.api.context.BukkitCommandContextExt.requirePermission
import ru.astrainteractive.astralibs.command.api.parser.CommandParser
import ru.astrainteractive.astramarket.core.PluginPermission

internal class AuctionCommandParser : BukkitCommandParser<AuctionCommand.Result> {
internal class AuctionCommandParser : CommandParser<AuctionCommand.Result, BukkitCommandContext> {
override fun parse(commandContext: BukkitCommandContext): AuctionCommand.Result {
if (!commandContext.sender.toPermissible().hasPermission(PluginPermission.Amarket)) {
return AuctionCommand.Result.NoPermission
}
commandContext.requirePermission(PluginPermission.Amarket)
return when (commandContext.args.getOrNull(0)) {
"sell" -> {
val price = commandContext.args.getOrNull(1)?.toFloatOrNull()
price ?: return AuctionCommand.Result.WrongPrice
price ?: throw AuctionCommand.Error.WrongPrice
val amount = commandContext.args.getOrNull(2)?.toIntOrNull() ?: 1
val player = commandContext.sender as? Player
player ?: return AuctionCommand.Result.NotPlayer
player ?: throw AuctionCommand.Error.NotPlayer
val itemInstance = player.inventory.itemInMainHand
AuctionCommand.Result.WrongPrice
AuctionCommand.Result.Sell(
player = player,
itemInstance = itemInstance,
Expand All @@ -31,7 +28,7 @@ internal class AuctionCommandParser : BukkitCommandParser<AuctionCommand.Result>

"players" -> {
val player = commandContext.sender as? Player
player ?: return AuctionCommand.Result.NotPlayer
player ?: throw AuctionCommand.Error.NotPlayer
AuctionCommand.Result.OpenPlayers(
player = player,
isExpired = false
Expand All @@ -41,7 +38,7 @@ internal class AuctionCommandParser : BukkitCommandParser<AuctionCommand.Result>
// Open and else
else -> {
val player = commandContext.sender as? Player
player ?: return AuctionCommand.Result.NotPlayer
player ?: throw AuctionCommand.Error.NotPlayer
val targetPlayerUuid = commandContext.args
.getOrNull(1)
?.let(Bukkit::getPlayer)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
package ru.astrainteractive.astramarket.command.auction

import ru.astrainteractive.astralibs.command.api.command.Command
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.util.PluginExt.registerCommand
import ru.astrainteractive.astramarket.command.auction.di.AuctionCommandDependencies

internal class AuctionCommandRegistry(
private val dependencies: AuctionCommandDependencies
) {
fun register() {
val command = BukkitCommandFactory.create(
dependencies.plugin.registerCommand(
alias = "amarket",
commandParser = AuctionCommandParser(),
commandExecutor = AuctionCommandExecutor(dependencies),
commandSideEffect = AuctionCommandSideEffect(dependencies),
mapper = Command.Mapper.NoOp()
)
BukkitCommandRegistry.register(
command = command,
registryContext = dependencies.plugin.toCommandRegistryContext()
errorHandler = AuctionCommandErrorHandler(dependencies)
)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ru.astrainteractive.astramarket.core.di

import ru.astrainteractive.astralibs.async.AsyncComponent
import ru.astrainteractive.astralibs.economy.EconomyProvider
import ru.astrainteractive.astralibs.filemanager.impl.JVMFileManager
import ru.astrainteractive.astralibs.lifecycle.Lifecycle
import ru.astrainteractive.astralibs.serialization.StringFormatExt.parse
import ru.astrainteractive.astralibs.serialization.StringFormatExt.writeIntoFile
Expand Down Expand Up @@ -30,21 +29,21 @@ interface CoreModule {
) : CoreModule {

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

override val config: Reloadable<PluginConfig> = Reloadable {
val fileManager = JVMFileManager("config.yml", dataFolder)
val file = dataFolder.resolve("config.yml")
val serializer = YamlStringFormat()
serializer.parse<PluginConfig>(fileManager.configFile)
serializer.parse<PluginConfig>(file)
.onFailure(Throwable::printStackTrace)
.getOrElse { PluginConfig() }
.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 5c89483

Please sign in to comment.