Some Config Help!

Discussion in 'Plugin Development' started by xxCoderForLifexx, Feb 7, 2013.

Thread Status:
Not open for further replies.
  1. How would I make a config file where you have to have the items inside the
    Code:
    ''
    Like would I still use
    Code:java
    1. plugin.getConfig().getString("");
     
  2. Your example or explanation are a little vague.
    Try again? :/
     
  3. Like in the config.yml like have the words inside
    Code:
    ''
     
  4. xxCoderForLifexx
    What do you mean? Why would the items need to be inside apostrophes?
     
  5. When you read the config.yml file you identify the key and then get the value of that key as a data type.
    E.g. number: 10 could be read as plugin.getConfig().getString("number"); or plugin.getConfig().getInt("number");

    In this example we'll look at getting a string:
    Code:
    important:
      string: "This is all a string I want to get"
    Code:java
    1. plugin.getConfig().getString("important.string");

    The speech marks are usually optional but sometimes they are required for special strings and I tend to 'String here' or "String here too" just to be safe.
    .getString("key") will work fine with "Test" or Test

    Warning: Formatting your config is essential. Do not use tabs, for each tab use two spaces. For every indented key this extends the keys name to be "one.two.three".
     
  6. Offline

    RealDope

    AFAIK you only need quotes or apostrophes if your string starts with a special character, (!@#$%^&* etc)
     
Thread Status:
Not open for further replies.

Share This Page