Package org.bukkit.inventory.meta

Examples of org.bukkit.inventory.meta.FireworkMeta


      Method d0 = getMethod(loc.getWorld().getClass(), "getHandle");
      Method d2 = getMethod(fw.getClass(), "getHandle");
      Object o3 = d0.invoke(loc.getWorld(), (Object[]) null);
      Object o4 = d2.invoke(fw, (Object[]) null);
      Method d1 = getMethod(o3.getClass(), "broadcastEntityEffect");
      FireworkMeta data = fw.getFireworkMeta();
      data.addEffect(FireworkEffect
          .builder()
          .with(FireworkEffect.Type.values()[gen
              .nextInt(FireworkEffect.Type.values().length)])
          .flicker(gen.nextBoolean())
          .trail(gen.nextBoolean())
View Full Code Here


                             (trail ? aH.debugObj("trail", trail) : "") +
                             aH.debugObj("primary colors", primary.toString()) +
                             (fade != null ? aH.debugObj("fade colors", fade.toString()) : ""));

        Firework firework = location.getWorld().spawn(location, Firework.class);
        FireworkMeta fireworkMeta = firework.getFireworkMeta();
        fireworkMeta.setPower(power.asInt());

        Builder fireworkBuilder = FireworkEffect.builder();
        fireworkBuilder.with(FireworkEffect.Type.valueOf(type.asString().toUpperCase()));

                          fireworkBuilder.withColor(Conversion.convertColors(primary));
        if (fade != null) fireworkBuilder.withFade(Conversion.convertColors(fade));
        if (flicker)      fireworkBuilder.withFlicker();
        if (trail)        fireworkBuilder.withTrail();

        fireworkMeta.addEffects(fireworkBuilder.build());
        firework.setFireworkMeta(fireworkMeta);
    }
View Full Code Here

        Type fireworkType = Type.values()[Misc.getRandom().nextInt(Type.values().length)];
        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 location = player.getLocation();
        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

                        if(effects.containsKey(line.replace("launch ", ""))) {

                            if(!location.getWorld().isChunkLoaded(location.getBlockX() >> 4, location.getBlockZ() >> 4))
                                continue;
                            final Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
                            FireworkMeta meta = firework.getFireworkMeta();
                            for(FireworkEffect effect : effects.get(line.replace("launch ", "")))
                                meta.addEffect(effect);
                            meta.setPower((int) duration * 2);
                            firework.setFireworkMeta(meta);
                            if(preciseDuration)
                                Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), new Runnable() {
                                    @Override
                                    public void run () {
View Full Code Here

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

                            Firework firework = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
                            FireworkMeta meta = firework.getFireworkMeta();
                            meta.addEffect(effect);
                            meta.setPower((int) duration * 2);
                            firework.setFireworkMeta(meta);
                        } catch (Exception e) {
                            CraftBookPlugin.logger().severe("Error occured while doing: " + errorLocation + ". Whilst reading line " + position + " of the firework file " + showName + "!");
                            BukkitUtil.printStacktrace(e);
                        }
View Full Code Here

                        int value = Integer.parseInt(enchant[1]);
                        emeta.addStoredEnchant(enchantenum, value, true);
                    }
                }
            }else if(ismeta instanceof FireworkMeta) {
                FireworkMeta fmmeta = (FireworkMeta) ismeta;
                for(int i = 0; (data = itemdata.get("F" + String.valueOf(i))) != null; i++) {
                    String[] fedata = data.split("\\+");
                    Type effect = FireworkEffect.Type.valueOf(fedata[0]);
                    Builder ef = FireworkEffect.builder();
                    ef.with(effect);
                    if(effect != null) {
                        String[] colors = fedata[1].split("-");
                        for(String color : colors) {
                            try {
                                ef.withColor(Color.fromRGB(Integer.parseInt(color)));
                            }catch (Exception e) {
                               
                            }
                        }
                        String[] fadecolors = fedata[2].split("-");
                        for(String fadecolor : fadecolors) {
                            try {
                                ef.withFade(Color.fromRGB(Integer.parseInt(fadecolor)));
                            }catch (Exception e) {
                               
                            }
                        }
                        ef.flicker(Boolean.parseBoolean(fedata[3]));
                        ef.trail(Boolean.parseBoolean(fedata[4]));
                        fmmeta.addEffect(ef.build());
                    }
                }
                data = itemdata.get("G");
                try {
                    fmmeta.setPower(Integer.parseInt(data));
                }catch (Exception e) {
                   
                }
            }else if(ismeta instanceof FireworkEffectMeta) {
                data = itemdata.get("F0");
View Full Code Here

TOP

Related Classes of org.bukkit.inventory.meta.FireworkMeta

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.