use of org.bukkit.potion.Potion in project PyrCore by PYRRH4.
the class Compat_1_7_10 method buildPotion.
@Override
public ItemStack buildPotion(PotionType type, int level, boolean extended, boolean splash) {
Potion potion = new Potion(type, level, splash);
potion.setHasExtendedDuration(extended);
ItemStack item = potion.toItemStack(1);
;
return item;
}
use of org.bukkit.potion.Potion in project PyrCore by PYRRH4.
the class Compat_1_7_9 method buildPotion.
@Override
public ItemStack buildPotion(PotionType type, int level, boolean extended, boolean splash) {
Potion potion = new Potion(type, level, splash);
potion.setHasExtendedDuration(extended);
ItemStack item = potion.toItemStack(1);
;
return item;
}
use of org.bukkit.potion.Potion in project PyrCore by PYRRH4.
the class Compat_1_8_8 method buildPotion.
@Override
public ItemStack buildPotion(PotionType type, int level, boolean extended, boolean splash) {
Potion potion = new Potion(type, level, splash);
potion.setHasExtendedDuration(extended);
ItemStack item = potion.toItemStack(1);
;
return item;
}
use of org.bukkit.potion.Potion in project MassiveCore by MassiveCraft.
the class PotionUtil method toPotionData.
public static PotionData toPotionData(int damage) {
try {
Potion potion = Potion.fromDamage(damage);
PotionType type = potion.getType();
boolean extended = potion.hasExtendedDuration();
boolean upgraded = (potion.getLevel() >= 2);
// If a potion was both upgraded and extended we keep the upgraded and remove the extended.
if (type == null)
return null;
if (extended && !type.isExtendable())
return null;
if (upgraded && !type.isUpgradeable())
return null;
if (upgraded && extended)
extended = false;
return new PotionData(type, extended, upgraded);
} catch (Exception e) {
return null;
}
}
use of org.bukkit.potion.Potion in project MassiveCore by MassiveCraft.
the class MUtil method getPotionEffects.
@SuppressWarnings("deprecation")
public static List<PotionEffect> getPotionEffects(ItemStack itemStack) {
if (itemStack == null)
return null;
if (itemStack.getType() != Material.POTION)
return null;
List<PotionEffect> ret = new ArrayList<>();
if (isWaterPotion(itemStack))
return ret;
Potion potion = Potion.fromDamage(getPotionEffectBits(itemStack));
ret.addAll(potion.getEffects());
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
if (meta.hasCustomEffects()) {
ret.addAll(meta.getCustomEffects());
}
return ret;
}
Aggregations