Solved Getting values from Config

Discussion in 'Plugin Development' started by PDKnight, Aug 13, 2015.

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

    PDKnight

    Hi Bukkit again! :D
    Today I'm working on another plugin and I don't really know, how to set up config and get settings from it like shown below:
    Code:
    group:
    - first: value
      another_setting: value2
      - 'first string of list'
    - second: value3
      another_setting: value4
      - 'second'
      - 'third!'
    Am I able to do it this way? Any help will be appreciated :)

    Cheers,
    PDKnight
     
  2. Online

    timtower Administrator Administrator Moderator

    @PDKnight That exact config won't be possible.
    getConfig().get<string,int,float,long,nothing>(<path>)
    getConfig().set(<path>,<value>
     
  3. Offline

    HenkDeKipGaming

    well when you are saying:
    Code:
    - first: value
      another_setting: value2
    
    that is not possible, at least it's not recommended to use that xD
    you can't make a stringlist and then add a value to it.
    you can better do:
    Code:
    group:
      first: value
        another_setting:
          - first string of list
      second: value3
        another_setting:
          - second
          - third!
    
    that should work :)
     
  4. Offline

    PDKnight

  5. Offline

    HenkDeKipGaming

    can you explain?
     
  6. Online

    timtower Administrator Administrator Moderator

    @PDKnight Like this?
    Code:
    Something:
      Moresomething1: value
      Moresomething2: value2
    In that case: yes you can.
     
  7. Offline

    PDKnight

    @HenkDeKipGaming @timtower I mean something like this :) (I'm sorry, I can't explain it better :( )
    Code:
    group = array(
       (something:value, anothersetting: anothervalue, array('firstString', 'secondString')),
       (something:value, anothersetting: anothervalue, array('firstString', 'secondString'))
    )
    
     
  8. Offline

    HenkDeKipGaming

    @PDKnight or do you mean this:

    Code:
    Something:
      moresomething1: value
        - StringList1
        - blabla
      moresomething2:value
        - 3
    
    because you can't do this
     
  9. Offline

    PDKnight

    @HenkDeKipGaming Something like that, but I want moresomething1 (with stringList1 and blabla) and moresomething2 (with 3) to be part of an array, the group :/
     
  10. Offline

    HenkDeKipGaming

    I don't get why you want that?
    you make an array and you want to get a value from a string in an array... seems pointless to me.
    can you explain what you need?
    maybe there is an other way
     
  11. Offline

    PDKnight

    @HenkDeKipGaming Okay, I'm making a broadcast plugin with configurable messages (two big arrays) and settings with them :/ I don't know, is there a better way to get these settings of each message?
     
  12. Offline

    HenkDeKipGaming

    i think you shouldn't put them i an array then.
    your config may look like this then...
    Code:
    messages:
      M1: custom message 1
      M2: custom message 2
      M3: custom message 3
      Metc: etc.
    
     
  13. Offline

    PDKnight

  14. Offline

    HenkDeKipGaming

Thread Status:
Not open for further replies.

Share This Page