SPIGOT-840, SPIGOT-2522: [Draft] Add EntityPotionEffectChangeEvent

Discussion ongoing in PR #449

By: kaenganxt <kaenganxt@mc-anura.de>
This commit is contained in:
CraftBukkit/Spigot
2018-07-20 16:04:37 +10:00
parent 300a2a1daf
commit 15a21299da
33 changed files with 617 additions and 47 deletions

View File

@@ -68,6 +68,7 @@ import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow;
import org.bukkit.entity.Trident;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
@@ -262,7 +263,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
removePotionEffect(effect.getType());
}
getHandle().addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
getHandle().addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
return true;
}
@@ -285,7 +286,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
public void removePotionEffect(PotionEffectType type) {
getHandle().removeEffect(MobEffectList.fromId(type.getId()));
getHandle().removeEffect(MobEffectList.fromId(type.getId()), EntityPotionEffectEvent.Cause.PLUGIN);
}
public Collection<PotionEffect> getActivePotionEffects() {