Having multiple items in config

Discussion in 'Plugin Development' started by Rungario, Jun 2, 2013.

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

    Rungario

    I've ran into a problem with the config of my plugin.

    What the plugin does is it lets you use a certain amount of one item (designated as an ingredient) to create another item (for our purpose, alcohol) by right clicking a cauldron with the ingredients in hand. When the alcohol is consumed, it gives you various effects to emulate you being drunk.

    The issue I'm running into is I'm trying to make it so that the server owner can define multiple types of alcohol in the config, however I can only get my plugin to recognize one type of alcohol.

    Here is my main class code:

    http://pastebin.com/n0w01qrL

    Here is my config:

    http://pastebin.com/yS5UHWHG

    Any ideas?
     
  2. Offline

    mrCookieSlime

    Rungario

    You simply have to split it in two sections like:

    Code:
    Beer:
      alcohol-name: Beer
      ...
    Tequila:
      alcohol-name: Tequila
      ...
    
    But you also have to check exactly for this path like:
    Code:
    this.getConfig().getString("Beer.alcohol-name");
     
  3. Offline

    Rungario

    mrCookieSlime

    But how would I make it so that users themselves could go in and add additional types of alcohol and have the plugin automatically recognize them?

    Bump?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  4. Offline

    bfgbfggf

    Hyymmm you can create array list in config.
    OR
    create config like:
    Code:
    1:
      DrinkType Beer
      DrinkName: blabla
      Blabla: bla bla
    2:
      DrinkType Beer
      DrinkName: blabla
      Blabla: bla bla
    But arraylist will be better.
     
Thread Status:
Not open for further replies.

Share This Page