diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/components/PlayerInfoIcon.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/components/PlayerInfoIcon.kt index 49b49cf..f93fad5 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/components/PlayerInfoIcon.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/components/PlayerInfoIcon.kt @@ -23,47 +23,48 @@ class PlayerInfoIcon( config: Config, opensStatMenu: Boolean ) : PositionedComponent { - private val slot = slot({ player, _ -> - skullCache.get(player.uniqueId) { - val skullBuilder = SkullBuilder() - .setDisplayName( - config.getString("name") - .replace("%player%", player.savedDisplayName) - .formatEco(player, true) - ) - .addLoreLines( - config.getFormattedStrings( - "lore", - placeholderContext( - player = player + override val isEnabled = config.getBoolOrNull("enabled") ?: true + private val slot = if (isEnabled) { + slot({ player, _ -> + skullCache.get(player.uniqueId) { + val skullBuilder = SkullBuilder() + .setDisplayName( + config.getString("name") + .replace("%player%", player.savedDisplayName) + .formatEco(player, true) + ) + .addLoreLines( + config.getFormattedStrings( + "lore", // Ensure correct path for lore + placeholderContext(player = player) ) ) - ) - .apply { - if (opensStatMenu) { - addLoreLines( - config.getFormattedStrings( - "view-more", - placeholderContext( - player = player + .apply { + if (opensStatMenu) { + addLoreLines( + config.getFormattedStrings( + "view-more", + placeholderContext(player = player) ) ) - ) + } } - } - skullBuilder.build().apply { - val meta = itemMeta as SkullMeta - meta.owningPlayer = player - itemMeta = meta - } - } - }) { - if (opensStatMenu) { - onLeftClick { player, _, _, _ -> - StatsGUI.open(player) + skullBuilder.build().apply { + val meta = itemMeta as SkullMeta + meta.owningPlayer = player + itemMeta = meta + } + } + }) { + if (opensStatMenu) { + onLeftClick { player, _, _, _ -> + StatsGUI.open(player) + } } } + } else { + null } override val row: Int = config.getInt("row") diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 909e110..7c255a4 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -123,6 +123,7 @@ stats-gui: - "211101112" player-info: + enabled: true row: 1 column: 5