diff --git a/src/main/kotlin/com/lambda/config/AutomationConfig.kt b/src/main/kotlin/com/lambda/config/AutomationConfig.kt index d0f402dc0..56e986838 100644 --- a/src/main/kotlin/com/lambda/config/AutomationConfig.kt +++ b/src/main/kotlin/com/lambda/config/AutomationConfig.kt @@ -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..b6f90c09d 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 @@ -25,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 @@ -34,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) @@ -60,7 +60,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 }