diff --git a/src/main/java/com/muhammaddaffa/mdlib/utils/ItemBuilder.java b/src/main/java/com/muhammaddaffa/mdlib/utils/ItemBuilder.java index c233b97..709b77b 100644 --- a/src/main/java/com/muhammaddaffa/mdlib/utils/ItemBuilder.java +++ b/src/main/java/com/muhammaddaffa/mdlib/utils/ItemBuilder.java @@ -3,10 +3,8 @@ import com.cryptomorin.xseries.profiles.builder.XSkull; import com.cryptomorin.xseries.profiles.objects.ProfileInputType; import com.cryptomorin.xseries.profiles.objects.Profileable; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.OfflinePlayer; +import me.clip.placeholderapi.PlaceholderAPI; +import org.bukkit.*; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.enchantments.Enchantment; @@ -311,6 +309,12 @@ public static ItemBuilder fromConfig(ConfigurationSection section, @Nullable Pla materialString = placeholder.translate(materialString); } + if (isPlaceholderAPI()) { + materialString = PlaceholderAPI.setPlaceholders(null, materialString); + displayName = PlaceholderAPI.setPlaceholders(null, displayName); + lore = PlaceholderAPI.setPlaceholders(null, lore); + } + // start building the itemstack ItemBuilder builder; if (materialString.contains(";")) { @@ -380,6 +384,10 @@ public ItemStack build() { return this.item; } + private static boolean isPlaceholderAPI() { + return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"); + } + private static boolean isValidItemFlag(String flag) { try { ItemFlag.valueOf(flag.toUpperCase());