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

Merge pull request #168 from Exanthiax/player-info-toggle

Made player-info toggleable
This commit is contained in:
Will FP
2025-01-31 11:46:12 +00:00
committed by GitHub
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