Solved set potions with specific colors with own effects

Discussion in 'Plugin Development' started by Staco, May 8, 2017.

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

    Staco

    Hi, I've made a plugin who give's players custom potions. I got serveral effects at one potion and so on but theres a problem. How I can chose the color of a potion?
    I tried several things. Its possible to use

    Potion potion = new Potion(PotionType.POISON);

    to get a green potion, but if I do that, my potion will have a normal POISON-Effect, but I want only my own effects on this potion. I tried the following one

    PotionMeta meta = (PotionMeta) i.getItemMeta();
    meta.removeCustomEffect(PotionType.POISON.getEffectType());

    but nothing changes.
    I tried to write it with a demage value, Im not sure if this could help but I failed to try it.

    Please help me, its possible to change the color but I want only my own effects!
     
  2. Offline

    Staco

    ItemStack i = pot.toItemStack(5);
    PotionMeta meta = (PotionMeta) i.getItemMeta();
    meta.setColor(Color.FUCHSIA);
    i.setItemMeta(meta);
    p.getInventory().addItem(i);
     
Thread Status:
Not open for further replies.

Share This Page