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

Give the player the specified items when he executes the command

Comments in 'Plugin Development' started by GoldenSteveyt, Aug 14, 2015.

  1. GoldenSteveyt
    Offline

    GoldenSteveyt New Member

    Joined:
    Aug 5, 2015
    Posts:
    12
    Minecraft User:
    D4nl0g
    Hello Guys, i have a question, how can i make the $sender get the items when he executes a command? thanks
    PHP:
    case 'hello':
                       
    //what do i need to put here?          
                                    
    break;
  2. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    $sender->getInventory()->addItem();
  3. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    PHP:
    use pocketmine\Player;
    use 
    pocketmine\item\Item;

    if(
    $sender instanceof Player) {
        
    $sender->getInventory()->addItem(Item::get((ID), (Meta), (Amount));
    }
    GoldenSteveyt likes this.
  4. GoldenSteveyt
    Offline

    GoldenSteveyt New Member

    Joined:
    Aug 5, 2015
    Posts:
    12
    Minecraft User:
    D4nl0g
    wow, thanks a lot bro :D
    CrazedMiner likes this.

Share This Page

Advertisement