SPIGOT-3433: Improve AreaEffectCloud#getSource

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2017-07-22 09:51:22 +10:00
parent b4a099c163
commit 8bafc76ff2
3 changed files with 12 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
@@ -206,7 +207,8 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
}
public ProjectileSource getSource() {
return getHandle().projectileSource;
EntityLiving source = getHandle().y(); // PAIL: rename
return (source == null) ? null : (LivingEntity) source.getBukkitEntity();
}
public void setSource(ProjectileSource shooter) {
@@ -215,6 +217,5 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
} else {
getHandle().setSource((EntityLiving) null);
}
getHandle().projectileSource = shooter;
}
}