Insert a FireworkEffect.Builder in a FireworkMeta

Discussion in 'Spigot Plugin Development' started by iAmGio, May 11, 2016.

  1. Hi!
    How can I insert a FireworkEffect.Builder in a FirewokMeta?

    Code (Java):
        public ItemStack firework = new ItemStack(Material.FIREWORK,1);
        public FireworkMeta fireworkMeta = (FireworkMeta) firework.getItemMeta();

    FireworkEffect.Builder creeper = FireworkEffect.builder().with(Type.CREEPER);

    Sorry for my english, I'm italian :)
  2. Code (Text):
            ItemStack firework = new ItemStack(Material.FIREWORK, 1);
            FireworkMeta fireworkMeta = (FireworkMeta) firework.getItemMeta();
            FireworkEffect effect = FireworkEffect.builder().with(Type.CREEPER).build();
    Get the ItemStack then the ItemMeta, then call FireworkEffect.builder() and then when you finish modifying the effect you'll have to do .build() to convert it to a FireworkEffect, you'll add the effect to the ItemMeta and finally set the ItemMeta.
    Btw, I love Italian pizza :D
    • Like Like x 1
  3. Thank you!
    • Friendly Friendly x 1