当前位置: 首页>>代码示例>>Java>>正文


Java FireworkEffect.Type方法代码示例

本文整理汇总了Java中org.bukkit.FireworkEffect.Type方法的典型用法代码示例。如果您正苦于以下问题:Java FireworkEffect.Type方法的具体用法?Java FireworkEffect.Type怎么用?Java FireworkEffect.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.FireworkEffect的用法示例。


在下文中一共展示了FireworkEffect.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static FireworkEffect parse(Config config) {
    boolean flicker = config.getBool("flicker", false);
    boolean trail = config.getBool("trail", false);
    List<Color> colors = ((Collection<String>)config.getCollection("colors", Collections.emptyList()))
            .stream()
            .map(ConfigUtil::parseColor)
            .collect(Collectors.toList());
    List<Color> fadeColors = ((Collection<String>)config.getCollection("fade-colors", Collections.emptyList()))
            .stream()
            .map(ConfigUtil::parseColor)
            .collect(Collectors.toList());
    FireworkEffect.Type type = parseFireworkEffectType(config.getString("type", FireworkEffect.Type.BALL.name()));
    return FireworkEffect.builder()
            .flicker(flicker)
            .trail(trail)
            .withColor(colors)
            .withFade(fadeColors)
            .with(type)
            .build();
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:22,代码来源:FireworkChargeCustomItem.java

示例2: playFirework

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public void playFirework(Player p, Location loc, Color color1, Color color2, FireworkEffect.Type type) {
	loc.add(0.5, 1, 0.5);
	Firework fw = p.getWorld().spawn(loc, Firework.class);
	FireworkMeta fwmeta = ((org.bukkit.entity.Firework) fw).getFireworkMeta();
	FireworkEffect.Builder builder = FireworkEffect.builder();

	builder.withFlicker();
	builder.withFade(color2);
	builder.withColor(color1);
	builder.with(type);
	fwmeta.clearEffects();
	Field f;
	try {
		f = fwmeta.getClass().getDeclaredField("power");
		f.setAccessible(true);
		f.set(fwmeta, -1);
	} catch (Exception e) {
		return;
	}
	fwmeta.addEffect(builder.build());
	fw.setFireworkMeta(fwmeta);
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:23,代码来源:Utils.java

示例3: randomType

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
private FireworkEffect.Type randomType() {
	int i = random.nextInt(5) + 1;
	FireworkEffect.Type type = null;
	if (i == 1) {
		type = FireworkEffect.Type.BALL;
	} else if (i == 2) {
		type = FireworkEffect.Type.BALL_LARGE;
	} else if (i == 3) {
		type = FireworkEffect.Type.BURST;
	} else if (i == 4) {
		type = FireworkEffect.Type.CREEPER;
	} else if (i == 5) {
		type = FireworkEffect.Type.STAR;
	}
	return type;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:17,代码来源:EffFirework.java

示例4: parseFireworkEffectType

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static FireworkEffect.Type parseFireworkEffectType(String s) {
    if (s == null)
        throw new InvalidConfigException("Missing firework effect type!");
    try {
        return FireworkEffect.Type.valueOf(s.replace(' ', '_').toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException e) {
        throw new InvalidConfigException("Cannot find firework effect type: \"" + s + "\"");
    }
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:10,代码来源:ConfigUtil.java

示例5: onProjectileHit

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
@EventHandler
public void onProjectileHit(ProjectileHitEvent e) throws Exception {
	if (fireballList.contains(e.getEntity().getUniqueId())) {
		Location fireballHitLocation = e.getEntity().getLocation();
		if(!KingdomFactionsPlugin.getInstance().getDataManager().getBoolean("Test.enabled")) {
		fireballHitLocation.getWorld().createExplosion(fireballHitLocation.getX(), fireballHitLocation.getY(),
				fireballHitLocation.getZ(), 4, true, true);
		} else {
			fireballHitLocation.getWorld().createExplosion(fireballHitLocation.getX(), fireballHitLocation.getY(),
					fireballHitLocation.getZ(), 4, true, false);
		}

		FireworkEffect.Type type = FireworkEffect.Type.BALL_LARGE;
		Color c1 = Color.ORANGE;
		Color c2 = Color.RED;

		FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(c1).withFade(c2).with(type)
				.trail(true).build();

		FireworkEffectPlayer fireworkPlayer = new FireworkEffectPlayer();

		fireworkPlayer.playFirework(fireballHitLocation.getWorld(), fireballHitLocation, effect);
		for (Entity ent : Utils.getInstance().getNearbyEntities(fireballHitLocation, 5)) {
			if ((ent instanceof LivingEntity)) {
				ent.setFireTicks(ent.getFireTicks() + 60);
			}
		}
		fireballList.remove(e.getEntity().getUniqueId());
	}
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:31,代码来源:Comet.java

示例6: spawnRandom

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static Firework spawnRandom(Location location) {
    Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
    FireworkMeta meta = firework.getFireworkMeta();
    Random r = new Random();
    int rt = r.nextInt(4) + 1;
    FireworkEffect.Type type = FireworkEffect.Type.BALL;
    if (rt == 1) {
        type = FireworkEffect.Type.BALL;
    }
    if (rt == 2) {
        type = FireworkEffect.Type.BALL_LARGE;
    }
    if (rt == 3) {
        type = FireworkEffect.Type.BURST;
    }
    if (rt == 4) {
        type = FireworkEffect.Type.CREEPER;
    }
    if (rt == 5) {
        type = FireworkEffect.Type.STAR;
    }
    FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(randomColor()).withFade(randomColor()).with(type).trail(r.nextBoolean()).build();
    meta.addEffect(effect);
    int rp = r.nextInt(2) + 1;
    meta.setPower(rp);
    firework.setFireworkMeta(meta);
    return firework;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:29,代码来源:FireworkUtil.java

示例7: getOriginal

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
@Override
public Object getOriginal() {
    FireworkEffect.Type t =  FireworkEffect.Type.BALL;
    try{
        t = FireworkEffect.Type.valueOf(fireworkType);
    }catch (Exception ex){}
    if(((List<Color>)main.getOriginal()).size() >= 1)
     return FireworkEffect.builder().with(t).flicker(isFlicker).trail(trail).withColor((List<Color>)main.getOriginal()).withFade((List<Color>)fade.getOriginal()).build();
    return null;
}
 
开发者ID:DevCrafters,项目名称:SaveableSerializing,代码行数:11,代码来源:FireworkEffects.java

示例8: spawnRandomFirework

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
/**
 * Spawn a firework with a randomized meta at the location.
 * @param loc The location to spawn at.
 */
public static Firework spawnRandomFirework(Location loc) {
    Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
    FireworkMeta fwm = fw.getFireworkMeta();
    FireworkEffect.Type type = FireworkEffect.Type.values()[(int) (Math.random() * FireworkEffect.Type.values().length - 1)];
    Color c1 = Color.fromRGB(RMath.randInt(0, 255), RMath.randInt(0, 255), RMath.randInt(0, 255));
    Color c2 = Color.fromRGB(RMath.randInt(0, 255), RMath.randInt(0, 255), RMath.randInt(0, 255));
    FireworkEffect effect = FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(c1).withFade(c2).with(type).trail(Math.random() > 0.5).build();
    fwm.addEffect(effect);
    fwm.setPower(RMath.randInt(1, 2));
    fw.setFireworkMeta(fwm);
    return fw;
}
 
开发者ID:edasaki,项目名称:ZentrelaCore,代码行数:17,代码来源:RParticles.java

示例9: shootFirework

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static Firework shootFirework(Location loc, String world){
    //Spawn the Firework, get the FireworkMeta.
    final Firework fw = (Firework) Bukkit.getWorld(world).spawnEntity(loc, EntityType.FIREWORK);
    FireworkMeta fwm = fw.getFireworkMeta();

    //Our random generator
    Random r = new Random();

    //Get the type
    int rt = r.nextInt(4) + 1;
    FireworkEffect.Type type = FireworkEffect.Type.BALL;
    if (rt == 1) type = FireworkEffect.Type.BALL;
    if (rt == 2) type = FireworkEffect.Type.BURST;
    if (rt == 3) type = FireworkEffect.Type.STAR;
    if (rt == 4) type = FireworkEffect.Type.CREEPER;
    if (rt == 5) type = FireworkEffect.Type.BALL_LARGE;

    //Get our random colours
    int r1i = r.nextInt(17) + 1;
    int r2i = r.nextInt(17) + 1;
    Color c1 = getColor(r1i);
    Color c2 = getColor(r2i);

    //Create our effect with this
    FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(c1).withFade(c2).with(type).trail(true).build();

    //Then apply the effect to the meta
    fwm.addEffect(effect);

    //Generate some random power and set it
    int rp = r.nextInt(2) + 1;
    fwm.setPower(rp);

    //Then apply this to our rocket
    fw.setFireworkMeta(fwm);
    return fw;
}
 
开发者ID:Cooltimmetje,项目名称:PretparkCore,代码行数:38,代码来源:MiscUtils.java

示例10: shootFirework

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static Firework shootFirework(Location loc, String world){
    //Spawn the Firework, get the FireworkMeta.
    Firework fw = (Firework) Bukkit.getWorld(world).spawnEntity(loc, EntityType.FIREWORK);
    FireworkMeta fwm = fw.getFireworkMeta();

    //Our random generator
    Random r = new Random();

    //Get the type
    int rt = r.nextInt(4) + 1;
    FireworkEffect.Type type = FireworkEffect.Type.BALL;
    if (rt == 1) type = FireworkEffect.Type.BALL;
    if (rt == 2) type = FireworkEffect.Type.BURST;
    if (rt == 3) type = FireworkEffect.Type.STAR;
    if (rt == 4) type = FireworkEffect.Type.CREEPER;
    if (rt == 5) type = FireworkEffect.Type.BALL_LARGE;

    //Get our random colours
    int r1i = r.nextInt(17) + 1;
    int r2i = r.nextInt(17) + 1;
    Color c1 = getColor(r1i);
    Color c2 = getColor(r2i);

    //Create our effect with this
    FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(c1).withFade(c2).with(type).trail(true).build();

    //Then apply the effect to the meta
    fwm.addEffect(effect);

    //Generate some random power and set it
    int rp = r.nextInt(2) + 1;
    fwm.setPower(rp);

    //Then apply this to our rocket
    fw.setFireworkMeta(fwm);
    return fw;
}
 
开发者ID:Cooltimmetje,项目名称:PretparkCore,代码行数:38,代码来源:GadgetMethods.java

示例11: run

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
@Override
public void run()
{
    if (this.time < 20)
    {
        Firework fw = (Firework) player.getWorld().spawnEntity(player.getPlayer().getLocation(), EntityType.FIREWORK);
        FireworkMeta fwm = fw.getFireworkMeta();

        Random r = new Random();
        int rt = r.nextInt(4) + 1;

        FireworkEffect.Type type = FireworkEffect.Type.BALL;

        if (rt == 1)
            type = FireworkEffect.Type.BALL;
        else if (rt == 2)
            type = FireworkEffect.Type.BALL_LARGE;
        else if (rt == 3)
            type = FireworkEffect.Type.BURST;
        else if (rt == 4)
            type = FireworkEffect.Type.CREEPER;
        else if (rt == 5)
            type = FireworkEffect.Type.STAR;

        int r1i = r.nextInt(15) + 1;
        int r2i = r.nextInt(15) + 1;

        Color c1 = ColorUtils.getColor(r1i);
        Color c2 = ColorUtils.getColor(r2i);

        FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
        fwm.addEffect(effect);

        int rp = r.nextInt(2) + 1;
        fwm.setPower(rp);

        fw.setFireworkMeta(fwm);

        this.time++;
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:42,代码来源:WinEffect.java

示例12: getFireworkEffect

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public FireworkEffect getFireworkEffect(Color one, Color two, Color three, Color four, Color five, FireworkEffect.Type type)
{
  return FireworkEffect.builder().flicker(false).withColor(new Color[] { one, two, three, four }).withFade(five).with(type).trail(true).build();
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:5,代码来源:NMSHandler.java

示例13: spawnFirework

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static Firework spawnFirework(Location l, FireworkEffect.Type type, Color color, Color fade, int power){
    return spawnFirework(l, type, color, fade, true, true, power);
}
 
开发者ID:cadox8,项目名称:PA,代码行数:4,代码来源:FireworkAPI.java

示例14: get

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static FireworkEffect.Type get(String string) {
    return instance()._get(string);
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:4,代码来源:FireworkEffects.java

示例15: getName

import org.bukkit.FireworkEffect; //导入方法依赖的package包/类
public static String getName(FireworkEffect.Type key) {
    return instance()._getName(key);
}
 
开发者ID:GameBoxx,项目名称:GameBoxx,代码行数:4,代码来源:FireworkEffects.java


注:本文中的org.bukkit.FireworkEffect.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。