From ba8db742e47c051fbfead0af85b55b5d2f3b245a Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 27 Dec 2012 10:45:56 -0600 Subject: [PATCH] Add method to get defult leather color. Adds BUKKIT-3203 The default leather color is already used internally in place of null. The javadocs were updated appropriately to indicate as such. By: Wesley Wolfe --- .../src/main/java/org/bukkit/inventory/ItemFactory.java | 8 ++++++++ .../java/org/bukkit/inventory/meta/LeatherArmorMeta.java | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/inventory/ItemFactory.java b/paper-api/src/main/java/org/bukkit/inventory/ItemFactory.java index c6654c4aff..58c2e17e51 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/paper-api/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -1,5 +1,6 @@ package org.bukkit.inventory; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.inventory.meta.BookMeta; @@ -79,4 +80,11 @@ public interface ItemFactory { * @throws IllegalArgumentException if the specified meta was not created by this factory */ ItemMeta asMetaFor(final ItemMeta meta, final Material material) throws IllegalArgumentException; + + /** + * Returns the default color for all leather armor. + * + * @return the default color for leather armor + */ + Color getDefaultLeatherColor(); } diff --git a/paper-api/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/paper-api/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java index 2ca6b6ecee..01e23336d7 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java +++ b/paper-api/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java @@ -2,6 +2,7 @@ package org.bukkit.inventory.meta; import org.bukkit.Color; import org.bukkit.Material; +import org.bukkit.inventory.ItemFactory; /** * Represents leather armor ({@link Material#LEATHER_BOOTS}, {@link Material#LEATHER_CHESTPLATE}, {@link Material#LEATHER_HELMET}, or {@link Material#LEATHER_LEGGINGS}) that can be colored. @@ -9,16 +10,16 @@ import org.bukkit.Material; public interface LeatherArmorMeta extends ItemMeta { /** - * Gets the color of the armor + * Gets the color of the armor. If it has not been set otherwise, it will be {@link ItemFactory#getDefaultLeatherColor()}. * * @return the color of the armor, never null */ Color getColor(); /** - * Sets the color of the armor + * Sets the color of the armor. * - * @param color the color to set, null makes it the default leather color + * @param color the color to set. Setting it to null is equivalent to setting it to {@link ItemFactory#getDefaultLeatherColor()}. */ void setColor(Color color);