Skip to content

Commit 5cf549d

Browse files
authored
Update - Gettin ready for 8.0.0 (#76)
1 parent a542cc2 commit 5cf549d

File tree

47 files changed

+447
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+447
-647
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ makeevrserg.java.ktarget=21
99
# Project
1010
makeevrserg.project.name=AstraTemplate
1111
makeevrserg.project.group=ru.astrainteractive.astratemplate
12-
makeevrserg.project.version.string=7.7.9
12+
makeevrserg.project.version.string=7.8.0
1313
makeevrserg.project.description=Template plugin for EmpireProjekt
1414
makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com
1515
makeevrserg.project.url=https://github.com/Astra-Interactive/AstraTemplate

gradle/libs.versions.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[versions]
22
# Kotlin
3-
kotlin-version = "2.0.0" # https://github.com/JetBrains/kotlin
4-
kotlin-coroutines = "1.10.1" # https://github.com/Kotlin/kotlinx.coroutines
5-
kotlin-json = "1.8.0" # https://github.com/Kotlin/kotlinx.serialization
6-
kotlin-kaml = "0.72.0" # https://github.com/charleskorn/kaml
3+
kotlin-version = "2.2.0" # https://github.com/JetBrains/kotlin
4+
kotlin-coroutines = "1.10.2" # https://github.com/Kotlin/kotlinx.coroutines
5+
kotlin-json = "1.9.0" # https://github.com/Kotlin/kotlinx.serialization
6+
kotlin-kaml = "0.92.0" # https://github.com/charleskorn/kaml
77

88
# Drivers
9-
driver-jdbc = "3.49.0.0" # https://github.com/xerial/sqlite-jdbc
9+
driver-jdbc = "3.50.3.0" # https://github.com/xerial/sqlite-jdbc
1010
driver-mysql = "8.0.33" # https://github.com/mysql/mysql-connector-j
1111

1212
# Minecraft
@@ -18,16 +18,16 @@ minecraft-protocollib = "5.3.0"
1818
minecraft-wg = "7.0.7"
1919
minecraft-vault = "1.7.1" # https://github.com/MilkBowl/VaultAPI
2020
minecraft-coreprotect = "21.2"
21-
minecraft-astralibs = "3.19.3" # https://github.com/Astra-Interactive/AstraLibs
21+
minecraft-astralibs = "3.25.1" # https://github.com/Astra-Interactive/AstraLibs
2222
minecraft-bstats = "3.1.0"
2323
minecraft-mockbukkit = "4.33.2"
2424

2525
# Testing
2626
tests-org-testing = "7.11.0"
2727
tests-junit = "4.12"
2828
tests-mockito = "4.0.0"
29-
tests-junit-jupiter-api = "5.11.4"
30-
tests-junit-bom = "5.11.4"
29+
tests-junit-jupiter-api = "5.13.4"
30+
tests-junit-bom = "5.13.4"
3131

3232
# Fabric
3333
minecraft-fabric-loom = "1.10.1"
@@ -37,18 +37,18 @@ minecraft-fabric-api = "0.116.0+"
3737
minecraft-fabric-yarn = "1.21+build.2"
3838

3939
# Shadow
40-
gradle-shadow = "8.1.1"
40+
gradle-shadow = "9.0.0-beta12" # https://github.com/johnrengelman/shadow
4141

4242
# BuildConfig
43-
gradle-buildconfig = "5.5.1"
43+
gradle-buildconfig = "5.6.7"
4444

4545
# Exposed
46-
exposed = "0.59.0"
46+
exposed = "0.61.0"
4747

4848
# klibs
49-
klibs-gradleplugin = "1.5.0-alpha02" # https://github.com/makeevrserg/gradle-plugin
50-
klibs-kstorage = "3.2.6" # https://github.com/makeevrserg/klibs.kstorage
51-
klibs-mikro = "1.8.15" # https://github.com/makeevrserg/klibs.mikro
49+
klibs-gradleplugin = "1.10.0" # https://github.com/makeevrserg/gradle-plugin
50+
klibs-kstorage = "4.2.2" # https://github.com/makeevrserg/klibs.kstorage
51+
klibs-mikro = "1.12.0" # https://github.com/makeevrserg/klibs.mikro
5252

5353
[bundles]
5454
exposed = ["exposed-java-time", "exposed-jdbc", "exposed-dao", "exposed-core"]
@@ -129,7 +129,7 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
129129
minecraft-fabric-loom = { id = "fabric-loom", version.ref = "minecraft-fabric-loom" }
130130

131131
# Gradle
132-
gradle-shadow = { id = "com.github.johnrengelman.shadow", version.ref = "gradle-shadow" }
132+
gradle-shadow = { id = "com.gradleup.shadow", version.ref = "gradle-shadow" }
133133
gradle-buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "gradle-buildconfig" }
134134

