Skip to content

Commit

Permalink
Merge pull request #17 from Astra-Interactive/dependabot/gradle/versi…
Browse files Browse the repository at this point in the history
…ons-582067dd2e

build(deps): bump the versions group with 15 updates
  • Loading branch information
makeevrserg committed Jun 10, 2024
2 parents ca4e952 + 5c13813 commit 98be355
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 46 deletions.
2 changes: 1 addition & 1 deletion forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,37 @@ 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
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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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())
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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|[email protected]
makeevrserg.project.url=https://github.com/Astra-Interactive/AstraTemplate
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"

Expand All @@ -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
Expand All @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,7 +17,6 @@ interface CoreModule {

val lifecycle: Lifecycle
val stringFormat: Dependency<StringFormat>
val logger: Dependency<Logger>
val pluginScope: Dependency<AsyncComponent>
val translation: Dependency<PluginTranslation>
val configurationModule: Dependency<PluginConfiguration>
Expand All @@ -30,12 +27,6 @@ interface CoreModule {
override val stringFormat: Single<StringFormat> = Single {
YamlStringFormat()
}
override val logger: Dependency<Logger> = Single {
JUtilFileLogger(
tag = "AstraTemplate",
folder = dataFolder
)
}

override val pluginScope = Single {
AsyncComponent.Default()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Lifecycle>
get() = listOf(
rootModule.coreModule.lifecycle,
Expand All @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<Lifecycle>
get() = listOf(
rootModule.coreModule.lifecycle,
Expand All @@ -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(
Expand Down

0 comments on commit 98be355

Please sign in to comment.