diff options
Diffstat (limited to 'src/main')
4 files changed, 35 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java index e8b8787b..f8d6a7b3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import java.util.List; import net.minecraft.server.EntityAreaEffectCloud; +import net.minecraft.server.EntityLiving; import net.minecraft.server.MobEffect; import net.minecraft.server.MobEffectList; @@ -15,6 +16,7 @@ import org.bukkit.entity.AreaEffectCloud; import org.bukkit.entity.EntityType; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.bukkit.projectiles.ProjectileSource; import org.bukkit.potion.PotionData; import com.google.common.collect.ImmutableList; @@ -202,4 +204,17 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud public PotionData getBasePotionData() { return CraftPotionUtil.toBukkit(getHandle().getType()); } + + public ProjectileSource getSource() { + return getHandle().projectileSource; + } + + public void setSource(ProjectileSource shooter) { + if (shooter instanceof CraftLivingEntity) { + getHandle().a((EntityLiving) ((CraftLivingEntity) shooter).getHandle()); // PAIL rename setSource + } else { + getHandle().a((EntityLiving) null); + } + getHandle().projectileSource = shooter; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLingeringPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLingeringPotion.java index 52cd654a..2a5482ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLingeringPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLingeringPotion.java @@ -6,9 +6,10 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LingeringPotion; import org.bukkit.inventory.ItemStack; -public class CraftLingeringPotion extends CraftThrownPotion { +public class CraftLingeringPotion extends CraftThrownPotion implements LingeringPotion { public CraftLingeringPotion(CraftServer server, EntityPotion entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java index 863a6c27..1ef057b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java @@ -6,9 +6,10 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import org.bukkit.entity.SplashPotion; import org.bukkit.inventory.ItemStack; -public class CraftSplashPotion extends CraftThrownPotion { +public class CraftSplashPotion extends CraftThrownPotion implements SplashPotion { public CraftSplashPotion(CraftServer server, EntityPotion entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0abfc608..646ee2bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -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; + } } |