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

sub-command and array

Comments in 'Plugin Development' started by Seetch, Jul 19, 2015.

  1. Seetch
    Offline

    Seetch New Member

    Joined:
    Feb 5, 2015
    Posts:
    22
    Minecraft User:
    Seetch
    1. How to create sub-command ?
    2. Hot to add items in config is array ?
  2. Seetch
    Offline

    Seetch New Member

    Joined:
    Feb 5, 2015
    Posts:
    22
    Minecraft User:
    Seetch
    I'm create kits plugin and me help!
  3. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    1. Command is /something. $args is array of arguments: /something a b c => $args = array("a", "b", "c") or /something b k3e => $args = array("b","k3e"). "b" is $args[0], "k3e" is $args[1]. To get if there is something, use isset: if (isset($args[2]){
    -> returns true if there are 2/more than two arguments. For use it in kits, I suggest:
    PHP:
    if ($command->getName() == "kit"){
    if (isset(
    $args[0]) and !(isset($args[1]))){
    ...
    }
    return 
    false;
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Y u hate argument 2 o_O
    mamayadesu likes this.

Share This Page

Advertisement