mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Null check base potion data, fixes #2302
This commit is contained in:
parent
318f8e565b
commit
85442a4760
@ -149,14 +149,17 @@ public class BukkitItemUtil {
|
||||
|| one.getType().equals(Material.SPLASH_POTION)) {
|
||||
final PotionMeta pMeta1 = (PotionMeta) one.getItemMeta();
|
||||
final PotionMeta pMeta2 = (PotionMeta) two.getItemMeta();
|
||||
if (!pMeta1.getBasePotionData().getType().equals(pMeta2.getBasePotionData().getType())) {
|
||||
return -9;
|
||||
}
|
||||
if (pMeta1.getBasePotionData().isExtended() != pMeta2.getBasePotionData().isExtended()) {
|
||||
return -9;
|
||||
}
|
||||
if (pMeta1.getBasePotionData().isUpgraded() != pMeta2.getBasePotionData().isUpgraded()) {
|
||||
return -9;
|
||||
// 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;
|
||||
}
|
||||
if (pMeta1.getBasePotionData().isExtended() != pMeta2.getBasePotionData().isExtended()) {
|
||||
return -9;
|
||||
}
|
||||
if (pMeta1.getBasePotionData().isUpgraded() != pMeta2.getBasePotionData().isUpgraded()) {
|
||||
return -9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user