Solved Getting Enum Constants from Color Enum

Discussion in 'Plugin Development' started by Freelix2000, Sep 15, 2014.

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

    Freelix2000

    I am trying to make a plugin that will use the Color object to color leather armor, and I am trying to get all Enum constants from the Color enum to match colors and strings, add a leather chestplate of each color to an inventory, etc. For most enums I would use the "values()" method, but it seems Color does not have one. I have tried using "Color.class.getEnumConstants()" and a few other things related to getting enum constants from the class, but that always seems to throw a NullPointerException.
     
  2. Offline

    xTigerRebornx

    Freelix2000 Color is not an enum, you could use reflection and loop through all static fields if you wanted, or simply just declare a Array/Collection/Whatever and add them yourself
     
  3. Offline

    Freelix2000

    xTigerRebornx
    I'm not sure why I didn't think until about midnight last night to simply make a static Color array and add all the colors to it... =P Thanks for the reply.
     
Thread Status:
Not open for further replies.

Share This Page