Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

{new api} how do configs work?

Comments in 'Plugin Development' started by Killman2, Jul 24, 2014.

  1. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    Hello! I want to ask how do configs work in the new api.

    Things I'd like to know:

    How to write the config (like $this->config->write…)

    How to create them

    How to get info from them (like $this->config->get…)

    Thank you!
  2. swagboy47
    Offline

    swagboy47 Active Member

    Joined:
    Jun 10, 2014
    Posts:
    445
    Minecraft User:
    swagking
    create config yaml : $this->Config = new Config($this->getDataFolder()."Config.yml", Config::YAML/type, array(bla bla ));
    get info : $this->Config->get("bla");
    edit them : $this->Config->set("bla", "bla");
  3. Killman2
    Offline

    Killman2 Active Member Plugin Developer

    Joined:
    May 5, 2014
    Posts:
    81
    Plugins:
    1
    Minecraft User:
    Killman2
    Thanks :)
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Don't $this->config. That field is occupied by the parent class. Consider using $this->saveDefaultConfig(), $this->reloadConfig() and $this->getConfig().

Share This Page

Advertisement