|
7 | 7 | import fr.hashtek.spigot.hashgui.handler.hold.HoldHandler; |
8 | 8 | import fr.hashtek.spigot.hashgui.handler.hit.HitHandler; |
9 | 9 | import org.bukkit.ChatColor; |
| 10 | +import org.bukkit.Color; |
10 | 11 | import org.bukkit.Material; |
11 | 12 | import org.bukkit.enchantments.Enchantment; |
12 | 13 | import org.bukkit.inventory.ItemFlag; |
|
16 | 17 | import fr.hashtek.spigot.hashgui.manager.HashGuiManager; |
17 | 18 | import fr.hashtek.spigot.hashgui.handler.click.ClickHandler; |
18 | 19 | import fr.hashtek.spigot.hashgui.handler.interact.InteractHandler; |
| 20 | +import org.bukkit.inventory.meta.LeatherArmorMeta; |
19 | 21 |
|
20 | 22 | public class HashItem |
21 | 23 | { |
@@ -393,6 +395,25 @@ public HashItem setUntakable(boolean untakable) |
393 | 395 | return this; |
394 | 396 | } |
395 | 397 |
|
| 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 | + |
396 | 417 | /** |
397 | 418 | * Adds a click handler to the item. |
398 | 419 | * If a handler with the same ClickType is already registered, |
|
0 commit comments