135135
# klibs - core

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AstraTemplate :
1414
JavaPlugin(),
1515
Logger by JUtiltLogger("AstraTemplate"),
1616
Lifecycle {
17-
private val rootModule = RootModule.Default(this)
17+
private val rootModule = RootModule(this)
1818

1919
/**
2020
* This method called when server starts or PlugMan load plugin.

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/DefaultErrorHandler.kt

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,61 @@ import ru.astrainteractive.astralibs.command.api.exception.NoPermissionException
88
import ru.astrainteractive.astralibs.command.api.exception.NoPlayerException
99
import ru.astrainteractive.astralibs.command.api.exception.NoPotionEffectTypeException
1010
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer
11+
import ru.astrainteractive.astralibs.kyori.unwrap
1112
import ru.astrainteractive.astralibs.logging.JUtiltLogger
1213
import ru.astrainteractive.astralibs.logging.Logger
1314
import ru.astrainteractive.astratemplate.command.additem.AddItemCommand
1415
import ru.astrainteractive.astratemplate.command.gui.GuiCommand
15-
import ru.astrainteractive.astratemplate.core.PluginTranslation
16-
import ru.astrainteractive.astratemplate.core.util.getValue
17-
import ru.astrainteractive.klibs.kstorage.api.Krate
16+
import ru.astrainteractive.astratemplate.core.plugin.PluginTranslation
17+
import ru.astrainteractive.klibs.kstorage.api.CachedKrate
18+
import ru.astrainteractive.klibs.kstorage.util.getValue
1819

1920
internal class DefaultErrorHandler(
20-
translationKrate: Krate<PluginTranslation>,
21-
kyoriKrate: Krate<KyoriComponentSerializer>
21+
translationKrate: CachedKrate<PluginTranslation>,
22+
kyoriKrate: CachedKrate<KyoriComponentSerializer>
2223
) : ErrorHandler<BukkitCommandContext>,
23-
Logger by JUtiltLogger("AstraTemplate-DefaultErrorHandler") {
24+
Logger by JUtiltLogger("AstraTemplate-DefaultErrorHandler"),
25+
KyoriComponentSerializer by kyoriKrate.unwrap() {
2426
private val translation by translationKrate
25-
private val kyori by kyoriKrate
2627

2728
override fun handle(ctx: BukkitCommandContext, throwable: Throwable) {
28-
with(kyori) {
29-
when (throwable) {
30-
is AddItemCommand.Error -> {
31-
when (throwable) {
32-
AddItemCommand.Error.ItemNotfound -> {
33-
ctx.sender.sendMessage(translation.fault.itemNotFound.component)
34-
}
29+
when (throwable) {
30+
is AddItemCommand.Error -> {
31+
when (throwable) {
32+
AddItemCommand.Error.ItemNotfound -> {
33+
ctx.sender.sendMessage(translation.fault.itemNotFound.component)
34+
}
3535

36-
AddItemCommand.Error.SenderNotPlayer -> {
37-
ctx.sender.sendMessage(translation.fault.notPlayer.component)
38-
}
36+
AddItemCommand.Error.SenderNotPlayer -> {
37+
ctx.sender.sendMessage(translation.fault.notPlayer.component)
3938
}
4039
}
40+
}
4141

42-
is GuiCommand.Error -> {
43-
when (throwable) {
44-
GuiCommand.Error.NotPlayer -> {
45-
ctx.sender.sendMessage(translation.fault.notPlayer.component)
46-
}
42+
is GuiCommand.Error -> {
43+
when (throwable) {
44+
GuiCommand.Error.NotPlayer -> {
45+
ctx.sender.sendMessage(translation.fault.notPlayer.component)
4746
}
4847
}
48+
}
4949

50-
is NoPlayerException -> {
51-
ctx.sender.sendMessage(translation.fault.playerNotExists.component)
52-
}
50+
is NoPlayerException -> {
51+
ctx.sender.sendMessage(translation.fault.playerNotExists.component)
52+
}
5353

54-
is NoPermissionException -> {
55-
ctx.sender.sendMessage(translation.fault.noPermission.component)
56-
}
54+
is NoPermissionException -> {
55+
ctx.sender.sendMessage(translation.fault.noPermission.component)
56+
}
5757

58-
is NoPotionEffectTypeException,
59-
is BadArgumentException,
60-
is ArgumentTypeException -> {
61-
error { "#handle intentionally unhandled error: $throwable" }
62-
}
58+
is NoPotionEffectTypeException,
59+
is BadArgumentException,
60+
is ArgumentTypeException -> {
61+
error { "#handle intentionally unhandled error: $throwable" }
62+
}
6363

64-
else -> {
65-
error { "#handle unhandled error: $throwable" }
66-
}
64+
else -> {
65+
error { "#handle unhandled error: $throwable" }
6766
}
6867
}
6968
}

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/additem/AddItemCommandRegistry.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ package ru.astrainteractive.astratemplate.command.additem
33
import org.bukkit.Bukkit
44
import org.bukkit.Material
55
import org.bukkit.plugin.java.JavaPlugin
6+
import ru.astrainteractive.astralibs.command.api.context.BukkitCommandContext
7+
import ru.astrainteractive.astralibs.command.api.error.ErrorHandler
68
import ru.astrainteractive.astralibs.command.api.util.PluginExt.setCommandExecutor
7-
import ru.astrainteractive.astralibs.util.StringListExt.withEntry
8-
import ru.astrainteractive.astratemplate.command.DefaultErrorHandler
9-
import ru.astrainteractive.astratemplate.command.additem.di.AddItemCommandDependencies
9+
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer
10+
import ru.astrainteractive.astralibs.kyori.unwrap
11+
import ru.astrainteractive.astralibs.util.withEntry
12+
import ru.astrainteractive.klibs.kstorage.api.CachedKrate
1013

1114
internal class AddItemCommandRegistry(
12-
dependencies: AddItemCommandDependencies
13-
) : AddItemCommandDependencies by dependencies {
15+
private val plugin: JavaPlugin,
16+
private val errorHandler: ErrorHandler<BukkitCommandContext>,
17+
kyoriKrate: CachedKrate<KyoriComponentSerializer>
18+
) : KyoriComponentSerializer by kyoriKrate.unwrap() {
1419
private val alias = "add"
1520

1621
private fun tabCompleter(plugin: JavaPlugin) {
@@ -29,10 +34,7 @@ internal class AddItemCommandRegistry(
2934
alias = alias,
3035
commandParser = AddItemCommandParser(),
3136
commandExecutor = AddItemExecutor(),
32-
errorHandler = DefaultErrorHandler(
33-
translationKrate = translationKrate,
34-
kyoriKrate = kyoriKrate
35-
)
37+
errorHandler = errorHandler
3638
)
3739
}
3840
}

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/additem/di/AddItemCommandDependencies.kt

Lines changed: 0 additions & 12 deletions
This file was deleted.

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/common/CommonCommandsRegistry.kt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
package ru.astrainteractive.astratemplate.command.common
22

3-
import ru.astrainteractive.astralibs.util.StringListExt.withEntry
4-
import ru.astrainteractive.astratemplate.command.common.di.CommonCommandsDependencies
3+
import org.bukkit.plugin.java.JavaPlugin
4+
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer
5+
import ru.astrainteractive.astralibs.kyori.unwrap
6+
import ru.astrainteractive.astralibs.util.withEntry
7+
import ru.astrainteractive.astratemplate.core.plugin.PluginTranslation
8+
import ru.astrainteractive.klibs.kstorage.api.CachedKrate
9+
import ru.astrainteractive.klibs.kstorage.util.getValue
510

611
internal class CommonCommandsRegistry(
7-
dependencies: CommonCommandsDependencies
8-
) : CommonCommandsDependencies by dependencies {
12+
private val plugin: JavaPlugin,
13+
translationKrate: CachedKrate<PluginTranslation>,
14+
kyoriKrate: CachedKrate<KyoriComponentSerializer>
15+
) : KyoriComponentSerializer by kyoriKrate.unwrap() {
16+
private val translation by translationKrate
917

1018
fun register() {
1119
plugin.getCommand("atemp")?.setTabCompleter { sender, command, label, args ->
@@ -16,7 +24,7 @@ internal class CommonCommandsRegistry(
1624
}
1725
}
1826
plugin.getCommand("translation")?.setExecutor { sender, command, label, args ->
19-
sender.sendMessage(translation.general.getByByCheck.let(kyori::toComponent))
27+
sender.sendMessage(translation.general.getByByCheck.component)
2028
true
2129
}
2230
}

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/common/di/CommonCommandsDependencies.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/damage/DamageCommandRegistry.kt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
package ru.astrainteractive.astratemplate.command.damage
22

33
import org.bukkit.Bukkit
4+
import org.bukkit.plugin.java.JavaPlugin
45
import ru.astrainteractive.astralibs.command.api.context.BukkitCommandContext
6+
import ru.astrainteractive.astralibs.command.api.error.ErrorHandler
57
import ru.astrainteractive.astralibs.command.api.exception.NoPermissionException
68
import ru.astrainteractive.astralibs.command.api.exception.NoPlayerException
79
import ru.astrainteractive.astralibs.command.api.executor.CommandExecutor
810
import ru.astrainteractive.astralibs.command.api.parser.CommandParser
911
import ru.astrainteractive.astralibs.command.api.util.PluginExt.setCommandExecutor
12+
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer
13+
import ru.astrainteractive.astralibs.kyori.unwrap
1014
import ru.astrainteractive.astralibs.permission.BukkitPermissibleExt.toPermissible
11-
import ru.astrainteractive.astratemplate.command.DefaultErrorHandler
12-
import ru.astrainteractive.astratemplate.command.damage.di.DamageCommandDependencies
13-
import ru.astrainteractive.astratemplate.core.PluginPermission
15+
import ru.astrainteractive.astratemplate.core.plugin.PluginPermission
16+
import ru.astrainteractive.astratemplate.core.plugin.PluginTranslation
17+
import ru.astrainteractive.klibs.kstorage.api.CachedKrate
18+
import ru.astrainteractive.klibs.kstorage.util.getValue
1419

1520
internal class DamageCommandRegistry(
16-
dependencies: DamageCommandDependencies
17-
) : DamageCommandDependencies by dependencies {
21+
private val plugin: JavaPlugin,
22+
private val errorHandler: ErrorHandler<BukkitCommandContext>,
23+
translationKrate: CachedKrate<PluginTranslation>,
24+
kyoriKrate: CachedKrate<KyoriComponentSerializer>
25+
) : KyoriComponentSerializer by kyoriKrate.unwrap() {
26+
private val translation by translationKrate
1827
private val alias = "adamage"
1928

2029
private inner class CommandParserImpl : CommandParser<DamageCommand.Result, BukkitCommandContext> {
@@ -41,9 +50,7 @@ internal class DamageCommandRegistry(
4150

4251
private inner class CommandExecutorImpl : CommandExecutor<DamageCommand.Result> {
4352
override fun execute(input: DamageCommand.Result) {
44-
with(kyori) {
45-
input.player.sendMessage(translation.custom.damaged(input.damagerName).let(::toComponent))
46-
}
53+
input.player.sendMessage(translation.custom.damaged(input.damagerName).let(::toComponent))
4754
input.player.damage(input.damage)
4855
}
4956
}
@@ -63,10 +70,7 @@ internal class DamageCommandRegistry(
6370
alias = alias,
6471
commandParser = CommandParserImpl(),
6572
commandExecutor = CommandExecutorImpl(),
66-
errorHandler = DefaultErrorHandler(
67-
translationKrate = translationKrate,
68-
kyoriKrate = kyoriKrate
69-
)
73+
errorHandler = errorHandler
7074
)
7175
}
7276
}

instances/bukkit/src/main/kotlin/ru/astrainteractive/astratemplate/command/damage/di/DamageCommandDependencies.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)