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

How to give item

Discussion in 'Plugin Help' started by MrSolik123, Sep 11, 2019.

  1. MrSolik123

    MrSolik123 Spider

    Messages:
    14
    • how to give the player the item when they log on to the server?
     
  2. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    PHP:
    public function onJoin(PlayerJoinEvent $ev) { //The Joining event
            
    if (!$p->hasPlayedBefore()){ //If they haven't played the server before 
                
    $p->getInventory()->addItem(Item::get(ItemIds::STONE_AXE)); //Gives the player a stone axe
            
    }
        }
     
  3. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    You forgot $p = $ev->getPlayer();
     
    EdwardHamHam, Mr174 and HimbeersaftLP like 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.