mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
SPIGOT-2578: Method to get PotionEffect of specific type.
By: md_5 <git@md-5.net>
This commit is contained in:
parent
42a06f7c4b
commit
44ea5ef72b
1 changed files with 6 additions and 0 deletions
|
@ -313,6 +313,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
return getHandle().hasEffect(MobEffectList.fromId(type.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionEffect getPotionEffect(PotionEffectType type) {
|
||||
MobEffect handle = getHandle().getEffect(MobEffectList.fromId(type.getId()));
|
||||
return (handle == null) ? null : new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getMobEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles());
|
||||
}
|
||||
|
||||
public void removePotionEffect(PotionEffectType type) {
|
||||
getHandle().removeEffect(MobEffectList.fromId(type.getId()));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue