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

Yet another config.yml question

Comments in 'Plugin Development' started by minebuilder0110, Dec 28, 2015.

  1. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Hello, and I believe this is like 4th? thread about config. :p
    Code:
    randomtitle:
     somethingveryimportant:
      notthatimportantstuff: useless
     notuseful:
      noneedtolookatthis: nodont
    
    How would I code it so that it returns "somethingveryimportant"? I usually use getNested, and it doesn't seems to work in this kind of situation. It can only get strings like "useless" and "nodont" in this case. I know it returns an array because I tested it with is_array, so I tried:
    PHP:
    $array $this->config->getNested("randomtitle");
    $player->sendMessage($array[0]); //pretty sure I made few mistakes in this code since I just generated it right now
    It returned an error. :eek:
    Last edited: Dec 28, 2015
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    $player->sendMessage(array_keys($this->config->get("randomtitle"))[0]);
  3. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    What's even the point of that plugin?
  4. thebigsmileXD
    Offline

    thebigsmileXD Banned

    Joined:
    May 19, 2015
    Posts:
    845
    Plugins:
    1
    Minecraft User:
    XenialDan
    Maybe he's just learning coding, or he codes a plugin which he doesn't want to spoiler and now changed the text. Darth Vader

Share This Page

Advertisement