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

Solved Set Armor

Discussion in 'Development' started by Dadoue, Aug 23, 2020.

  1. Dadoue

    Dadoue Spider

    Messages:
    7
    Hello, I made a code which allows that as soon as a player joins he is an armor. But it does not work. (There is no error in the console)

    PHP:
        public function onJoin(PlayerJoinEvent $event){
        
    $player $event->getPlayer();
        
    $player->getArmorInventory()->setHelmet(Item::get(30201));
        
    $player->getArmorInventory()->setChestplate(Item::get(30301));
        
    $player->getArmorInventory()->setLeggings(Item::get(30401));
        
    $player->getArmorInventory()->setBoots(Item::get(30501));
     }
     
  2. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    register events in onEnable function like:
    PHP:
    $this->getServer()->getPluginManager()->registerEvents($this$this);
     
    Dadoue likes this.
  3. Dadoue

    Dadoue Spider

    Messages:
    7
    It worked thanks !!
     
  4. GodWeedZao

    GodWeedZao Zombie Pigman

    Messages:
    401
    GitHub:
    godweedzao
    no problem ;)
     
    Dadoue likes 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.