diff --git a/pom.xml b/pom.xml index ccacb1e..e0eb27e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ com.songoda EpicHeads 4.0.0 - 3.2.6 + 3.2.7 clean install EpicHeads-${project.version} diff --git a/src/main/java/com/songoda/epicheads/utils/HeadType.java b/src/main/java/com/songoda/epicheads/utils/HeadType.java index 68667c7..f4ae535 100644 --- a/src/main/java/com/songoda/epicheads/utils/HeadType.java +++ b/src/main/java/com/songoda/epicheads/utils/HeadType.java @@ -70,7 +70,8 @@ public enum HeadType { FOX("1528ee714d3fca31655feae1cd3c14d346f9bcae3e457b7658c9f915e21"), PILLAGER("63550f89aea88665804c2fd1b6682930c23233184fdc060991305718ed660597"), RAVAGER("d91a9d864e36fbec19b584bcb71292530755b10c4e60784fec92b51f8189363c"), - TRADER_LLAMA("6bc438fc1fbbaea2289aabecedd3fdf269ddc979bf8b5c6a8fc4bb8dcd4e1fe"); + TRADER_LLAMA("6bc438fc1fbbaea2289aabecedd3fdf269ddc979bf8b5c6a8fc4bb8dcd4e1fe"), + BEE("5162dd0b9f65b58a1e70f81d8e03e8ff6c53e4e985bdbe0186558d8a69a81189"); private final String url; diff --git a/src/main/java/com/songoda/epicheads/utils/ItemEconomy.java b/src/main/java/com/songoda/epicheads/utils/ItemEconomy.java index 73d93d9..ff57a3a 100644 --- a/src/main/java/com/songoda/epicheads/utils/ItemEconomy.java +++ b/src/main/java/com/songoda/epicheads/utils/ItemEconomy.java @@ -1,14 +1,19 @@ package com.songoda.epicheads.utils; +import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.hooks.economies.Economy; +import com.songoda.core.utils.ItemUtils; +import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.inventory.ItemStack; public class ItemEconomy extends Economy { public boolean isItem(ItemStack itemStack) { - if (itemStack == null) + if (itemStack == null || itemStack.getType() == Material.AIR) return false; + if (CompatibleMaterial.getMaterial(itemStack) == CompatibleMaterial.PLAYER_HEAD) + return ItemUtils.getSkullTexture(itemStack).equals(ItemUtils.getSkullTexture(Methods.createToken(1))); return itemStack.isSimilar(Methods.createToken(1)); } @@ -16,6 +21,17 @@ public class ItemEconomy extends Economy { return (int) Math.ceil(amount); } + @Override + public double getBalance(OfflinePlayer player) { + int amount = 0; + for (ItemStack item : player.getPlayer().getInventory().getContents()) { + if (!isItem(item)) + continue; + amount += item.getAmount(); + } + return amount; + } + @Override public boolean hasBalance(OfflinePlayer player, double cost) { int amount = convertAmount(cost); diff --git a/src/main/java/com/songoda/epicheads/utils/Methods.java b/src/main/java/com/songoda/epicheads/utils/Methods.java index a189566..85938ce 100644 --- a/src/main/java/com/songoda/epicheads/utils/Methods.java +++ b/src/main/java/com/songoda/epicheads/utils/Methods.java @@ -30,7 +30,7 @@ public class Methods { for (String line : Settings.ITEM_TOKEN_LORE.getStringList()) if (!line.equals("")) lore.add(formatText(line)); - if (lore != null) meta.setLore(lore); + meta.setLore(lore); itemStack.setItemMeta(meta); return itemStack; }