1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Get $value ?

Discussion in 'Development' started by GOdly, Jan 8, 2017.

  1. applqpak

    applqpak Spider Jockey

    Messages:
    27
    GitHub:
    applqpak
    PHP:
    public function onCommand(CommandSender $senderCommand $cmd$label, array $args)
    {
      switch(
    strtolower($cmd->getName()))
      {
        case 
    'command':
          
    $arg strtolower(array_shift($args));
          
    $cfg->set('arg'$arg);//where $cfg is an instance of Config
          
    $cfg->save();
        break;

        case 
    'command2':
          
    $sender->sendMessage($cfg->get('arg'));
        break;
      }
    }
    I don't understand what you mean, but here's something.
     
    InspectorGadget likes this.
  2. applqpak

    applqpak Spider Jockey

    Messages:
    27
    GitHub:
    applqpak
    I hope you realise $cmd isn't an array.....
     
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    so
    giftcode.yml
    "code"
    -(cmds to exe)
    data.yml
    "codename"
    - users that used it
     
  4. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    Awesome! One question:
    - Does that code work like "/tell" also?
    EG: /tell IG Hi how are you?
     
  5. Aviv

    Aviv Baby Zombie

    Messages:
    156
    search it:
    PHP:
    if(array_search("args"$config->getAll()["Example"])){
    // then to get it
    $config->getAll()["Example"][array_search("args"$config->getAll()["Example"])];
    }
    remove it:
    PHP:
    $array $config->getNested("Example");
    unset(
    $array["args"]);
    $config->setNested("Example"$array);
    $config->save();
    add it:
    PHP:
    $array $config->getNested("Example");
    array_push($array"args");
    $config->setNested("Example"$array);
    $config->save();
     
    applqpak likes this.
  6. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    It was later than I usually stay up.. Sorry..
     
    applqpak likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.