Configuration File help please! :D

Discussion in 'Plugin Development' started by Duuckky, May 16, 2014.

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

    Duuckky

    So, I have thisHashMap:
    Code:java
    1. public static HashMap<UUID, Integer> kills = new HashMap<>();

    and i'm trying to put it in a YAML file, I've looked on wikipedia, youtube, and through this forums and cannot figure this out. Please help! :D

    Thanks you ,

    Duckman.
     
  2. Offline

    caseif

    Store it under a section called "kills" as key-value pairs, so that it looks something like this:
    Code:
    kills:
        uuid1: 5
        uuid2: 2
        uuid3: 7
     
  3. Offline

    Duuckky

    Okay, thanks it's working now. :D
    But how would I load that back into the HashMap
     
  4. Offline

    coasterman10

    Use the getValues() method to get all the values in the "kills" configuration section, then iterate through all the entries and convert the key to a UUID from its string representation and the value to an Integer.
     
  5. Offline

    caseif

    Wait, I didn't know that method existed! That would have been so much easier than getKeys()...
     
Thread Status:
Not open for further replies.

Share This Page