Skip to content

Commit 9f75cd0

Browse files
committed
Merge branch 'dev'
2 parents 651ee79 + f064de1 commit 9f75cd0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/main/java/fr/hashtek/spigot/hashitem/HashItem.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import fr.hashtek.spigot.hashgui.handler.hold.HoldHandler;
88
import fr.hashtek.spigot.hashgui.handler.hit.HitHandler;
99
import org.bukkit.ChatColor;
10+
import org.bukkit.Color;
1011
import org.bukkit.Material;
1112
import org.bukkit.enchantments.Enchantment;
1213
import org.bukkit.inventory.ItemFlag;
@@ -16,6 +17,7 @@
1617
import fr.hashtek.spigot.hashgui.manager.HashGuiManager;
1718
import fr.hashtek.spigot.hashgui.handler.click.ClickHandler;
1819
import fr.hashtek.spigot.hashgui.handler.interact.InteractHandler;
20+
import org.bukkit.inventory.meta.LeatherArmorMeta;
1921

2022
public class HashItem
2123
{
@@ -393,6 +395,25 @@ public HashItem setUntakable(boolean untakable)
393395
return this;
394396
}
395397

398+
/**
399+
* Sets leather armor color.
400+
*
401+
* @param color Wanted color
402+
* @return Returns itself.
403+
* @throws ClassCastException If item is not a leather armor piece
404+
*/
405+
public HashItem setLeatherArmorColor(Color color)
406+
throws ClassCastException
407+
{
408+
if (!this.itemStack.getType().name().startsWith("LEATHER_"))
409+
throw new ClassCastException("Item must be a leather armor piece.");
410+
411+
((LeatherArmorMeta) this.itemMeta).setColor(color);
412+
return this;
413+
}
414+
415+
/* Handlers management */
416+
396417
/**
397418
* Adds a click handler to the item.
398419
* If a handler with the same ClickType is already registered,

0 commit comments

Comments
 (0)