diff --git a/dist/src/main/kotlin/kr/toxicity/hud/BetterHudImpl.kt b/dist/src/main/kotlin/kr/toxicity/hud/BetterHudImpl.kt index 6f763a97..ed8893b1 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/BetterHudImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/BetterHudImpl.kt @@ -252,8 +252,10 @@ class BetterHudImpl: BetterHud() { } managerReload() }.onFailure { e -> - warn("Unable to reload.") - warn("Reason: ${e.message}") + warn( + "Unable to reload.", + "Reason: ${e.message}" + ) onReload = false consumer.accept(ReloadResult(ReloadState.FAIL, System.currentTimeMillis() - time)) } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/BackgroundManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/BackgroundManager.kt index 3c5e5af4..e5dc4449 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/BackgroundManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/BackgroundManager.kt @@ -54,8 +54,10 @@ object BackgroundManager: BetterHudManager { ) } }.onFailure { e -> - warn("Unable to load this yml: ${it.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this yml: ${it.name}", + "Reason: ${e.message}" + ) } } }, callback) diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/CompatibilityManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/CompatibilityManager.kt index 43142aef..de439351 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/CompatibilityManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/CompatibilityManager.kt @@ -64,8 +64,10 @@ object CompatibilityManager: BetterHudManager { PLUGIN.triggerManager.addTrigger("${namespace}_${entry.key}", entry.value) } }.onFailure { e -> - warn("Unable to load ${it.key} support.") - warn("Reason: ${e.message}") + warn( + "Unable to load ${it.key} support.", + "Reason: ${e.message}" + ) } } } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/ConfigManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/ConfigManager.kt index 5e0d090d..c00f7e87 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/ConfigManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/ConfigManager.kt @@ -80,8 +80,10 @@ object ConfigManager: BetterHudManager { mergeOtherFolders = yaml.getStringList("merge-other-folders") selfHostPort = yaml.getInt("self-host-port", 8163) }.onFailure { e -> - warn("Unable to load config.yml") - warn("Reason: ${e.message}") + warn( + "Unable to load config.yml", + "Reason: ${e.message}" + ) } } override fun end() { diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/DatabaseManagerImpl.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/DatabaseManagerImpl.kt index 5ae48356..b1aa0a75 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/DatabaseManagerImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/DatabaseManagerImpl.kt @@ -158,8 +158,10 @@ object DatabaseManagerImpl: BetterHudManager, DatabaseManager { current = connectionMap[type].ifNull("this database doesn't exist: $type").connect(info) }.onFailure { e -> current = defaultConnector.connect(MemoryConfiguration()) - warn("Unable to connect the database.") - warn("Reason: ${e.message}") + warn( + "Unable to connect the database.", + "Reason: ${e.message}" + ) } callback() } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/HudManagerImpl.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/HudManagerImpl.kt index 2d0f3ad5..fcd42f43 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/HudManagerImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/HudManagerImpl.kt @@ -28,8 +28,10 @@ object HudManagerImpl: BetterHudManager, HudManager { HudImpl(file.path, s, hudFolder, configurationSection) } }.onFailure { e -> - warn("Unable to load this hud: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this hud: $s in ${file.name}", + "Reason: ${e.message}" + ) } }, callback) } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/ImageManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/ImageManager.kt index 655f87bd..d06eb931 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/ImageManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/ImageManager.kt @@ -86,8 +86,10 @@ object ImageManager: BetterHudManager { image } }.onFailure { e -> - warn("Unable to load this image: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this image: $s in ${file.name}", + "Reason: ${e.message}" + ) } }) { val saveLocation = ArrayList(resource.textures).apply { diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/LayoutManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/LayoutManager.kt index 32534c19..6fd807c6 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/LayoutManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/LayoutManager.kt @@ -27,8 +27,10 @@ object LayoutManager: BetterHudManager { LayoutGroup(file.path, configurationSection) } }.onFailure { e -> - warn("Unable to load this layout: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this layout: $s in ${file.name}", + "Reason: ${e.message}" + ) } }, callback) } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/ModuleManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/ModuleManager.kt index 95a90e99..679e71a4 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/ModuleManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/ModuleManager.kt @@ -32,8 +32,10 @@ object ModuleManager: BetterHudManager { PlaceholderManagerImpl.booleanContainer.addPlaceholder("${module.key}_${boolean.key}", boolean.value) } }.onFailure { e -> - warn("Unable to load this module: ${module.key}") - warn("Reason: ${e.message}") + warn( + "Unable to load this module: ${module.key}", + "Reason: ${e.message}" + ) } } } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/PlaceholderManagerImpl.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/PlaceholderManagerImpl.kt index 0fcb5a3d..7ffbcc5d 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/PlaceholderManagerImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/PlaceholderManagerImpl.kt @@ -431,8 +431,10 @@ object PlaceholderManagerImpl: PlaceholderManager, BetterHudManager { } }) }.onFailure { e -> - warn("Unable to read this placeholder task: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to read this placeholder task: $s in ${file.name}", + "Reason: ${e.message}" + ) } } } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/PlayerHeadManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/PlayerHeadManager.kt index 67d71457..1c304592 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/PlayerHeadManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/PlayerHeadManager.kt @@ -63,8 +63,10 @@ object PlayerHeadManager: BetterHudManager { head } }.onFailure { e -> - warn("Unable to load this head: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this head: $s in ${file.name}", + "Reason: ${e.message}" + ) } }, callback) } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/PopupManagerImpl.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/PopupManagerImpl.kt index 85d4a895..f606c86c 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/PopupManagerImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/PopupManagerImpl.kt @@ -26,8 +26,10 @@ object PopupManagerImpl: BetterHudManager, PopupManager { PopupImpl(file.path, save, s, configurationSection) } }.onFailure { e -> - warn("Unable to load this popup: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this popup: $s in ${file.name}", + "Reason: ${e.message}" + ) } }, callback) } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/ShaderManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/ShaderManager.kt index 190331ca..f57d9bab 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/ShaderManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/ShaderManager.kt @@ -204,8 +204,10 @@ object ShaderManager: BetterHudManager { } hudShaders.clear() }.onFailure { e -> - warn("Unable to load shader.yml") - warn("Reason: ${e.message}") + warn( + "Unable to load shader.yml", + "Reason: ${e.message}" + ) } } callback() diff --git a/dist/src/main/kotlin/kr/toxicity/hud/manager/TextManager.kt b/dist/src/main/kotlin/kr/toxicity/hud/manager/TextManager.kt index 5a27d1ff..2bdd137e 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/manager/TextManager.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/manager/TextManager.kt @@ -86,8 +86,10 @@ object TextManager: BetterHudManager { }, section.toConditions(), section.getBoolean("merge-default-bitmap")) } }.onFailure { e -> - warn("Unable to load this text: $s in ${file.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this text: $s in ${file.name}", + "Reason: ${e.message}" + ) } }) { val defaultArray = JsonArray().apply { @@ -158,8 +160,10 @@ object TextManager: BetterHudManager { return } }.getOrElse { e -> - warn("Unable to load this image: $imageName") - warn("Reason: ${e.message}") + warn( + "Unable to load this image: $imageName", + "Reason: ${e.message}" + ) return } val array = obj.getAsJsonArray("chars") @@ -174,8 +178,10 @@ object TextManager: BetterHudManager { } } }.onFailure { e -> - warn("Unable to parse minecraft_default.json") - warn("Reason: ${e.message}") + warn( + "Unable to parse minecraft_default.json", + "Reason: ${e.message}" + ) } } } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/pack/PackGenerator.kt b/dist/src/main/kotlin/kr/toxicity/hud/pack/PackGenerator.kt index d220b02c..3c2c27f7 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/pack/PackGenerator.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/pack/PackGenerator.kt @@ -193,22 +193,28 @@ object PackGenerator { runCatching { saveTask(t) }.onFailure { e -> - warn("Unable to save this file: ${t.path}") - warn("Reason: ${e.message}") + warn( + "Unable to save this file: ${t.path}", + "Reason: ${e.message}" + ) } }) { runCatching { saveTask.close() }.onFailure { e -> - warn("Unable to finalized resource pack build.") - warn("Reason: ${e.message}") + warn( + "Unable to finalized resource pack build.", + "Reason: ${e.message}" + ) } callback() tasks.clear() } }.onFailure { e -> - warn("Unable to make a resource pack.") - warn("Reason: ${e.message}") + warn( + "Unable to make a resource pack.", + "Reason: ${e.message}" + ) callback() tasks.clear() } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/placeholder/Conditions.kt b/dist/src/main/kotlin/kr/toxicity/hud/placeholder/Conditions.kt index 6ee65ebc..65b5c871 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/placeholder/Conditions.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/placeholder/Conditions.kt @@ -22,8 +22,10 @@ object Conditions { } } }.onFailure { e -> - warn("Unable to load this condition: $s") - warn("Reason: ${e.message}") + warn( + "Unable to load this condition: $s", + "Reason: ${e.message}" + ) } } return value diff --git a/dist/src/main/kotlin/kr/toxicity/hud/player/HudPlayerHeadImpl.kt b/dist/src/main/kotlin/kr/toxicity/hud/player/HudPlayerHeadImpl.kt index d7b9b696..44e158ef 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/player/HudPlayerHeadImpl.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/player/HudPlayerHeadImpl.kt @@ -3,7 +3,6 @@ package kr.toxicity.hud.player import com.google.gson.JsonParser import kr.toxicity.hud.api.player.HudPlayerHead import kr.toxicity.hud.manager.PlayerHeadManager -import kr.toxicity.hud.util.textures import kr.toxicity.hud.util.toImage import kr.toxicity.hud.util.warn import net.kyori.adventure.text.format.NamedTextColor @@ -45,8 +44,10 @@ class HudPlayerHeadImpl(player: Player): HudPlayerHead { } } }.getOrElse { e -> - warn("Unable to get ${player.name}'s head.") - warn("Reason: ${e.message}") + warn( + "Unable to get ${player.name}'s head.", + "Reason: ${e.message}" + ) allBlack } override fun getColors(): List = colorList diff --git a/dist/src/main/kotlin/kr/toxicity/hud/util/Files.kt b/dist/src/main/kotlin/kr/toxicity/hud/util/Files.kt index 4204fc5d..2511eec7 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/util/Files.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/util/Files.kt @@ -41,8 +41,10 @@ fun File.forEachAllYaml(block: (File, String, ConfigurationSection) -> Unit) { block(it, s, configurationSection) } }.onFailure { e -> - warn("Unable to load this yml file: ${it.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this yml file: ${it.name}", + "Reason: ${e.message}" + ) } } } @@ -70,8 +72,10 @@ fun File.forEachAllYamlAsync(block: (File, String, ConfigurationSection) -> Unit } if (list.isNotEmpty()) it to list else null }.getOrElse { e -> - warn("Unable to load this yml file: ${it.name}") - warn("Reason: ${e.message}") + warn( + "Unable to load this yml file: ${it.name}", + "Reason: ${e.message}" + ) null } } diff --git a/dist/src/main/kotlin/kr/toxicity/hud/util/Plugins.kt b/dist/src/main/kotlin/kr/toxicity/hud/util/Plugins.kt index 81fcf30f..539df7eb 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/util/Plugins.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/util/Plugins.kt @@ -14,8 +14,22 @@ val DATA_FOLDER val VERSION = PLUGIN.nms.version -fun info(message: String) = PLUGIN.logger.info(message) -fun warn(message: String) = PLUGIN.logger.warning(message) +fun info(vararg message: String) { + val logger = PLUGIN.logger + synchronized(logger) { + message.forEach { + logger.info(it) + } + } +} +fun warn(vararg message: String) { + val logger = PLUGIN.logger + synchronized(logger) { + message.forEach { + logger.warning(it) + } + } +} fun task(block: () -> Unit) = PLUGIN.scheduler.task(PLUGIN, block) fun taskLater(delay: Long, block: () -> Unit) = PLUGIN.scheduler.taskLater(PLUGIN, delay, block)