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

My Plugin errors..

Discussion in 'Development' started by Teamblocket, Apr 2, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    hey, I keep on geting this same warning on my console when i don't wear a helmet , all i want is to remove a effect when the player doesn't wear a helmet

    WARNING: Warning: Illegal offset type in isset or empty in phar:///jar/pocketmine/clearsky/1.0.5/ClearSky.phar/src/pocketmine/entity/Entity.php on line 515
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    you should give us your code
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    PHP:
    public function getHead(PlayerMoveEvent $e) {
          
    $p $e->getPlayer();
            
    $pInv $p->getInventory();
            
    $effect Effect::getEffect(5);
             if(
    $pInv->getHelmet()->getId() === 0){
            
    $p->removeEffect($effect);
          }
        }   
      
     
  4. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    1. PMMP forums do not support forks there is allowed only pocketmine
    2. You can use following code.
    PHP:
    public function getHead(PlayerMoveEvent $e) {
          
    $p $e->getPlayer();
            
    $pInv $p->getInventory();
            
    $effect Effect::getEffect(5);
    $armor = array("some armorid""blah blah");
    foreach(
    $armor as $armors){
             if(!
    $pInv->getHelmet())->getId() !== $armors){
            
    $p->removeEffect($effect);
          }
    }
        } 
    I think it do not give you the warning.
     
    Last edited: Apr 2, 2017
  5. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
  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.