org.bukkit.entity.AreaEffectCloud Java Examples
The following examples show how to use
org.bukkit.entity.AreaEffectCloud.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DamageMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler public void onPotionLinger(final AreaEffectCloudApplyEvent event) { final AreaEffectCloud cloud = event.getEntity(); if(PotionClassification.classify(cloud) != PotionClassification.HARMFUL) return; for(Iterator<LivingEntity> iterator = event.getAffectedEntities().iterator(); iterator.hasNext(); ) { final LivingEntity victim = iterator.next(); final ParticipantState victimState = getMatch().getParticipantState(victim); final DamageInfo damageInfo = damageResolver.resolveDamage(EntityDamageEvent.DamageCause.MAGIC, victim, cloud); if(victimState != null && queryDamage(event, victimState, damageInfo).isDenied()) { iterator.remove(); } } }
Example #2
Source File: Shrouded.java From MineTinker with GNU General Public License v3.0 | 4 votes |
private void effect(Event event, Player player, ItemStack tool, Location location) { if (!player.hasPermission("minetinker.modifiers.shrouded.use")) { return; } if (!modManager.hasMod(tool, this)) { return; } int level = modManager.getModLevel(tool, this); AreaEffectCloud cloud = (AreaEffectCloud) location.getWorld().spawnEntity(location, EntityType.AREA_EFFECT_CLOUD); int duration = (int) Math.round(this.duration * Math.pow(this.durationMultiplier, level)); float radius = (float) (this.radiusPerLevel * level); cloud.clearCustomEffects(); cloud.setColor(Color.BLACK); cloud.setRadius(radius); cloud.setDuration(duration); cloud.addCustomEffect(new PotionEffect(PotionEffectType.BLINDNESS, duration, 0, false, false), true); ArrayList<String> extras = new ArrayList<>(); if (modManager.hasMod(tool, Glowing.instance()) && player.hasPermission("minetinker.modifiers.glowing.use")) { extras.add(Glowing.instance().getKey()); cloud.addCustomEffect(Glowing.instance().getPotionEffect(null, null, player, tool), true); } if (modManager.hasMod(tool, Poisonous.instance()) && player.hasPermission("minetinker.modifiers.poisonous.use")) { extras.add(Poisonous.instance().getKey()); cloud.addCustomEffect(Poisonous.instance().getPotionEffect(null, null, player, tool), true); } if (modManager.hasMod(tool, Shulking.instance()) && player.hasPermission("minetinker.modifiers.shulking.use")) { extras.add(Shulking.instance().getKey()); cloud.addCustomEffect(Shulking.instance().getPotionEffect(null, null, player, tool), true); } if (modManager.hasMod(tool, Webbed.instance()) && player.hasPermission("minetinker.modifiers.webbed.use")) { extras.add(Webbed.instance().getKey()); cloud.addCustomEffect(Webbed.instance().getPotionEffect(null, null, player, tool), true); } if (modManager.hasMod(tool, Withered.instance()) && player.hasPermission("minetinker.modifiers.withered.use")) { extras.add(Withered.instance().getKey()); cloud.addCustomEffect(Withered.instance().getPotionEffect(null, null, player, tool), true); } StringBuilder ex = new StringBuilder(); for (String s : extras) { ex.append(s).append("/"); } if (!extras.isEmpty()) ex.deleteCharAt(ex.length() - 1); ChatWriter.logModifier(player, event, this, tool, String.format("Radius(%.2f)", radius), "Duration(" + duration + ")", "Extras(" + ex.toString() + ")"); }
Example #3
Source File: LingeringPotionSplashEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public LingeringPotionSplashEvent(final ThrownPotion potion, final AreaEffectCloud entity) { super(potion); this.entity = entity; }
Example #4
Source File: AreaEffectCloudApplyEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
public AreaEffectCloudApplyEvent(final AreaEffectCloud entity, final List<LivingEntity> affectedEntities) { super(entity); this.affectedEntities = affectedEntities; }
Example #5
Source File: AreaEffectCloudApplyEvent.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public AreaEffectCloud getEntity() { return (AreaEffectCloud) entity; }
Example #6
Source File: PotionUtils.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
public static Collection<PotionEffect> effects(AreaEffectCloud cloud) { return effects(cloud.getBasePotionData(), cloud.getCustomEffects()); }
Example #7
Source File: LingeringPotionSplashEvent.java From Kettle with GNU General Public License v3.0 | 2 votes |
/** * Gets the AreaEffectCloud spawned * * @return The spawned AreaEffectCloud */ public AreaEffectCloud getAreaEffectCloud() { return entity; }