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

Setting armor after a death does not work?

Comments in 'Plugin Development' started by ProjectInfinity, May 18, 2015.

  1. ProjectInfinity
    Offline

    ProjectInfinity Active Member Plugin Developer

    Joined:
    Sep 7, 2014
    Posts:
    112
    Plugins:
    3
    Minecraft User:
    ProjectInfinity
    So I have the following run on a function called gearUp().

    PHP:
    # Set their armor.
            
    foreach($this->plugin->getKit()['armor'] as $key => $value) {

                switch(
    $key) {

                    case 
    'head':
                        
    $player->getInventory()->setHelmet($value);
                        break;

                    case 
    'chest':
                        
    $player->getInventory()->setChestplate($value);
                        break;

                    case 
    'legs':
                        
    $player->getInventory()->setLeggings($value);
                        break;

                    case 
    'feet':
                        
    $player->getInventory()->setBoots($value);
                        break;

                    default:
                       
    $this->plugin->getLogger()->emergency('No such armor content slot: '.$key);
                }

            }

            
    # Then send the armor to them.
            
    $player->getInventory()->sendArmorContents($player);
    During the first call to gearUp() it will gear the player up with armor. However upon a respawn the armor contents is not being sent to the player. Is anyone familiar with this issue?
  2. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    It happens sometimes with ArmorSpawn.
  3. ProjectInfinity
    Offline

    ProjectInfinity Active Member Plugin Developer

    Joined:
    Sep 7, 2014
    Posts:
    112
    Plugins:
    3
    Minecraft User:
    ProjectInfinity
    This is happening every time after the first time the function is called though. No randomness, it's consistently failing.
  4. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
  5. ProjectInfinity
    Offline

    ProjectInfinity Active Member Plugin Developer

    Joined:
    Sep 7, 2014
    Posts:
    112
    Plugins:
    3
    Minecraft User:
    ProjectInfinity
    So the consensus so far is that setting armor in PocketMine is buggy at best and more often than not broken?
    LDX likes this.

Share This Page

Advertisement