9
0
mirror of https://github.com/Auxilor/EcoArmor.git synced 2025-12-27 02:49:22 +00:00

Fixed various errors

This commit is contained in:
Auxilor
2021-12-17 13:00:24 +00:00
parent f80df5158d
commit 50986288b0
4 changed files with 15 additions and 14 deletions

View File

@@ -219,9 +219,9 @@ class ArmorSet(
) {
if (slotConfig.getBool("craftable")) {
val formattedOut = out.clone()
val meta = formattedOut.itemMeta!!
assert(meta.lore != null)
val lore = meta.lore.map { it.replace("%tier%", Tiers.defaultTier.displayName) }
val meta = formattedOut.itemMeta ?: return
val metaLore = meta.lore ?: emptyList()
val lore = metaLore.map { it.replace("%tier%", Tiers.defaultTier.displayName) }
meta.lore = lore
formattedOut.itemMeta = meta
Recipes.createAndRegisterRecipe(

View File

@@ -143,8 +143,8 @@ object ArmorUtils {
val meta = itemStack.itemMeta ?: return null
val tier = getTier(meta)
return if (getSetOnItem(meta) != null && tier == null) {
setTier(itemStack, Tiers.getDefaultTier())
Tiers.getDefaultTier()
setTier(itemStack, Tiers.defaultTier)
Tiers.defaultTier
} else {
tier
}
@@ -202,13 +202,13 @@ object ArmorUtils {
tier.id
)
val slot = getSlot(itemStack) ?: return
val armor = tier.properties[slot]!!.armor()
val toughness = tier.properties[slot]!!.toughness()
val knockback = tier.properties[slot]!!.knockback()
val speed = tier.properties[slot]!!.speed()
val attackSpeed = tier.properties[slot]!!.attackSpeed()
val attackDamage = tier.properties[slot]!!.attackDamage()
val attackKnockback = tier.properties[slot]!!.attackKnockback()
val armor = tier.properties[slot]!!.armor
val toughness = tier.properties[slot]!!.toughness
val knockback = tier.properties[slot]!!.knockback
val speed = tier.properties[slot]!!.speed
val attackSpeed = tier.properties[slot]!!.attackSpeed
val attackDamage = tier.properties[slot]!!.attackDamage
val attackKnockback = tier.properties[slot]!!.attackKnockback
meta.removeAttributeModifier(Attribute.GENERIC_ARMOR)
meta.removeAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS)
meta.removeAttributeModifier(Attribute.GENERIC_KNOCKBACK_RESISTANCE)

View File

@@ -30,7 +30,7 @@ class CrystalListener(private val plugin: EcoPlugin) : Listener {
}
val previousTier = ArmorUtils.getTier(current)
var allowed = false
val prereq = crystalTier.requiredTiersForApplication
val prereq = crystalTier.getRequiredTiersForApplication()
if (prereq.isEmpty() || prereq.contains(previousTier)) {
allowed = true
}

View File

@@ -75,7 +75,8 @@ class Tier(
val outMeta = out.itemMeta!!
val container = outMeta.persistentDataContainer
container.set(key, PersistentDataType.STRING, id)
outMeta.displayName = this.config.getString("crystal.name")
@Suppress("UsePropertyAccessSyntax")
outMeta.setDisplayName(this.config.getString("crystal.name"))
val lore: MutableList<String> = ArrayList()
for (loreLine in this.config.getStrings("crystal.lore")) {
lore.add(Display.PREFIX + StringUtils.format(loreLine!!))