SPIGOT-1904: AreaEffectCloud events and additional API

By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2016-03-12 12:12:25 -05:00
parent 277b9a6caa
commit fb5328bb3c
6 changed files with 93 additions and 14 deletions

View File

@@ -31,6 +31,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftMetaBook;
import org.bukkit.craftbukkit.util.CraftDamageSource;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
@@ -344,6 +345,15 @@ public class CraftEventFactory {
return event;
}
public static LingeringPotionSplashEvent callLingeringPotionSplashEvent(EntityPotion potion, EntityAreaEffectCloud cloud) {
ThrownPotion thrownPotion = (ThrownPotion) potion.getBukkitEntity();
AreaEffectCloud effectCloud = (AreaEffectCloud) cloud.getBukkitEntity();
LingeringPotionSplashEvent event = new LingeringPotionSplashEvent(thrownPotion, effectCloud);
Bukkit.getPluginManager().callEvent(event);
return event;
}
/**
* BlockFadeEvent
*/
@@ -993,4 +1003,10 @@ public class CraftEventFactory {
entity.world.getServer().getPluginManager().callEvent(event);
return event;
}
public static AreaEffectCloudApplyEvent callAreaEffectCloudApplyEvent(EntityAreaEffectCloud cloud, List<LivingEntity> entities) {
AreaEffectCloudApplyEvent event = new AreaEffectCloudApplyEvent((AreaEffectCloud) cloud.getBukkitEntity(), entities);
cloud.world.getServer().getPluginManager().callEvent(event);
return event;
}
}