fix issue with item default attribute API

This commit is contained in:
Jake Potrebic 2024-04-25 23:10:38 -07:00
parent bcdf1f96b8
commit 43d110e9a9
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
22 changed files with 71 additions and 94 deletions

View file

@ -3,9 +3,10 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 15:02:00 -0700
Subject: [PATCH] Attributes API for item defaults
(Now replaced by upstream's API)
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 7c14a272156cefe6d69e41fec6892891646e0985..0dd2a9c7ea5b56995ff238fd0e5eceacf91c9e6f 100644
index 7c14a272156cefe6d69e41fec6892891646e0985..eb9e0eb1aa6e203ff6f896b177ee60c8afacc62d 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4759,6 +4759,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@ -23,33 +24,10 @@ index 7c14a272156cefe6d69e41fec6892891646e0985..0dd2a9c7ea5b56995ff238fd0e5eceac
+ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)}
+ */
+ @NotNull
+ @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.5")
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
+ return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot);
+ return this.getDefaultAttributeModifiers(equipmentSlot);
+ }
// Paper end
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 057f4db9cb6b686ab941ec5d3e6ca23dcfbd845f..db8ffa9b303b9128be175f383fdf838a4e0719e5 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -197,6 +197,18 @@ public interface UnsafeValues {
*/
public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);
+ /**
+ * Returns an immutable multimap of attributes for the material and slot.
+ * {@link Material#isItem()} must be true for this material.
+ *
+ * @param material the material
+ * @param equipmentSlot the slot to get the attributes for
+ * @throws IllegalArgumentException if {@link Material#isItem()} is false
+ * @return an immutable multimap of attributes
+ */
+ @org.jetbrains.annotations.NotNull
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@org.jetbrains.annotations.NotNull Material material, @org.jetbrains.annotations.NotNull EquipmentSlot equipmentSlot);
+
/**
* Returns the server's protocol version.
*