Solved Give custom colored items to a player

Discussion in 'Plugin Development' started by jonassvensson44, Jul 12, 2014.

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

    jonassvensson44

    Hello!

    Im new on coding so i need some help from you guys! :)

    My problem is that i have to create a variable like "noobGear" that contains some custom colored leather armor. And then i want to be available to call "noobGear" from where ever i want.

    So basically i want to give a player this "noobGear". So i get the player and then give him the whole set so i dont need to recode every single piece of the set.
     
  2. Put static fields at the top of your file.

    Code:java
    1. public static ItemStack noobGear_helm;
    2. public static ItemStack noobGear_chest;
    3. public static ItemStack noobGear_legs;
    4. public static ItemStack noobGear_boots;


    Then, when onEnable() is called, define them how you want, and then you can access them from anywhere
     
  3. Offline

    THEREDBARON24

    You have to use leatherarmormeta. Then use .setColor(Color.somethingHere); Not sure what you mean by constantly re-creating it. You can always create a set on enable and then store it somehow.
     
Thread Status:
Not open for further replies.

Share This Page