Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
api(item): Attribute の変更がアイテムに反映されないバグを修正 #61
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed Apr 6, 2021
1 parent 6f36efc commit e960e99
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ repositories {
}
dependencies {
api('com.github.sya-ri:EasySpigotAPI:2.3.0') {
api('com.github.sya-ri:EasySpigotAPI:2.3.1') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
Expand All @@ -279,7 +279,7 @@ repositories {
}

dependencies {
api("com.github.sya-ri:EasySpigotAPI:2.3.0") {
api("com.github.sya-ri:EasySpigotAPI:2.3.1") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
}
Expand All @@ -305,7 +305,7 @@ configurations {
}
dependencies {
shadowApi('com.github.sya-ri:EasySpigotAPI:2.3.0') {
shadowApi('com.github.sya-ri:EasySpigotAPI:2.3.1') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
Expand All @@ -330,7 +330,7 @@ repositories {
}

dependencies {
shadowApi("com.github.sya-ri:EasySpigotAPI:2.3.0") {
shadowApi("com.github.sya-ri:EasySpigotAPI:2.3.1") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

group = "com.github.sya-ri.spigot.api"
version = "2.3.0"
version = "2.3.1"

bukkit {
name = "EasySpigotAPI"
Expand Down
24 changes: 20 additions & 4 deletions api/src/main/kotlin/com/github/syari/spigot/api/item/extension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ fun ItemStack.getAttributeModifiers(attribute: Attribute): Collection<AttributeM
*/
@UnsupportedMinecraftVersion(8, 9, 10, 11, 12)
fun ItemStack.addAttributeModifier(attribute: Attribute, modifier: AttributeModifier): Boolean {
return itemMeta?.addAttributeModifier(attribute, modifier) ?: false
var result = false
editItemMeta {
result = addAttributeModifier(attribute, modifier)
}
return result
}

/**
Expand All @@ -301,7 +305,11 @@ fun ItemStack.addAttributeModifier(attribute: Attribute, modifier: AttributeModi
*/
@UnsupportedMinecraftVersion(8, 9, 10, 11, 12)
fun ItemStack.removeAttributeModifier(attribute: Attribute): Boolean {
return itemMeta?.removeAttributeModifier(attribute) ?: false
var result = false
editItemMeta {
result = removeAttributeModifier(attribute)
}
return result
}

/**
Expand All @@ -313,7 +321,11 @@ fun ItemStack.removeAttributeModifier(attribute: Attribute): Boolean {
*/
@UnsupportedMinecraftVersion(8, 9, 10, 11, 12)
fun ItemStack.removeAttributeModifier(slot: EquipmentSlot): Boolean {
return itemMeta?.removeAttributeModifier(slot) ?: false
var result = false
editItemMeta {
result = removeAttributeModifier(slot)
}
return result
}

/**
Expand All @@ -325,7 +337,11 @@ fun ItemStack.removeAttributeModifier(slot: EquipmentSlot): Boolean {
*/
@UnsupportedMinecraftVersion(8, 9, 10, 11, 12)
fun ItemStack.removeAttributeModifier(attribute: Attribute, modifier: AttributeModifier): Boolean {
return itemMeta?.removeAttributeModifier(attribute, modifier) ?: false
var result = false
editItemMeta {
result = removeAttributeModifier(attribute, modifier)
}
return result
}

/**
Expand Down

0 comments on commit e960e99

Please sign in to comment.