mirror of
https://github.com/Auxilor/EcoArmor.git
synced 2025-12-27 02:49:22 +00:00
Added NotNullMap
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.willfp.eco.core.recipe.recipes.ShapedCraftingRecipe
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.ecoarmor.sets.ArmorSlot
|
||||
import com.willfp.ecoarmor.sets.ArmorUtils.getCrystalTier
|
||||
import com.willfp.ecoarmor.util.NotNullMap
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
import java.util.*
|
||||
@@ -56,7 +57,7 @@ class Tier(
|
||||
/**
|
||||
* Item properties.
|
||||
*/
|
||||
val properties: MutableMap<ArmorSlot, TierProperties> = EnumMap(ArmorSlot::class.java)
|
||||
val properties: NotNullMap<ArmorSlot, TierProperties> = NotNullMap(EnumMap(ArmorSlot::class.java))
|
||||
|
||||
/**
|
||||
* Create a new Tier.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.willfp.ecoarmor.util
|
||||
|
||||
class NotNullMap<K, V>(private val handle: MutableMap<K, V>) : MutableMap<K, V> by handle {
|
||||
override fun get(key: K): V {
|
||||
return handle[key]!!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user