Fix a few issues with ItemMeta (#10740)
This commit is contained in:
parent
4fd3ac00b4
commit
535dca56c2
15 changed files with 937 additions and 125 deletions
|
@ -1498,6 +1498,45 @@ index e7d905b1146b2bdd2da5bdeb6bf3541fb181d59e..c7d3041221742f6655155f19ef2addca
|
|||
*/
|
||||
void setBlockState(@NotNull BlockState blockState);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/CrossbowMeta.java b/src/main/java/org/bukkit/inventory/meta/CrossbowMeta.java
|
||||
index 35c6594fd1040a1af1029e7260e5e3a9307b107d..d58719ee75bef8bc265bfc81bc5d88a426e01dd9 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/CrossbowMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/CrossbowMeta.java
|
||||
@@ -28,8 +28,7 @@ public interface CrossbowMeta extends ItemMeta {
|
||||
* Removes all projectiles when given null.
|
||||
*
|
||||
* @param projectiles the projectiles to set
|
||||
- * @throws IllegalArgumentException if one of the projectiles is not an
|
||||
- * arrow or firework rocket
|
||||
+ * @throws IllegalArgumentException if one of the projectiles is empty
|
||||
*/
|
||||
void setChargedProjectiles(@Nullable List<ItemStack> projectiles);
|
||||
|
||||
@@ -37,8 +36,7 @@ public interface CrossbowMeta extends ItemMeta {
|
||||
* Adds a charged projectile to this item.
|
||||
*
|
||||
* @param item projectile
|
||||
- * @throws IllegalArgumentException if the projectile is not an arrow or
|
||||
- * firework rocket
|
||||
+ * @throws IllegalArgumentException if the projectile is empty
|
||||
*/
|
||||
void addChargedProjectile(@NotNull ItemStack item);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java
|
||||
index cdbcc8dbab2456cc2bc1f3084cbb1ced1698b7f5..d528b066c2aaa3fb097931914ff2181f8f64e520 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java
|
||||
@@ -86,8 +86,8 @@ public interface FireworkMeta extends ItemMeta {
|
||||
* Sets the approximate power of the firework. Each level of power is half
|
||||
* a second of flight time.
|
||||
*
|
||||
- * @param power the power of the firework, from 0-127
|
||||
- * @throws IllegalArgumentException if {@literal height<0 or height>127}
|
||||
+ * @param power the power of the firework, from 0-255
|
||||
+ * @throws IllegalArgumentException if {@literal power < 0 or power > 255}
|
||||
*/
|
||||
void setPower(int power) throws IllegalArgumentException;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index a23d030d2204098be17d8b18021fd0bb79b4431b..f427334c6e875a13aa53052ac1b5a746186b4ffe 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
|
@ -1512,20 +1551,54 @@ index a23d030d2204098be17d8b18021fd0bb79b4431b..f427334c6e875a13aa53052ac1b5a746
|
|||
* AttributeModifiers without a slot are active in any slot.<br>
|
||||
* If there are no attributes set for the given slot, an empty map
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
index c1676991c3cc5f8d6e3f97d8cb356d6e2aa52809..7f9eabcaa4d803ee524a9cc8717379fe6a93a5af 100644
|
||||
index c1676991c3cc5f8d6e3f97d8cb356d6e2aa52809..1d61cc4ab36413fe3c1ecdf9824a5e18cb4bc148 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
@@ -8,8 +8,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -8,8 +8,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents leather armor ({@link Material#LEATHER_BOOTS}, {@link
|
||||
- * Material#LEATHER_CHESTPLATE}, {@link Material#LEATHER_HELMET}, or {@link
|
||||
- * Material#LEATHER_LEGGINGS}) that can be colored.
|
||||
+ * Material#LEATHER_LEGGINGS}, {@link Material#LEATHER_CHESTPLATE}, {@link
|
||||
+ * Material#LEATHER_HELMET}, or {@link Material#LEATHER_HORSE_ARMOR}) that can be colored.
|
||||
+ * Material#LEATHER_HELMET}, {@link Material#LEATHER_HORSE_ARMOR}, {@link
|
||||
+ * Material#WOLF_ARMOR}) that can be colored.
|
||||
*/
|
||||
public interface LeatherArmorMeta extends ItemMeta {
|
||||
|
||||
@@ -18,6 +19,9 @@ public interface LeatherArmorMeta extends ItemMeta {
|
||||
* be {@link ItemFactory#getDefaultLeatherColor()}.
|
||||
*
|
||||
* @return the color of the armor, never null
|
||||
+ * @apiNote The method yielding {@link ItemFactory#getDefaultLeatherColor()} is incorrect
|
||||
+ * for {@link Material#WOLF_ARMOR} as its default color differs. Generally, it is recommended to check
|
||||
+ * {@link #isDyed()} to determined if this leather armor is dyed than to compare this colour to the default.
|
||||
*/
|
||||
@NotNull
|
||||
Color getColor();
|
||||
@@ -25,8 +29,7 @@ public interface LeatherArmorMeta extends ItemMeta {
|
||||
/**
|
||||
* Sets the color of the armor.
|
||||
*
|
||||
- * @param color the color to set. Setting it to null is equivalent to
|
||||
- * setting it to {@link ItemFactory#getDefaultLeatherColor()}.
|
||||
+ * @param color the color to set.
|
||||
*/
|
||||
void setColor(@Nullable Color color);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java b/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java
|
||||
index 43f0df04f3cdff7d7db73321a2886f3a737e3c9f..5c741228b2338a7c4de2fe736eb789511abf4880 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java
|
||||
@@ -3,7 +3,7 @@ package org.bukkit.inventory.meta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
- * Represents a map that can be scalable.
|
||||
+ * Represents an ominous bottle with an amplifier of the bad omen effect.
|
||||
*/
|
||||
public interface OminousBottleMeta extends ItemMeta {
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/messaging/PluginMessageRecipient.java b/src/main/java/org/bukkit/plugin/messaging/PluginMessageRecipient.java
|
||||
index b84b37fe27d84574dc5897285f1d9a1437bd322c..281ae60a6be7e39aab4f27b4c7de3d49ada9a557 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/messaging/PluginMessageRecipient.java
|
||||
|
|
|
@ -973,6 +973,31 @@ index b670ff8b2bfcaa59c2292211cb9fc2bf4c5b2642..94092a5882180cca7905388184de1f91
|
|||
public static final Structure TRIAL_CHAMBERS = getStructure("trial_chambers");
|
||||
|
||||
private static Structure getStructure(String name) {
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/BundleMeta.java b/src/main/java/org/bukkit/inventory/meta/BundleMeta.java
|
||||
index e404cd1e2ba44e4c2d09524bc7cf730d8ffbdabd..cea0ebf50876dd32ab7fba6025b30f297d0a69c4 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/BundleMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/BundleMeta.java
|
||||
@@ -6,6 +6,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+@org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.BUNDLE) // Paper - add missing annotation
|
||||
@ApiStatus.Experimental
|
||||
public interface BundleMeta extends ItemMeta {
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java b/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java
|
||||
index 5c741228b2338a7c4de2fe736eb789511abf4880..0a25483bcf88e8f7b8e6755d754467930e1a9c65 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/OminousBottleMeta.java
|
||||
@@ -5,6 +5,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents an ominous bottle with an amplifier of the bad omen effect.
|
||||
*/
|
||||
+@org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation
|
||||
+@org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
public interface OminousBottleMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
||||
index f2242ddc4085f7e7cdd748d860857822e3d9b007..9133a889c1936b4cf7dbf17f744ee926d57362a3 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
||||
|
|
|
@ -5,18 +5,17 @@ Subject: [PATCH] Expose #hasColor to leather armor
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
index 7f9eabcaa4d803ee524a9cc8717379fe6a93a5af..496f4b256406a4f38f36471f57d8529b3f29b6a1 100644
|
||||
index 1d61cc4ab36413fe3c1ecdf9824a5e18cb4bc148..fba0512827b4af289674a5602722f520f32d28b2 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
@@ -33,4 +33,14 @@ public interface LeatherArmorMeta extends ItemMeta {
|
||||
@@ -36,4 +36,13 @@ public interface LeatherArmorMeta extends ItemMeta {
|
||||
@Override
|
||||
@NotNull
|
||||
LeatherArmorMeta clone();
|
||||
+
|
||||
+ // Paper start - Expose #hasColor to leather armor
|
||||
+ /**
|
||||
+ * Checks whether this leather armor is dyed
|
||||
+ * (i.e. has a color different from {@link ItemFactory#getDefaultLeatherColor()})
|
||||
+ * Checks whether this leather armor is dyed.
|
||||
+ *
|
||||
+ * @return whether this leather armor is dyed
|
||||
+ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue