9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-02 05:46:57 +00:00

Fixed stat modifiers not workign

This commit is contained in:
Auxilor
2021-10-05 11:07:25 +01:00
parent 125fde12bb
commit b40dbadca4

View File

@@ -18,6 +18,10 @@ private val statKey: NamespacedKey = NamespacedKeyUtils.create("ecoskills", "sta
private val amountKey: NamespacedKey = NamespacedKeyUtils.create("ecoskills", "amount")
private val slotsKey: NamespacedKey = NamespacedKeyUtils.create("ecoskills", "slots")
private fun PersistentDataContainer.applyModifiers(tag: PersistentDataContainer) {
this.set(modifierKey, PersistentDataType.TAG_CONTAINER, tag)
}
private fun getModifiersTag(meta: ItemMeta): PersistentDataContainer {
val container = meta.persistentDataContainer
val context = container.adapterContext
@@ -44,6 +48,8 @@ fun ItemStack.addStatModifier(modifier: ItemStatModifier) {
modifiers.set(modifier.key, PersistentDataType.TAG_CONTAINER, modifierTag)
meta.persistentDataContainer.applyModifiers(modifiers)
this.itemMeta = meta
}
@@ -108,6 +114,8 @@ fun Player.addStatModifier(modifier: StatModifier) {
modifiers.set(modifier.key, PersistentDataType.TAG_CONTAINER, modifierTag)
this.persistentDataContainer.applyModifiers(modifiers)
for (stat in Stats.values()) {
stat.updateStatLevel(this)
}