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

How do I create a command I wanted it to have more than 1 argument

Discussion in 'Plugin Help' started by coldGRINGO, Jan 20, 2022.

  1. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    I need for make my plugin of bedwars example of commands : /bedwars setup red generator, /bedwars setup blue generator, /bedwars setup emerald. but the plugin only executing "generator red" and "spawn red"
     

    Attached Files:

  2. NohjNivek

    NohjNivek Spider

    Messages:
    9
    just put the coords of the generators in the settings file of your bed wars map
     
    coldGRINGO likes this.
  3. NohjNivek

    NohjNivek Spider

    Messages:
    9
    wait, why do you have files for blue, red, emerald, and diamond in your data folder?
     
    coldGRINGO likes this.
  4. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    So I don't confuse things with each other and overwrite data
     
  5. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    So I don't confuse things with each other and overwrite data
     
  6. NohjNivek

    NohjNivek Spider

    Messages:
    9
    U could just put it in 1 file:
    PHP:
    new Config($this->getDataFolder() . "generators.yml"CONFIG::YAML, [
        
    "iron" => [],
        
    "gold" => [],
        
    "diamond" => [],
        
    "emerald" => []
    ]);
     
  7. NohjNivek

    NohjNivek Spider

    Messages:
    9
    you just need to make a function that puts the coords of the player when they use "add generator $type" or some other command like:
    PHP:
    array_push($this->generators[$type], [$world$x$y$z]);
     
  8. NohjNivek

    NohjNivek Spider

    Messages:
    9
    then just code a sub command to call that function (sry if my english is bad :v )
     
  9. NohjNivek

    NohjNivek Spider

    Messages:
    9
    btw check if the world exists/loaded because it might cause a problem
     
  10. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    I am using translate, but How do I create a command I wanted it to have more than 1 argument
    Example : /bedwars setup red generaror ironu
     
  11. NohjNivek

    NohjNivek Spider

    Messages:
    9
    /bedwars setup red generaror iron {anotha_one}
    this?
     
    coldGRINGO likes this.
  12. coldGRINGO

    coldGRINGO Spider

    Messages:
    9
    GitHub:
    coldgringo
    Yes
     
  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.