Skip to content

Commit

Permalink
Check version before use itemName
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Oct 31, 2024
1 parent 78b7cbb commit c4b1697
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.th0rgal.oraxen.compatibilities.provided.placeholderapi;

import io.th0rgal.oraxen.utils.VersionUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
Expand Down Expand Up @@ -27,8 +28,10 @@ public static ItemStack setPlaceholders(final Player player, @NotNull final Item
final ItemMeta meta = item.getItemMeta();
if (meta.hasDisplayName())
meta.setDisplayName(setPlaceholders(player, meta.getDisplayName()));
if (meta.hasItemName()) {
meta.setItemName(setPlaceholders(player, meta.getItemName()));
if (VersionUtil.atOrAbove("1.21")) {
if (meta.hasItemName()) {
meta.setItemName(setPlaceholders(player, meta.getItemName()));
}
}
if (updateLore) {
final List<String> itemLore = meta.getLore();
Expand Down

0 comments on commit c4b1697

Please sign in to comment.