Looping

Discussion in 'Plugin Development' started by TheDiamond06, Apr 26, 2015.

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

    TheDiamond06

    So essentials, in their config has it so there is a string list with all the kits.

    I know I can loop through a variable in config, but essentials has it with cooldowns, enchantments, names, and lores.

    How would I loop through for the lores, enchantments, cooldowns, and names.
     
  2. Offline

    meguy26

    @TheDiamond06
    in your own config or stealing data from essentials config?
     
  3. Offline

    sgavster

    Well, if it's your config:

    make a for loop, getting the String.

    use String#split(String). So if you had this:

    DIAMOND_SWORD:Hello_There:10:I_Am_A_Sword_Made_Of_Diamonds

    You would use String.split(":");

    so, String[0] would be DIAMOND_SWORD, String[1] would be Hello_There, and so on.
     
  4. Offline

    1Rogue

    Or use serialization, which is a better solution
     
    Konato_K likes this.
  5. Offline

    TheDiamond06

    @1Rogue
    Explain serialization.
     
  6. Offline

    mythbusterma

    @TheDiamond06

    He's talking about using ConfigurationSerializable, which, by defining the methods specified by the API, allow you to store and retrieve Objects reliably from YAML files.
     
    1Rogue likes this.
Thread Status:
Not open for further replies.

Share This Page