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

unlimited arrow

Comments in 'Plugin Development' started by imJayL, Mar 3, 2016.

  1. imJayL
    Offline

    imJayL Active Member

    Joined:
    Aug 5, 2015
    Posts:
    52
    Minecraft User:
    PHC_imJayL
    Code for this? Thanks in advance
  2. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Erm what?
    Try using the bow event and give the player one arrow
    applqpak likes this.
  3. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Just add an arrow to the inventory everytime a player shoots a bow.
    Last edited: Mar 5, 2016
    Skullex and applqpak like this.
  4. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    Arrow NOW IS unlimited
    PHP:
    foreach($player->getInventory()->getContents()as $arrow){
    if(
    $arrow->getId() ==262&& $arrow->getCount() < 1){
    $player->getInventory()->addItem(Item::get(262));
    }}
    Skullex likes this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1. If an inventory slot has count 0, it should become air, not still arrow.
    2. Why do you need to iterate over the whole inventory? You just need to call addItem(), and PocketMine will automatically find the correct slot to place the items.
    applqpak likes this.
  6. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    I think my method is easier. And perhaps more efficient.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You meant to add an arrow, not to add a bow.
    Hotshot_9930 and applqpak like this.
  8. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Oops:eek:, Edited

Share This Page

Advertisement