Skip to content

Commit

Permalink
Fix: Log level not updated on reload
Browse files Browse the repository at this point in the history
Chore: Move PaperWriter out to idofront and use its new logging feature
Bump: Idofront, geary
Bump: Update workflow to try new publish action
  • Loading branch information
0ffz committed Mar 15, 2024
1 parent 9a6471d commit 1fe1247
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 69 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: MineInAbyss/publish-action@master
- uses: MineInAbyss/publish-action@develop
with:
maven-metadata-url: https://repo.mineinabyss.com/releases/com/mineinabyss/geary-papermc-core/maven-metadata.xml
maven-snapshot-metadata-url: https://repo.mineinabyss.com/snapshots/com/mineinabyss/geary-papermc-core/maven-metadata.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.mineinabyss.geary.papermc.bridge.events.items.ItemInteractBridge
import com.mineinabyss.geary.papermc.bridge.mythicmobs.createRunMMSkillAction
import com.mineinabyss.geary.papermc.bridge.readers.createLocationReader
import com.mineinabyss.geary.papermc.bridge.readers.createTargetBlockReader
import com.mineinabyss.geary.papermc.bridge.systems.createCooldownDisplaySystem
import com.mineinabyss.geary.papermc.bridge.targetselectors.createNearbyEntitiesSelector
import com.mineinabyss.geary.papermc.gearyPaper
import com.mineinabyss.geary.papermc.tracking.items.components.SetItem
Expand Down Expand Up @@ -66,6 +67,8 @@ class PaperBridge {
createLocationReader()
createNearbyEntitiesSelector()

createCooldownDisplaySystem()

geary.pipeline.runOnOrAfter(GearyPhase.ENABLE) {
DI.getOrNull<GearyPaperConfigModule>() ?: return@runOnOrAfter
gearyPaper.plugin.listeners(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.mineinabyss.geary.papermc.plugin

import co.touchlab.kermit.Logger
import co.touchlab.kermit.StaticConfig
import com.mineinabyss.geary.datatypes.maps.SynchronizedTypeMap
import com.mineinabyss.geary.datatypes.maps.TypeMap
import com.mineinabyss.geary.engine.archetypes.ArchetypeEngine
Expand All @@ -11,23 +9,30 @@ import com.mineinabyss.geary.engine.archetypes.operations.ArchetypeMutateOperati
import com.mineinabyss.geary.engine.archetypes.operations.ArchetypeReadOperations
import com.mineinabyss.geary.modules.ArchetypeEngineModule
import com.mineinabyss.geary.modules.GearyModuleProvider
import com.mineinabyss.geary.modules.geary
import com.mineinabyss.geary.papermc.CatchType
import com.mineinabyss.geary.papermc.Catching.Companion.asyncCheck
import com.mineinabyss.geary.papermc.GearyPaperConfig
import com.mineinabyss.geary.papermc.GearyPlugin
import com.mineinabyss.geary.papermc.gearyPaper
import com.mineinabyss.idofront.di.DI
import com.mineinabyss.idofront.messaging.ComponentLogger
import com.mineinabyss.idofront.messaging.injectLogger
import com.mineinabyss.idofront.time.ticks
import io.papermc.paper.util.TickThread
import org.spigotmc.AsyncCatcher

class ConfigBased(
config: GearyPaperConfig,
plugin: GearyPlugin,
) {
val logger = ComponentLogger.forPlugin(plugin, minSeverity = config.logLevel)
}

class PaperEngineModule(
val plugin: GearyPlugin
) :
ArchetypeEngineModule(tickDuration = 1.ticks) {
) : ArchetypeEngineModule(tickDuration = 1.ticks) {
private var configBased = updateToMatch(gearyPaper.config)

override val engine: ArchetypeEngine = PaperMCEngine()
override val logger =
Logger(StaticConfig(logWriterList = listOf(PaperWriter(plugin)), minSeverity = gearyPaper.config.logLevel))
override val logger get() = configBased.logger

override val entityProvider: EntityByArchetypeProvider
get() {
asyncCheck(gearyPaper.config.catch.asyncWrite, "Async entityProvider access!")
Expand Down Expand Up @@ -59,6 +64,12 @@ class PaperEngineModule(
return super.archetypeProvider
}

fun updateToMatch(config: GearyPaperConfig): ConfigBased {
val configBased = ConfigBased(config, plugin)
plugin.injectLogger(logger)
return configBased
}

companion object : GearyModuleProvider<PaperEngineModule> {
override fun start(module: PaperEngineModule) {
DI.add<PaperEngineModule>(module)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
package com.mineinabyss.geary.papermc.plugin.commands

import com.mineinabyss.geary.components.relations.InstanceOf
import com.mineinabyss.geary.datatypes.family.family
import com.mineinabyss.geary.helpers.entity
import com.mineinabyss.geary.helpers.parent
import com.mineinabyss.geary.modules.archetypes
import com.mineinabyss.geary.modules.geary
import com.mineinabyss.geary.papermc.gearyPaper
import com.mineinabyss.geary.papermc.tracking.entities.gearyMobs
import com.mineinabyss.geary.papermc.tracking.entities.helpers.GearyMobPrefabQuery.Companion.getKeyStrings
import com.mineinabyss.geary.papermc.tracking.entities.helpers.GearyMobPrefabQuery.Companion.getKeys
import com.mineinabyss.geary.papermc.tracking.entities.helpers.spawnFromPrefab
import com.mineinabyss.geary.papermc.tracking.entities.systems.updatemobtype.UpdateMob
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.items.cache.PlayerItemCache
import com.mineinabyss.geary.papermc.tracking.items.gearyItems
import com.mineinabyss.geary.papermc.tracking.items.helpers.GearyItemPrefabQuery.Companion.getKeys
import com.mineinabyss.geary.papermc.tracking.items.inventory.toGeary
import com.mineinabyss.geary.prefabs.PrefabKey
import com.mineinabyss.geary.prefabs.helpers.inheritPrefabs
import com.mineinabyss.geary.prefabs.prefabs
import com.mineinabyss.idofront.commands.arguments.intArg
import com.mineinabyss.idofront.commands.arguments.optionArg
import com.mineinabyss.idofront.commands.arguments.stringArg
import com.mineinabyss.idofront.commands.execution.IdofrontCommandExecutor
import com.mineinabyss.idofront.commands.extensions.actions.playerAction
import com.mineinabyss.idofront.messaging.error
import com.mineinabyss.idofront.messaging.info
import com.mineinabyss.idofront.messaging.success
import com.mineinabyss.idofront.typealiases.BukkitEntity
import okio.Path.Companion.toOkioPath
import org.bukkit.Bukkit
import org.bukkit.command.CommandSender
import org.bukkit.command.TabCompleter
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import org.bukkit.plugin.Plugin
import kotlin.io.path.Path
import kotlin.io.path.nameWithoutExtension

internal class GearyCommands : IdofrontCommandExecutor(), TabCompleter {
private val plugin get() = gearyPaper.plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package com.mineinabyss.geary.papermc.plugin.commands

import com.mineinabyss.geary.papermc.gearyPaper
import com.mineinabyss.geary.papermc.plugin.PaperEngineModule
import com.mineinabyss.geary.prefabs.prefabs
import com.mineinabyss.idofront.commands.Command
import com.mineinabyss.idofront.di.DI

private val prefabLoader get() = prefabs.loader

fun Command.reload() {
"reload" {
action {
gearyPaper.configHolder.reload()
DI.get<PaperEngineModule>().updateToMatch(gearyPaper.config)
prefabLoader.loadOrUpdatePrefabs()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.mineinabyss.geary.components.relations.InstanceOf
import com.mineinabyss.geary.datatypes.GearyEntity
import com.mineinabyss.geary.helpers.toGeary
import com.mineinabyss.geary.papermc.gearyPaper
import com.mineinabyss.geary.papermc.tracking.entities.gearyMobs
import com.mineinabyss.geary.papermc.tracking.entities.helpers.GearyMobPrefabQuery
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin.code.style=official
group=com.mineinabyss
version=0.29
idofrontVersion=0.22.3
gearyVersion=0.26.0-dev.2
idofrontVersion=0.23.0-dev.0
gearyVersion=0.26.0-dev.3

0 comments on commit 1fe1247

Please sign in to comment.