Skip to content

Commit 4d41b44

Browse files
authored
added multiplatform commands and make commands module shared (#81)
1 parent 94e0b3a commit 4d41b44

33 files changed

Lines changed: 419 additions & 730 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ makeevrserg.java.ktarget=21
1313
# Project
1414
makeevrserg.project.name=SoulKeeper
1515
makeevrserg.project.group=ru.astrainteractive.soulkeeper
16-
makeevrserg.project.version.string=1.5.0
16+
makeevrserg.project.version.string=1.6.0
1717
makeevrserg.project.description=Keep your items after death
1818
makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com
1919
makeevrserg.project.url=https://github.com/Astra-Interactive/SoulKeeper

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ kotlin-serialization = "1.10.0"
2626
kotlin-serialization-kaml = "0.104.0"
2727
kotlin-version = "2.2.0"
2828
ktor = "3.4.0"
29-
minecraft-astralibs = "3.32.0"
29+
minecraft-astralibs = "3.33.0"
3030
minecraft-bstats = "3.2.1"
3131
minecraft-bungee = "1.21-R0.5-SNAPSHOT"
3232
minecraft-essentialsx = "2.21.2"

instances/bukkit/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies {
3434
implementation(projects.modules.dao)
3535
implementation(projects.modules.service)
3636
implementation(projects.modules.serviceBukkit)
37-
implementation(projects.modules.commandBukkit)
37+
implementation(projects.modules.command)
3838
}
3939

4040
minecraftProcessResource {

instances/bukkit/src/main/kotlin/ru/astrainteractive/soulkeeper/di/RootModule.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package ru.astrainteractive.soulkeeper.di
22

33
import org.bukkit.event.HandlerList
4+
import ru.astrainteractive.astralibs.command.api.brigadier.command.MultiplatformCommand
5+
import ru.astrainteractive.astralibs.command.api.brigadier.command.PaperMultiplatformCommands
6+
import ru.astrainteractive.astralibs.command.api.registrar.PaperCommandRegistrarContext
47
import ru.astrainteractive.astralibs.coroutines.DefaultBukkitDispatchers
58
import ru.astrainteractive.astralibs.lifecycle.Lifecycle
69
import ru.astrainteractive.astralibs.lifecycle.LifecyclePlugin
@@ -44,8 +47,14 @@ class RootModule(plugin: LifecyclePlugin) {
4447

4548
private val commandModule = CommandModule(
4649
coreModule = coreModule,
47-
bukkitCoreModule = bukkitCoreModule,
48-
soulsDaoModule = soulsDaoModule
50+
commandRegistrarContext = PaperCommandRegistrarContext(
51+
mainScope = coreModule.mainScope,
52+
plugin = plugin
53+
),
54+
soulsDaoModule = soulsDaoModule,
55+
serviceModule = serviceModule,
56+
multiplatformCommand = MultiplatformCommand(PaperMultiplatformCommands()),
57+
lifecyclePlugin = plugin,
4958
)
5059

5160
private val lifecycles: List<Lifecycle>

instances/neoforge/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies {
3333
shadow(libs.minecraft.kyori.gson)
3434
// Local
3535
shadow(projects.modules.core)
36-
shadow(projects.modules.commandNeoforge)
36+
shadow(projects.modules.command)
3737
shadow(projects.modules.dao)
3838
shadow(projects.modules.service)
3939
shadow(projects.modules.serviceNeoforge)

instances/neoforge/src/main/kotlin/ru/astrainteractive/soulkeeper/di/RootModule.kt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import kotlinx.coroutines.CoroutineDispatcher
44
import kotlinx.coroutines.Dispatchers
55
import kotlinx.coroutines.MainCoroutineDispatcher
66
import net.neoforged.fml.loading.FMLPaths
7+
import ru.astrainteractive.astralibs.command.api.brigadier.command.MultiplatformCommand
8+
import ru.astrainteractive.astralibs.command.brigadier.command.NeoForgeMultiplatformCommands
9+
import ru.astrainteractive.astralibs.command.registrar.NeoForgeCommandRegistrarContext
710
import ru.astrainteractive.astralibs.coroutines.NeoForgeMainDispatcher
811
import ru.astrainteractive.astralibs.lifecycle.Lifecycle
912
import ru.astrainteractive.klibs.mikro.core.dispatchers.KotlinDispatchers
@@ -67,11 +70,18 @@ class RootModule(private val plugin: Lifecycle) {
6770
effectEmitter = forgePlatformServiceModule.effectEmitter
6871
)
6972
}
70-
private val commandModule = CommandModule(
71-
coreModule = coreModule,
72-
soulsDaoModule = soulsDaoModule,
73-
plugin = plugin,
74-
)
73+
private val commandModule by lazy {
74+
CommandModule(
75+
coreModule = coreModule,
76+
soulsDaoModule = soulsDaoModule,
77+
commandRegistrarContext = NeoForgeCommandRegistrarContext(
78+
mainScope = coreModule.mainScope
79+
),
80+
serviceModule = serviceModule,
81+
multiplatformCommand = MultiplatformCommand(NeoForgeMultiplatformCommands()),
82+
lifecyclePlugin = plugin,
83+
)
84+
}
7585

7686
private val lifecycles: List<Lifecycle>
7787
get() = listOfNotNull(

modules/command-bukkit/src/main/kotlin/ru/astrainteractive/soulkeeper/command/reload/SoulsReloadCommandRegistrar.kt

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

modules/command-bukkit/src/main/kotlin/ru/astrainteractive/soulkeeper/command/soulkrate/SoulKrateCommandRegistrar.kt

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

modules/command-bukkit/src/main/kotlin/ru/astrainteractive/soulkeeper/command/souls/SoulsCommand.kt

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

modules/command-bukkit/src/main/kotlin/ru/astrainteractive/soulkeeper/command/souls/SoulsListCommandRegistrar.kt

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

0 commit comments

Comments
 (0)