!Updated lib

This commit is contained in:
Indyuce 2020-08-15 15:13:39 +02:00
parent f3cd81db91
commit e12d116c1c
2 changed files with 7 additions and 8 deletions

View File

@ -1,10 +1,9 @@
package net.Indyuce.mmocore.api.player.profess.resource; package net.Indyuce.mmocore.api.player.profess.resource;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import net.asangarin.hexcolors.ColorParse;
import net.md_5.bungee.api.ChatColor;
import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.util.AltChar; import net.mmogroup.mmolib.api.util.AltChar;
@ -23,9 +22,9 @@ public class ManaDisplayOptions {
Validate.notNull(name, "Could not load mana name"); Validate.notNull(name, "Could not load mana name");
Validate.notNull(config.getConfigurationSection("color"), "Could not find mana color config"); Validate.notNull(config.getConfigurationSection("color"), "Could not find mana color config");
full = ColorParse.getColor(config.getString("color.full", "NO_INPUT")); full = ChatColor.valueOf(config.getString("color.full", "NO_INPUT"));
half = ColorParse.getColor(config.getString("color.half", "NO_INPUT")); half = ChatColor.valueOf(config.getString("color.half", "NO_INPUT"));
empty = ColorParse.getColor(config.getString("color.empty", "NO_INPUT")); empty = ChatColor.valueOf(config.getString("color.empty", "NO_INPUT"));
String format = config.getString("char", ""); String format = config.getString("char", "");
Validate.notEmpty(format, "Could not load mana bar character"); Validate.notEmpty(format, "Could not load mana bar character");

View File

@ -13,6 +13,7 @@ import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -101,13 +102,12 @@ public class ConfigItem {
return build(1); return build(1);
} }
@SuppressWarnings("deprecation")
public ItemStack build(int amount) { public ItemStack build(int amount) {
ItemStack item = getItem(amount); ItemStack item = getItem(amount);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
if (MMOLib.plugin.getVersion().getWrapper().isDamageable(item)) if (meta instanceof Damageable)
MMOLib.plugin.getVersion().getWrapper().applyDurability(item, meta, damage); ((Damageable) meta).setDamage(damage);
if (MMOLib.plugin.getVersion().isStrictlyHigher(1, 13)) if (MMOLib.plugin.getVersion().isStrictlyHigher(1, 13))
meta.setCustomModelData(modeldata); meta.setCustomModelData(modeldata);