From 6f7ffb2be654998dab4be62e7e50dfad2eb6c0da Mon Sep 17 00:00:00 2001 From: filoghost Date: Sun, 7 Dec 2014 15:24:49 +0100 Subject: [PATCH] Add SKULL_OWNER --- .../gmail/filoghost/chestcommands/api/Icon.java | 14 ++++++++++++++ .../chestcommands/serializer/IconSerializer.java | 3 +++ 2 files changed, 17 insertions(+) diff --git a/ChestCommands/src/com/gmail/filoghost/chestcommands/api/Icon.java b/ChestCommands/src/com/gmail/filoghost/chestcommands/api/Icon.java index 4af14c5..2e490ed 100644 --- a/ChestCommands/src/com/gmail/filoghost/chestcommands/api/Icon.java +++ b/ChestCommands/src/com/gmail/filoghost/chestcommands/api/Icon.java @@ -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 lore; private Map 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. diff --git a/ChestCommands/src/com/gmail/filoghost/chestcommands/serializer/IconSerializer.java b/ChestCommands/src/com/gmail/filoghost/chestcommands/serializer/IconSerializer.java index babfd16..ba07866 100644 --- a/ChestCommands/src/com/gmail/filoghost/chestcommands/serializer/IconSerializer.java +++ b/ChestCommands/src/com/gmail/filoghost/chestcommands/serializer/IconSerializer.java @@ -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));