Get list where string is in?

Discussion in 'Plugin Development' started by iAmGuus, Sep 19, 2014.

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

    iAmGuus

    Sup guys,
    I got an question for my plugin im coding atm,
    I got an idea about saving the players name in a list in a config,
    But how would i get the stringlist where he is in?
    So for example:
    Code:
    this:
      is:
        a:
          test:
            - "test"
            - "xGuus"
            - "Notch"
            - "Dinnerbone"
    So i want to get the name of the list where, for example, the string xGuus is in.
    How would i do this?

    Regards,
    iAmGuus
     
  2. Offline

    blablubbabc

    You can get the list of strings in this example via:
    config.getStringList("this.is.a.test");
    (assuming that you are using the default path separator)
     
  3. Offline

    iAmGuus

    Okay, but how would i get the name of the string he is in?
     
  4. Offline

    fireblast709

    iAmGuus loop over all lists and check each of them.
     
  5. Offline

    mrgreen33gamer

    Try putting them into a HashMap. Save them. Load them. Then read them using the HashMap instead. Just my idea.
     
  6. Offline

    iAmGuus

    fireblast709, how would i get all the stringlists in a config? I am gonna look in the javadocs in a sec, so thanks alot for your answers already!

    mrgreen33gamer, i like your idea, and you mean by loading making this :

    HashMap<String, String> kits = get.path.to.config

    ?
     
  7. Offline

    fireblast709

    iAmGuus well that depends on the actual config
     
  8. Offline

    iAmGuus

    fireblast709 i will give the config etc tomorrow at my time,
    Its here 22:00
     
Thread Status:
Not open for further replies.

Share This Page