Package org.bukkit

Examples of org.bukkit.FireworkEffect


                            new Element(data[5]).asInt()));
                    builder.withFade(Color.fromRGB(new Element(data[6]).asInt(),
                            new Element(data[7]).asInt(),
                            new Element(data[8]).asInt()));

                    FireworkEffect built = builder.build();
                    if (meta instanceof FireworkMeta) {
                        ((FireworkMeta) meta).addEffect(built);
                    }
                    else {
                        ((FireworkEffectMeta) meta).setEffect(built);
View Full Code Here


        double varX = Misc.getRandom().nextGaussian() * 3;
        double varZ = Misc.getRandom().nextGaussian() * 3;

        Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation().add(varX, 0, varZ), EntityType.FIREWORK);
        FireworkMeta fireworkmeta = fireworks.getFireworkMeta();
        FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorChoose()).withFade(colorChoose()).with(fireworkType).trail(Misc.getRandom().nextBoolean()).build();
        fireworkmeta.addEffect(effect);
        fireworkmeta.setPower(power);
        fireworks.setFireworkMeta(fireworkmeta);
    }
View Full Code Here

        location.setY(location.getY() + (player.isInsideVehicle() ? 1.0 : -1.0));
        location.setPitch(-90);

        Firework firework = (Firework) player.getWorld().spawnEntity(location, EntityType.FIREWORK);
        FireworkMeta fireworkMeta = firework.getFireworkMeta();
        FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(color).with((Config.getInstance().getLargeFireworks() ? Type.BALL_LARGE : Type.BALL)).trail(true).build();
        fireworkMeta.addEffect(effect);
        fireworkMeta.addEffect(effect);
        fireworkMeta.setPower(0);
        firework.setFireworkMeta(fireworkMeta);
    }
View Full Code Here

                                    trail = true;
                            }

                            errorLocation = "Creation";

                            FireworkEffect effect = FireworkEffect.builder().with(type).withColor(colour).withFade(fade).flicker(flicker).trail(trail).build();

                            if(!location.getWorld().isChunkLoaded(location.getBlockX() >> 4, location.getBlockZ() >> 4))
                                continue;

                            Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
View Full Code Here

    List<FireworkEffect> ret = new ArrayList<FireworkEffect>();
   
    Iterator<JsonElement> iter = array.iterator();
    while(iter.hasNext())
    {
      FireworkEffect fe = FireworkEffectAdapter.fromJson(iter.next());
      if (fe == null) continue;
      ret.add(fe);
    }
   
    return ret;
View Full Code Here

    if (element != null)
    {
      type = Type.valueOf(element.getAsString());
    }
   
    FireworkEffect ret = FireworkEffect.builder()
    .flicker(flicker)
    .trail(trail)
    .withColor(colors)
    .withFade(fadeColors)
    .with(type)
View Full Code Here

                smeta.append("F" + effect.getType().name() + "+" + colorstring.toString() + "+" + fadecolorstring.toString() + "+" +
                        effect.hasFlicker() + "+" + effect.hasTrail() + "#");
            }
            smeta.append("G" + Integer.toString(((FireworkMeta) meta).getPower()) + "#");
        }else if(meta instanceof FireworkEffectMeta) {
            FireworkEffect effect = ((FireworkEffectMeta) meta).getEffect();
            if(effect != null) {
                List<Color> colors = effect.getColors();
                List<Color> fadecolors = effect.getFadeColors();
                StringBuilder colorstring = new StringBuilder();
                for(Color color : colors) {
                    if(colorstring.length() > 0) {
                        colorstring.append("-");
                    }
                    colorstring.append(Integer.toString(color.asRGB()));
                }
                StringBuilder fadecolorstring = new StringBuilder();
                for(Color color : fadecolors) {
                    if(fadecolorstring.length() > 0) {
                        fadecolorstring.append("-");
                    }
                    fadecolorstring.append(Integer.toString(color.asRGB()));
                }
                smeta.append("F" + effect.getType().name() + "+" + colorstring.toString() + "+" + fadecolorstring.toString() + "+" +
                        effect.hasFlicker() + "+" + effect.hasTrail() + "#");
            }
        }
        if(meta instanceof Repairable) {
            Repairable rmeta = (Repairable) meta;
            smeta.append("R" + rmeta.getRepairCost());
View Full Code Here

TOP

Related Classes of org.bukkit.FireworkEffect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.