Null check base potion data, fixes #2302

This commit is contained in:
PikaMug 2024-10-20 01:25:51 -04:00
parent 318f8e565b
commit 85442a4760

View File

@ -149,6 +149,8 @@ public class BukkitItemUtil {
|| one.getType().equals(Material.SPLASH_POTION)) {
final PotionMeta pMeta1 = (PotionMeta) one.getItemMeta();
final PotionMeta pMeta2 = (PotionMeta) two.getItemMeta();
// Base potion data can return null on newer versions (likely 1.20.6+)
if (pMeta1.getBasePotionData() != null && pMeta2.getBasePotionData() != null) {
if (!pMeta1.getBasePotionData().getType().equals(pMeta2.getBasePotionData().getType())) {
return -9;
}
@ -161,6 +163,7 @@ public class BukkitItemUtil {
}
}
}
}
if (one.getItemMeta().toString().startsWith("TROPICAL_FISH_BUCKET_META")) {
final String meta1 = one.getItemMeta().toString();
final String meta2 = two.getItemMeta().toString();