9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2025-12-19 15:09:23 +00:00

Made player-info toggleable

This allows users to turn off the stats page icon in /skills.
This commit is contained in:
Exanthiax
2024-12-01 15:53:31 +00:00
parent 64fd665ace
commit cbb4fd012e
2 changed files with 35 additions and 33 deletions

View File

@@ -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")

View File

@@ -123,6 +123,7 @@ stats-gui:
- "211101112"
player-info:
enabled: true
row: 1
column: 5