Merge branch 'development'

This commit is contained in:
songoda 2020-01-16 23:11:21 -05:00
commit 211507f00c
4 changed files with 21 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicHeads</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>3.2.6</version>
<version>3.2.7</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>EpicHeads-${project.version}</finalName>

View File

@ -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;

View File

@ -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);

View File

@ -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;
}