From f2426a72c54106b6f5ae50029aa651e62a89ab9f Mon Sep 17 00:00:00 2001 From: beanbag44 <107891830+beanbag44@users.noreply.github.com> Date: Sat, 13 Dec 2025 21:15:19 +0000 Subject: [PATCH 1/2] manager debug logs setting and checks --- src/main/kotlin/com/lambda/config/AutomationConfig.kt | 3 ++- .../interaction/managers/breaking/BrokenBlockHandler.kt | 9 +++++---- .../managers/interacting/InteractedBlockHandler.kt | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/lambda/config/AutomationConfig.kt b/src/main/kotlin/com/lambda/config/AutomationConfig.kt index b872eae37..56e986838 100644 --- a/src/main/kotlin/com/lambda/config/AutomationConfig.kt +++ b/src/main/kotlin/com/lambda/config/AutomationConfig.kt @@ -62,7 +62,7 @@ open class AutomationConfig( name: String = module.name, edits: (AutomationConfig.() -> Unit)? = null ) { - defaultAutomationConfig = AutomationConfig("$name Automation Config").apply { edits?.invoke(this) } + this.defaultAutomationConfig = AutomationConfig("$name Automation Config").apply { edits?.invoke(this) } } fun MutableAutomationConfig.setDefaultAutomationConfig( @@ -79,6 +79,7 @@ open class AutomationConfig( val showAllEntries by setting("Show All Entries", false, "Show all entries in the task tree").group(Group.Debug) val shrinkFactor by setting("Shrink Factor", 0.001, 0.0..1.0, 0.001).group(Group.Debug) val ignoreItemDropWarnings by setting("Ignore Drop Warnings", false, "Hides the item drop warnings from the break manager").group(Group.Debug) + val managerDebugLogs by setting("Manager Debug Logs", false, "Prints debug logs from managers into chat").group(Group.Debug) @Volatile var drawables = listOf() diff --git a/src/main/kotlin/com/lambda/interaction/managers/breaking/BrokenBlockHandler.kt b/src/main/kotlin/com/lambda/interaction/managers/breaking/BrokenBlockHandler.kt index 8cabe0594..5188dcfee 100644 --- a/src/main/kotlin/com/lambda/interaction/managers/breaking/BrokenBlockHandler.kt +++ b/src/main/kotlin/com/lambda/interaction/managers/breaking/BrokenBlockHandler.kt @@ -18,6 +18,7 @@ package com.lambda.interaction.managers.breaking import com.lambda.config.AutomationConfig.Companion.DEFAULT +import com.lambda.config.AutomationConfig.Companion.DEFAULT.managerDebugLogs import com.lambda.context.SafeContext import com.lambda.event.events.EntityEvent import com.lambda.event.events.WorldEvent @@ -60,11 +61,11 @@ object BrokenBlockHandler : PostActionHandler() { if (!info.broken) { val message = "${info.type} ${info::class.simpleName} at ${info.context.blockPos.toShortString()} timed out with cached state ${info.context.cachedState}" BreakManager.logger.error(message) - warn(message) + if (managerDebugLogs) this@BrokenBlockHandler.warn(message) } else if (!DEFAULT.ignoreItemDropWarnings) { val message = "${info.type} ${info::class.simpleName}'s item drop at ${info.context.blockPos.toShortString()} timed out" - BreakManager.logger.warn(message) - warn(message) + BreakManager.logger.warning(message) + if (managerDebugLogs) this@BrokenBlockHandler.warn(message) } if (!info.broken && info.breakConfig.breakConfirmation != BreakConfirmationMode.AwaitThenBreak) { @@ -97,7 +98,7 @@ object BrokenBlockHandler : PostActionHandler() { } else { val message = "Broken block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.cachedState.emptyState}" BreakManager.logger.error(message) - this@BrokenBlockHandler.warn(message) + if (managerDebugLogs) this@BrokenBlockHandler.warn(message) pending.stopPending() } return@listen diff --git a/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt b/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt index c28dbe213..9d9261abb 100644 --- a/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt +++ b/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt @@ -18,6 +18,7 @@ package com.lambda.interaction.managers.interacting import com.lambda.config.AutomationConfig.Companion.DEFAULT +import com.lambda.config.AutomationConfig.Companion.DEFAULT.managerDebugLogs import com.lambda.event.events.WorldEvent import com.lambda.event.listener.SafeListener.Companion.listen import com.lambda.interaction.construction.simulation.processing.ProcessorRegistry @@ -60,7 +61,7 @@ object InteractedBlockHandler : PostActionHandler() { pending.stopPending() - this@InteractedBlockHandler.warn("Placed block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.expectedState}") + if (managerDebugLogs) this@InteractedBlockHandler.warn("Placed block at ${event.pos.toShortString()} was rejected with ${event.newState} instead of ${pending.context.expectedState}") return@listen } From 8c814c0fd0f1aa8009173c7ed3ad1628db93e572 Mon Sep 17 00:00:00 2001 From: beanbag44 <107891830+beanbag44@users.noreply.github.com> Date: Sat, 13 Dec 2025 21:28:00 +0000 Subject: [PATCH 2/2] warn and check before logging --- .../interaction/managers/interacting/InteractedBlockHandler.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt b/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt index 9d9261abb..b6f90c09d 100644 --- a/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt +++ b/src/main/kotlin/com/lambda/interaction/managers/interacting/InteractedBlockHandler.kt @@ -26,7 +26,6 @@ import com.lambda.interaction.managers.PostActionHandler import com.lambda.interaction.managers.interacting.InteractManager.placeSound import com.lambda.threading.runSafe import com.lambda.util.BlockUtils.matches -import com.lambda.util.Communication.info import com.lambda.util.Communication.warn import com.lambda.util.collections.LimitedDecayQueue @@ -35,7 +34,7 @@ object InteractedBlockHandler : PostActionHandler() { DEFAULT.buildConfig.maxPendingActions, DEFAULT.buildConfig.actionTimeout * 50L ) { - info("${it::class.simpleName} at ${it.context.blockPos.toShortString()} timed out") + if (managerDebugLogs) warn("${it::class.simpleName} at ${it.context.blockPos.toShortString()} timed out") if (it.interactConfig.interactConfirmationMode != InteractConfig.InteractConfirmationMode.AwaitThenPlace) { runSafe { world.setBlockState(it.context.blockPos, it.context.cachedState)