RGB or Hex Color Codes from Config

Discussion in 'Plugin Development' started by MasterDoctor, Jan 10, 2016.

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

    MasterDoctor

    I have been hunting around for the past 30 minutes and I am unable to find anything on how to get an RGB or Hex color code from my config, Any ideas?
     
  2. Offline

    Xerox262

    Can you explain why you're trying to get these colors?

    For RGB all you really need to do is save three ints, then load them.
    And for Hex it's just a string without the #
     
  3. Offline

    MasterDoctor

    I thought so, its for armor color.
    I tried the string for hex but how am I actually meant to set that as an armor color?
     
  4. Offline

    Xerox262

    Well you can set the Armor color with

    LeatherArmorMeta#setColor(Color);
    And you can get a color from rgb with
    Color.fromRGB(int, int, int);
    And you can get the int of a hex string with
    Integer.parseInt(String)

    So get the int of the red, green and blue then get the color from it and set the armor as such. Remember to only check the first two characters, then the second two and then third, otherwise the int will be out of it's bounds.
     
  5. Offline

    MasterDoctor

    Ok
     
Thread Status:
Not open for further replies.

Share This Page