From 09758e73880131e3ffdb592c2466a163ac860e58 Mon Sep 17 00:00:00 2001 From: cao-awa Date: Tue, 17 Dec 2024 05:40:51 +0800 Subject: [PATCH] Logging changes in IndexD. --- src/main/java/com/github/cao/awa/conium/bedrock/IndexD.kt | 7 ++++--- .../github/cao/awa/conium/bedrock/server/ServerIndexD.kt | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/cao/awa/conium/bedrock/IndexD.kt b/src/main/java/com/github/cao/awa/conium/bedrock/IndexD.kt index 2a859c2..272bcc9 100644 --- a/src/main/java/com/github/cao/awa/conium/bedrock/IndexD.kt +++ b/src/main/java/com/github/cao/awa/conium/bedrock/IndexD.kt @@ -16,12 +16,13 @@ abstract class IndexD { @JvmStatic fun tryImport(packageName: String, refs: Collection, action: Consumer) { - packages[packageName]?.also { indexD: IndexD -> + val indexD: IndexD? = packages[packageName] + if (indexD != null) { refs.distinct().forEach { ref: String -> indexD.forName(ref, action) } - } ?: { - LOGGER.warn("The package '{}' are not found in conium IndexD", packageName) + } else { + LOGGER.warn("The package '{}' are not found in conium IndexD, ignored", packageName) } } } diff --git a/src/main/java/com/github/cao/awa/conium/bedrock/server/ServerIndexD.kt b/src/main/java/com/github/cao/awa/conium/bedrock/server/ServerIndexD.kt index efb02ab..84b819e 100644 --- a/src/main/java/com/github/cao/awa/conium/bedrock/server/ServerIndexD.kt +++ b/src/main/java/com/github/cao/awa/conium/bedrock/server/ServerIndexD.kt @@ -17,10 +17,11 @@ class ServerIndexD : IndexD() { } override fun forName(refName: String, action: Consumer) { - mappings[refName]?.also { ref: String -> + val ref: String? = mappings[refName] + if (ref != null) { action.accept(ref) - } ?: { - LOGGER.warn("The reference name '{}' are not found in conium ServerIndexD(@minecraft/server)", refName) + } else { + LOGGER.warn("The reference name '{}' are not found in conium ServerIndexD(@minecraft/server), ignored", refName) } } }