diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 9a3219e..1e09105 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -33,7 +33,7 @@ minecraft { } dependencies { - minecraft("net.minecraftforge:forge:1.20.6-50.0.34") + minecraft("net.minecraftforge:forge:1.20.6-50.1.3") // AstraLibs implementation(libs.minecraft.astralibs.core) implementation(libs.minecraft.astralibs.command) diff --git a/forge/src/main/java/ru/astrainteractive/astratemplate/ForgeEntryPoint.kt b/forge/src/main/java/ru/astrainteractive/astratemplate/ForgeEntryPoint.kt index eee7496..34c70c6 100644 --- a/forge/src/main/java/ru/astrainteractive/astratemplate/ForgeEntryPoint.kt +++ b/forge/src/main/java/ru/astrainteractive/astratemplate/ForgeEntryPoint.kt @@ -7,6 +7,8 @@ import net.minecraftforge.event.server.ServerStartedEvent import net.minecraftforge.event.server.ServerStoppingEvent import net.minecraftforge.eventbus.api.SubscribeEvent import net.minecraftforge.fml.common.Mod +import ru.astrainteractive.astralibs.logging.JUtiltLogger +import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astratemplate.command.CommandLoader import ru.astrainteractive.astratemplate.di.RootModule import ru.astrainteractive.astratemplate.event.core.ForgeEventBusListener @@ -14,26 +16,28 @@ import javax.annotation.ParametersAreNonnullByDefault @Mod(BuildKonfig.id) @ParametersAreNonnullByDefault -class ForgeEntryPoint : ForgeEventBusListener { +class ForgeEntryPoint : + ForgeEventBusListener, + Logger by JUtiltLogger("ForgeEntryPoint") { private val rootModule: RootModule by lazy { RootModule.Default() } @SubscribeEvent fun onEnable(e: ServerStartedEvent) { - rootModule.coreModule.logger.value.info("ForgeEntryPoint", "onEnable") + info { "#onEnable" } rootModule.lifecycle.onEnable() } @SubscribeEvent fun onDisable(e: ServerStoppingEvent) { - rootModule.coreModule.logger.value.info("ForgeEntryPoint", "onDisable") + info { "#onDisable" } rootModule.lifecycle.onDisable() unregister() } @SubscribeEvent fun onCommandRegister(e: RegisterCommandsEvent) { - rootModule.coreModule.logger.value.info("ForgeEntryPoint", "onCommandRegister") - val commandLoader = CommandLoader(logger = rootModule.coreModule.logger.value) + info { "#onCommandRegister" } + val commandLoader = CommandLoader() commandLoader.registerCommands(e) } diff --git a/forge/src/main/java/ru/astrainteractive/astratemplate/command/CommandLoader.kt b/forge/src/main/java/ru/astrainteractive/astratemplate/command/CommandLoader.kt index 2e3dbff..53da54d 100644 --- a/forge/src/main/java/ru/astrainteractive/astratemplate/command/CommandLoader.kt +++ b/forge/src/main/java/ru/astrainteractive/astratemplate/command/CommandLoader.kt @@ -1,14 +1,15 @@ package ru.astrainteractive.astratemplate.command import net.minecraftforge.event.RegisterCommandsEvent +import ru.astrainteractive.astralibs.logging.JUtiltLogger import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astratemplate.command.core.DefaultCommandRegistry import ru.astrainteractive.astratemplate.command.helloworld.HelloWorldCommand -class CommandLoader(private val logger: Logger) { +class CommandLoader : Logger by JUtiltLogger("CommandLoader") { fun registerCommands(event: RegisterCommandsEvent) { - logger.info("CommandLoader", "registerCommands") + info { "#registerCommands" } val registry = DefaultCommandRegistry(event.dispatcher) registry.register(HelloWorldCommand()) } diff --git a/gradle.properties b/gradle.properties index 1766c45..5acbffd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ makeevrserg.java.ktarget=21 # Project makeevrserg.project.name=AstraTemplate makeevrserg.project.group=ru.astrainteractive.astratemplate -makeevrserg.project.version.string=7.5.0 +makeevrserg.project.version.string=7.5.1 makeevrserg.project.description=Template plugin for EmpireProjekt makeevrserg.project.developers=makeevrserg|Makeev Roman|makeevrserg@gmail.com makeevrserg.project.url=https://github.com/Astra-Interactive/AstraTemplate diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dcb79fa..c4a1573 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] # Kotlin -kotlin-version = "1.9.23" # https://github.com/JetBrains/kotlin +kotlin-version = "2.0.0" # https://github.com/JetBrains/kotlin kotlin-coroutines = "1.8.1" # https://github.com/Kotlin/kotlinx.coroutines -kotlin-json = "1.6.3" # https://github.com/Kotlin/kotlinx.serialization -kotlin-kaml = "0.59.0" # https://github.com/charleskorn/kaml +kotlin-json = "1.7.0" # https://github.com/Kotlin/kotlinx.serialization +kotlin-kaml = "0.60.0" # https://github.com/charleskorn/kaml # Drivers driver-jdbc = "3.46.0.0" # https://github.com/xerial/sqlite-jdbc @@ -18,7 +18,7 @@ minecraft-protocollib = "5.1.0" minecraft-wg = "7.0.7" minecraft-vault = "1.7.1" # https://github.com/MilkBowl/VaultAPI minecraft-coreprotect = "21.2" -minecraft-astralibs = "3.6.0" +minecraft-astralibs = "3.7.0" minecraft-bstats = "3.0.2" minecraft-mockbukkit = "3.88.1" @@ -33,7 +33,7 @@ tests-junit-bom = "5.10.2" minecraft-fabric-loom = "1.6.12" minecraft-fabric-kotlin = "1.11.0+" minecraft-fabric-loader = "0.15.11" -minecraft-fabric-api = "0.99.4+" +minecraft-fabric-api = "0.100.0+" minecraft-fabric-yarn = "1.20.2+build.4" # Shadow @@ -43,7 +43,7 @@ gradle-shadow = "8.1.1" gradle-buildconfig = "5.3.5" # Exposed -exposed = "0.51.0" +exposed = "0.51.1" [bundles] exposed = ["exposed-java-time", "exposed-jdbc", "exposed-dao", "exposed-core"] diff --git a/modules/core/src/main/kotlin/ru/astrainteractive/astratemplate/core/di/CoreModule.kt b/modules/core/src/main/kotlin/ru/astrainteractive/astratemplate/core/di/CoreModule.kt index 4ecc256..10f870e 100644 --- a/modules/core/src/main/kotlin/ru/astrainteractive/astratemplate/core/di/CoreModule.kt +++ b/modules/core/src/main/kotlin/ru/astrainteractive/astratemplate/core/di/CoreModule.kt @@ -3,8 +3,6 @@ package ru.astrainteractive.astratemplate.core.di import kotlinx.serialization.StringFormat import ru.astrainteractive.astralibs.async.AsyncComponent import ru.astrainteractive.astralibs.lifecycle.Lifecycle -import ru.astrainteractive.astralibs.logging.JUtilFileLogger -import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astralibs.serialization.YamlStringFormat import ru.astrainteractive.astratemplate.core.PluginConfiguration import ru.astrainteractive.astratemplate.core.PluginTranslation @@ -19,7 +17,6 @@ interface CoreModule { val lifecycle: Lifecycle val stringFormat: Dependency - val logger: Dependency val pluginScope: Dependency val translation: Dependency val configurationModule: Dependency @@ -30,12 +27,6 @@ interface CoreModule { override val stringFormat: Single = Single { YamlStringFormat() } - override val logger: Dependency = Single { - JUtilFileLogger( - tag = "AstraTemplate", - folder = dataFolder - ) - } override val pluginScope = Single { AsyncComponent.Default() diff --git a/plugin/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt b/plugin/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt index ee49a07..8e92fc0 100644 --- a/plugin/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt +++ b/plugin/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt @@ -3,19 +3,16 @@ package ru.astrainteractive.astratemplate import org.bukkit.event.HandlerList import org.bukkit.plugin.java.JavaPlugin import ru.astrainteractive.astralibs.lifecycle.Lifecycle +import ru.astrainteractive.astralibs.logging.JUtiltLogger +import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astratemplate.di.impl.RootModuleImpl -import ru.astrainteractive.klibs.kdi.Provider -import ru.astrainteractive.klibs.kdi.getValue /** * Initial class for your plugin */ -class AstraTemplate : JavaPlugin() { +class AstraTemplate : JavaPlugin(), Logger by JUtiltLogger("AstraTemplate") { private val rootModule = RootModuleImpl() - private val jLogger by Provider { - rootModule.coreModule.logger.value - } private val lifecycles: List get() = listOf( rootModule.coreModule.lifecycle, @@ -32,9 +29,9 @@ class AstraTemplate : JavaPlugin() { * This method called when server starts or PlugMan load plugin. */ override fun onEnable() { - jLogger.info("Logger enabled", "AstraTemplate") - jLogger.warning("Warn message from logger", "AstraTemplate") - jLogger.error("Error message", "AstraTemplate") + info { "#onEnable Logger enabled" } + warn { "#onEnable Warn message from logger" } + error { "#onEnable Error message" } lifecycles.forEach(Lifecycle::onEnable) } diff --git a/velocity/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt b/velocity/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt index 00621f4..60efc25 100644 --- a/velocity/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt +++ b/velocity/src/main/kotlin/ru/astrainteractive/astratemplate/AstraTemplate.kt @@ -9,15 +9,15 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent import com.velocitypowered.api.plugin.Plugin import com.velocitypowered.api.plugin.annotation.DataDirectory import com.velocitypowered.api.proxy.ProxyServer -import org.slf4j.Logger import ru.astrainteractive.astralibs.lifecycle.Lifecycle +import ru.astrainteractive.astralibs.logging.JUtiltLogger +import ru.astrainteractive.astralibs.logging.Logger import ru.astrainteractive.astratemplate.command.api.VelocityCommandRegistryContext import ru.astrainteractive.astratemplate.command.reload.ReloadCommandRegistry import ru.astrainteractive.astratemplate.di.RootModule import ru.astrainteractive.astratemplate.di.impl.RootModuleImpl -import ru.astrainteractive.klibs.kdi.Provider -import ru.astrainteractive.klibs.kdi.getValue import java.nio.file.Path +import org.slf4j.Logger as Slf4jLogger @Plugin( id = BuildKonfig.id, @@ -31,14 +31,11 @@ import java.nio.file.Path class AstraTemplate @Inject constructor( private val injector: Injector, private val server: ProxyServer, - private val logger: Logger, + private val logger: Slf4jLogger, @DataDirectory private val dataDirectory: Path -) { +) : Logger by JUtiltLogger("AstraTemplate") { private val rootModule: RootModule = RootModuleImpl() - private val jLogger by Provider { - rootModule.coreModule.logger.value - } private val lifecycles: List get() = listOf( rootModule.coreModule.lifecycle, @@ -56,11 +53,8 @@ class AstraTemplate @Inject constructor( this.plugin.initialize(this@AstraTemplate) } - jLogger.info(BuildKonfig.name, "Hello there! I made my first plugin with Velocity.") - jLogger.info( - BuildKonfig.name, - "Here's your configuration: ${rootModule.coreModule.configurationModule.value}." - ) + info { "Hello there! I made my first plugin with Velocity" } + info { "Here's your configuration: ${rootModule.coreModule.configurationModule.value}." } ReloadCommandRegistry( registryContext = VelocityCommandRegistryContext(