Firework meta doesnt work

Discussion in 'Plugin Development' started by william9518, Jan 11, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    william9518

    I tried this:
    Code:
    public ItemStack addFireworkEffect(ItemStack item, boolean hasFlicker, boolean hasTrail, Color color, Color fadeColor, FireworkEffect.Type type){
          FireworkMeta meta = (FireworkMeta)item.getItemMeta();
          FireworkEffect.builder().flicker(hasFlicker);
          FireworkEffect.builder().trail(hasTrail);
          FireworkEffect.builder().withColor(color);
          FireworkEffect.builder().withFade(color);
          FireworkEffect.builder().with(type);
          meta.addEffect(FireworkEffect.builder().build());
          return item;
      }
    and stacktrace returned at the line where it said
    FireworkMeta meta = (FireworkMeta)item.getItemMeta();
    cause by java.lang.ClassCastException.
    Any way to fix?
     
  2. Offline

    ZeusAllMighty11 Retired Staff

    You have to set the meta at the end.

    item.setMeta(meta);
     
  3. Offline

    william9518

    nope, same error
     
Thread Status:
Not open for further replies.

Share This Page