-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Astra-Interactive/architecture
Update modules
- Loading branch information
Showing
89 changed files
with
521 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ makeevrserg.java.ktarget=21 | |
# Project | ||
makeevrserg.project.name=AstraMarket | ||
makeevrserg.project.group=ru.astrainteractive.astramarket | ||
makeevrserg.project.version.string=1.14.2 | ||
makeevrserg.project.version.string=1.15.0 | ||
makeevrserg.project.description=Market plugin for EmpireSMP | ||
makeevrserg.project.developers=makeevrserg|Makeev Roman|[email protected] | ||
makeevrserg.project.url=https://empireprojekt.ru |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
plugins { | ||
kotlin("jvm") | ||
kotlin("plugin.serialization") | ||
} | ||
|
||
dependencies { | ||
// Kotlin | ||
implementation(libs.bundles.kotlin) | ||
// AstraLibs | ||
implementation(libs.minecraft.astralibs.core) | ||
implementation(libs.minecraft.astralibs.core.bukkit) | ||
implementation(libs.klibs.kdi) | ||
implementation(libs.klibs.mikro.core) | ||
implementation(libs.minecraft.astralibs.command) | ||
implementation(libs.minecraft.astralibs.command.bukkit) | ||
// Spigot dependencies | ||
compileOnly(libs.minecraft.paper.api) | ||
// Local | ||
implementation(projects.modules.apiMarket) | ||
implementation(projects.modules.core) | ||
implementation(projects.modules.coreBukkit) | ||
implementation(projects.modules.marketView) | ||
implementation(projects.modules.guiBukkit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ain/kotlin/ru/astrainteractive/astramarket/command/common/di/CommonCommandDependencies.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ru.astrainteractive.astramarket.command.common.di | ||
|
||
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer | ||
import ru.astrainteractive.astramarket.core.AstraMarketPlugin | ||
import ru.astrainteractive.astramarket.core.Translation | ||
import ru.astrainteractive.astramarket.core.di.BukkitCoreModule | ||
import ru.astrainteractive.astramarket.core.di.CoreModule | ||
import ru.astrainteractive.klibs.kdi.getValue | ||
|
||
internal interface CommonCommandDependencies { | ||
val plugin: AstraMarketPlugin | ||
val translation: Translation | ||
val kyoriComponentSerializer: KyoriComponentSerializer | ||
|
||
class Default( | ||
bukkitCoreModule: BukkitCoreModule, | ||
coreModule: CoreModule | ||
) : CommonCommandDependencies { | ||
override val plugin: AstraMarketPlugin by bukkitCoreModule.plugin | ||
override val translation: Translation by coreModule.translation | ||
override val kyoriComponentSerializer by bukkitCoreModule.kyoriComponentSerializer | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
kotlin("jvm") | ||
kotlin("plugin.serialization") | ||
} | ||
|
||
dependencies { | ||
// Kotlin | ||
implementation(libs.bundles.kotlin) | ||
// AstraLibs | ||
implementation(libs.minecraft.astralibs.core) | ||
implementation(libs.minecraft.astralibs.core.bukkit) | ||
implementation(libs.klibs.kdi) | ||
implementation(libs.minecraft.astralibs.menu.bukkit) | ||
// Spigot dependencies | ||
compileOnly(libs.minecraft.paper.api) | ||
implementation(libs.minecraft.bstats) | ||
// Local | ||
implementation(projects.modules.core) | ||
} |
16 changes: 16 additions & 0 deletions
16
...les/core-bukkit/src/main/kotlin/ru/astrainteractive/astramarket/core/AstraMarketPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ru.astrainteractive.astramarket.core | ||
|
||
import org.bukkit.plugin.java.JavaPlugin | ||
import ru.astrainteractive.astralibs.lifecycle.Lifecycle | ||
|
||
abstract class AstraMarketPlugin : JavaPlugin(), Lifecycle { | ||
override fun onEnable() { | ||
super<Lifecycle>.onEnable() | ||
super<JavaPlugin>.onEnable() | ||
} | ||
|
||
override fun onDisable() { | ||
super<Lifecycle>.onDisable() | ||
super<JavaPlugin>.onDisable() | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...s/core-bukkit/src/main/kotlin/ru/astrainteractive/astramarket/core/di/BukkitCoreModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package ru.astrainteractive.astramarket.core.di | ||
|
||
import org.bstats.bukkit.Metrics | ||
import ru.astrainteractive.astralibs.encoding.encoder.BukkitObjectEncoder | ||
import ru.astrainteractive.astralibs.encoding.encoder.ObjectEncoder | ||
import ru.astrainteractive.astralibs.event.EventListener | ||
import ru.astrainteractive.astralibs.kyori.KyoriComponentSerializer | ||
import ru.astrainteractive.astralibs.lifecycle.Lifecycle | ||
import ru.astrainteractive.astralibs.menu.event.DefaultInventoryClickEvent | ||
import ru.astrainteractive.astramarket.core.AstraMarketPlugin | ||
import ru.astrainteractive.klibs.kdi.Factory | ||
import ru.astrainteractive.klibs.kdi.Lateinit | ||
import ru.astrainteractive.klibs.kdi.Reloadable | ||
import ru.astrainteractive.klibs.kdi.Single | ||
import ru.astrainteractive.klibs.kdi.getValue | ||
|
||
interface BukkitCoreModule { | ||
val lifecycle: Lifecycle | ||
|
||
val plugin: Lateinit<AstraMarketPlugin> | ||
val encoder: Single<ObjectEncoder> | ||
|
||
val inventoryClickEventListener: Single<EventListener> | ||
val kyoriComponentSerializer: Reloadable<KyoriComponentSerializer> | ||
|
||
class Default : BukkitCoreModule { | ||
|
||
override val plugin: Lateinit<AstraMarketPlugin> = Lateinit() | ||
|
||
override val encoder: Single<ObjectEncoder> = Single { | ||
BukkitObjectEncoder() | ||
} | ||
|
||
override val inventoryClickEventListener: Single<EventListener> = Single { | ||
DefaultInventoryClickEvent() | ||
} | ||
|
||
override val kyoriComponentSerializer: Reloadable<KyoriComponentSerializer> = Reloadable { | ||
KyoriComponentSerializer.Legacy | ||
} | ||
|
||
private val bStatsFactory = Factory { | ||
val plugin by plugin | ||
Metrics(plugin, 15771) | ||
} | ||
|
||
override val lifecycle: Lifecycle by lazy { | ||
Lifecycle.Lambda( | ||
onEnable = { | ||
bStatsFactory.create() | ||
inventoryClickEventListener.value.onEnable(plugin.value) | ||
}, | ||
onDisable = { | ||
inventoryClickEventListener.value.onEnable(plugin.value) | ||
} | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.