Skip to content

Commit ce2d8d0

Browse files
committed
hascustomname is 1.21.3+
1 parent bc31d36 commit ce2d8d0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/java/ch/njol/skript/aliases/ItemData.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ public ItemData aliasCopy() {
654654
return data;
655655
}
656656

657+
// Can remove after 1.21.3 is the minimum supported version
658+
private static final boolean HAS_CUSTOM_NAME = Skript.methodExists(PotionMeta.class, "hasCustomPotionName");
659+
657660
private static void copyPotionInfo(PotionMeta potionMeta, ItemData data) {
658661
PotionMeta newMeta = (PotionMeta) itemFactory.getItemMeta(data.type);
659662
if (!newMeta.equals(potionMeta)) {
@@ -667,7 +670,7 @@ private static void copyPotionInfo(PotionMeta potionMeta, ItemData data) {
667670
}
668671
if (potionMeta.hasColor())
669672
newMeta.setColor(potionMeta.getColor());
670-
if (potionMeta.hasCustomPotionName())
673+
if (HAS_CUSTOM_NAME && potionMeta.hasCustomPotionName())
671674
newMeta.setCustomPotionName(potionMeta.getCustomPotionName());
672675
data.itemFlags = ItemFlags.CHANGED_TAGS;
673676
data.setItemMeta(newMeta);

0 commit comments

Comments
 (0)