Wearing Armor on Spawn

Discussion in 'Plugin Development' started by xxCoderForLifexx, Oct 18, 2012.

Thread Status:
Not open for further replies.
  1. I have been messing around I made this to get items on spawn
    Code:
    public void onPlayerSpawn(PlayerRespawnEvent evt){
    Player player = evt.getPlayer();
    ItemStack give = new ItemStack(Material.DIAMOND_HELMET, 1);
      ItemStack give1 = new ItemStack(Material.DIAMOND_CHESTPLATE, 1);
      ItemStack give2 = new ItemStack(Material.DIAMOND_LEGGINGS, 1);
      ItemStack give3 = new ItemStack(Material.DIAMOND_BOOTS, 1);
      ItemStack give4 = new ItemStack(Material.DIAMOND_SWORD, 1);
      PlayerInventory pi = player.getInventory();
      pi.setHelmet(give);
      pi.setChestplate(give1);
      pi.setLeggings(give2);
      pi.setBoots(give3);
      pi.setItemInHand(give4);
    } 
    And I am having the problem of when I spawn I get no items on my body I need some help :(
     
  2. Offline

    Taco

    pi.update();
     
  3. Offline

    LucasEmanuel

    try using player.updateInvetory(), there seems to be some glitches with player inventories.
     
  4. Offline

    mollekake

    this should work:
    pi.setChestplate(new ItemStack(give1)

    and so on
     
  5. Sorry I haven't got around to trying any of these methods I will as soo. As I get home and give you all feedback
    Thanks :)
     
  6. Offline

    CookCreeperz

    Above those type player.getChestplate();
    And so on so forth.
     
Thread Status:
Not open for further replies.

Share This Page