-
-
Notifications
You must be signed in to change notification settings - Fork 103
/
LeatherColorer.java
30 lines (23 loc) · 981 Bytes
/
LeatherColorer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.denizenscript.denizen.utilities.nbt;
import com.denizenscript.denizen.utilities.debugging.Debug;
import com.denizenscript.denizen.objects.ColorTag;
import com.denizenscript.denizen.objects.ItemTag;
import com.denizenscript.denizencore.utilities.CoreUtilities;
import org.bukkit.inventory.meta.LeatherArmorMeta;
public class LeatherColorer {
public static void colorArmor(ItemTag item, String colorArg) {
if (item == null) {
return;
}
if (ColorTag.matches(colorArg)) {
try {
LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemStack().getItemMeta();
meta.setColor(ColorTag.valueOf(colorArg, CoreUtilities.basicContext).getColor());
item.getItemStack().setItemMeta(meta);
}
catch (Exception e) {
Debug.echoError("Unable to color '" + item.identify() + "'.");
}
}
}
}