Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made player-info toggleable #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
skullBuilder.build().apply {
val meta = itemMeta as SkullMeta
meta.owningPlayer = player
itemMeta = meta
}
}
}
}) {
if (opensStatMenu) {
onLeftClick { player, _, _, _ ->
StatsGUI.open(player)
}) {
if (opensStatMenu) {
onLeftClick { player, _, _, _ ->
StatsGUI.open(player)
}
}
}
} else {
null
}

override val row: Int = config.getInt("row")
Expand Down
1 change: 1 addition & 0 deletions eco-core/core-plugin/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ stats-gui:
- "211101112"

player-info:
enabled: true
row: 1
column: 5

Expand Down