mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-04 15:41:36 +00:00
Added unknown skills
This commit is contained in:
@@ -2,17 +2,20 @@ package com.willfp.ecoskills.gui.components
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.eco.core.gui.menu.Menu
|
||||
import com.willfp.eco.core.gui.onLeftClick
|
||||
import com.willfp.eco.core.gui.slot
|
||||
import com.willfp.eco.core.gui.slot.Slot
|
||||
import com.willfp.eco.core.items.Items
|
||||
import com.willfp.eco.core.items.builder.modify
|
||||
import com.willfp.eco.core.sound.PlayableSound
|
||||
import com.willfp.eco.util.toNumeral
|
||||
import com.willfp.ecoskills.api.getSkillLevel
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class SkillIcon(
|
||||
skill: Skill,
|
||||
private val skill: Skill,
|
||||
config: Config,
|
||||
plugin: EcoPlugin
|
||||
) : PositionedComponent {
|
||||
@@ -42,9 +45,27 @@ class SkillIcon(
|
||||
}
|
||||
}
|
||||
|
||||
private val unknownSlot = slot(
|
||||
Items.lookup(plugin.configYml.getString("gui.unknown-skill-icon.icon")).item.clone().modify {
|
||||
setDisplayName(
|
||||
plugin.configYml.getFormattedString("gui.unknown-skill-icon.name")
|
||||
)
|
||||
|
||||
addLoreLines(
|
||||
plugin.configYml.getFormattedStrings("gui.unknown-skill-icon.lore")
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
override val isEnabled = config.getBoolOrNull("enabled") ?: true
|
||||
override val row = config.getInt("position.row")
|
||||
override val column = config.getInt("position.column")
|
||||
|
||||
override fun getSlotAt(row: Int, column: Int) = slot
|
||||
override fun getSlotAt(row: Int, column: Int, player: Player, menu: Menu): Slot {
|
||||
return if (player.getSkillLevel(skill) > 0) {
|
||||
slot
|
||||
} else {
|
||||
unknownSlot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.willfp.ecoskills.actionbar.sendCompatibleActionBarMessage
|
||||
import com.willfp.ecoskills.api.event.PlayerSkillXPGainEvent
|
||||
import com.willfp.ecoskills.api.getFormattedRequiredXP
|
||||
import com.willfp.ecoskills.api.getRequiredXP
|
||||
import com.willfp.ecoskills.api.getSkillLevel
|
||||
import com.willfp.ecoskills.api.getSkillProgress
|
||||
import com.willfp.ecoskills.api.getSkillXP
|
||||
import org.bukkit.boss.BarColor
|
||||
@@ -72,7 +73,10 @@ class GainXPDisplay(
|
||||
}
|
||||
|
||||
private fun String.formatMessage(event: PlayerSkillXPGainEvent): String =
|
||||
this.replace("%skill%", event.skill.name)
|
||||
this.replace(
|
||||
"%skill%",
|
||||
if (event.player.getSkillLevel(event.skill) > 0) event.skill.name else plugin.langYml.getString("learning-skill")
|
||||
)
|
||||
.replace("%current_xp%", event.player.getSkillXP(event.skill).toNiceString())
|
||||
.replace("%required_xp%", event.player.getFormattedRequiredXP(event.skill))
|
||||
.replace("%gained_xp%", event.gainedXP.toNiceString())
|
||||
|
||||
@@ -63,6 +63,13 @@ gui:
|
||||
- "&f"
|
||||
- "&eClick to view Level Progression!"
|
||||
|
||||
unknown-skill-icon:
|
||||
name: "τb00Unknown Skill"
|
||||
icon: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYmFkYzA0OGE3Y2U3OGY3ZGFkNzJhMDdkYTI3ZDg1YzA5MTY4ODFlNTUyMmVlZWQxZTNkYWYyMTdhMzhjMWEifX19
|
||||
lore:
|
||||
- "&7Keep playing to learn about"
|
||||
- "&7and progress this skill!"
|
||||
|
||||
close:
|
||||
item: barrier
|
||||
name: "&cClose"
|
||||
|
||||
@@ -26,6 +26,8 @@ messages:
|
||||
resetting-all-players: "&fResetting all players... (this may take a while)"
|
||||
reset-all-players: "&fReset all players!"
|
||||
|
||||
learning-skill: "Learning New Skill..."
|
||||
|
||||
line-wrap-color: "&8"
|
||||
|
||||
top-line-format: "%rank%. %playername% - %level%"
|
||||
|
||||
Reference in New Issue
Block a user