Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
'icon-data' field in skill indicator now determines CustomModelData
Browse files Browse the repository at this point in the history
  • Loading branch information
Sentropic committed Sep 22, 2020
1 parent 88cdfd2 commit 50fb1cd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/java/com/sucy/skill/api/util/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.commons.lang.ObjectUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
Expand Down Expand Up @@ -82,11 +83,8 @@ private static ItemStack parse(final String mat, final short dur, final int data
public static void serializeIcon(ItemStack item, DataSection config) {
config.set(MAT, item.getType().name());
config.set(DURABILITY, item.getDurability());
int cmd = 0;
try {
cmd = item.getItemMeta().getCustomModelData();
} catch (NullPointerException ignored) {}
config.set(DATA, cmd);
ItemMeta meta = item.getItemMeta();
config.set(DATA, meta.hasCustomModelData() ? meta.getCustomModelData() : 0);

if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
List<String> lore = item.getItemMeta().getLore();
Expand Down

0 comments on commit 50fb1cd

Please sign in to comment.