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

Unset something in config

Comments in 'Plugin Development' started by BlubberBoy333, Jun 18, 2016.

  1. BlubberBoy333
    Offline

    BlubberBoy333 Active Member

    Joined:
    Aug 31, 2014
    Posts:
    177
    Minecraft User:
    Blubberboy333
    If I had a config containing an array, how could I remove just one value from the array?
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    PHP:
    $array $config->get("array");
    unset(
    $array[array_search("value"$array)]);
    $config->set("array"$array);
    $config->save();
    You may need to adapt the saving/reading techniques with an array encoding method (ex. json_encode() & json_decode()).
    applqpak likes this.

Share This Page

Advertisement