Add SKULL_OWNER

This commit is contained in:
filoghost 2014-12-07 15:24:49 +01:00
parent 6aae363b6b
commit 6f7ffb2be6
2 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
import com.google.common.collect.Lists;
@ -27,6 +28,7 @@ public class Icon {
private List<String> lore;
private Map<Enchantment, Integer> enchantments;
private Color color;
private String skullOwner;
protected boolean closeOnClick;
private ClickHandler clickHandler;
@ -128,6 +130,14 @@ public class Icon {
this.color = color;
}
public String getSkullOwner() {
return skullOwner;
}
public void setSkullOwner(String skullOwner) {
this.skullOwner = skullOwner;
}
public void setCloseOnClick(boolean closeOnClick) {
this.closeOnClick = closeOnClick;
}
@ -193,6 +203,10 @@ public class Icon {
((LeatherArmorMeta) itemMeta).setColor(color);
}
if (skullOwner != null && itemMeta instanceof SkullMeta) {
((SkullMeta) itemMeta).setOwner(skullOwner);
}
itemStack.setItemMeta(itemMeta);
// Apply enchants.

View File

@ -29,6 +29,7 @@ public class IconSerializer {
LORE = "LORE",
ENCHANT = "ENCHANTMENT",
COLOR = "COLOR",
SKULL_OWNER = "SKULL_OWNER",
COMMAND = "COMMAND",
PRICE = "PRICE",
POINTS = "POINTS",
@ -108,6 +109,8 @@ public class IconSerializer {
}
}
icon.setSkullOwner(section.getString(Nodes.SKULL_OWNER));
icon.setPermission(section.getString(Nodes.PERMISSION));
icon.setPermissionMessage(Utils.addColors(section.getString(Nodes.PERMISSION_MESSAGE)));
icon.setViewPermission(section.getString(Nodes.VIEW_PERMISSION));