类org.bukkit.entity.AreaEffectCloud源码实例Demo

下面列出了怎么用org.bukkit.entity.AreaEffectCloud的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: ProjectAres   文件: DamageMatchModule.java
@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();
        }
    }
}
 
源代码2 项目: MineTinker   文件: Shrouded.java
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() + ")");
}
 
源代码3 项目: Kettle   文件: LingeringPotionSplashEvent.java
public LingeringPotionSplashEvent(final ThrownPotion potion, final AreaEffectCloud entity) {
    super(potion);
    this.entity = entity;
}
 
源代码4 项目: Kettle   文件: AreaEffectCloudApplyEvent.java
public AreaEffectCloudApplyEvent(final AreaEffectCloud entity, final List<LivingEntity> affectedEntities) {
    super(entity);
    this.affectedEntities = affectedEntities;
}
 
源代码5 项目: Kettle   文件: AreaEffectCloudApplyEvent.java
@Override
public AreaEffectCloud getEntity() {
    return (AreaEffectCloud) entity;
}
 
源代码6 项目: ProjectAres   文件: PotionUtils.java
public static Collection<PotionEffect> effects(AreaEffectCloud cloud) {
    return effects(cloud.getBasePotionData(), cloud.getCustomEffects());
}
 
源代码7 项目: Kettle   文件: LingeringPotionSplashEvent.java
/**
 * Gets the AreaEffectCloud spawned
 *
 * @return The spawned AreaEffectCloud
 */
public AreaEffectCloud getAreaEffectCloud() {
    return entity;
}
 
 类所在包
 类方法
 同包方法