Forcefully remove helmet

Discussion in 'Plugin Development' started by HamOmlet, Aug 6, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    HamOmlet

    I'm trying to forcefully remove a helmet from a player (as in remove it from the player's person). Any suggestions?
     
  2. Offline

    Bavestry

    If you don't want to give them the helmet back:
    Code:
    player.setHelmet(Material.AIR);
    
    If you do want to give them the helmet back:
    Code:
    PlayerInventory inventory = player.getInventory();
    ItemStack helmet = player.getHelmet();
    inventory.addItem(helmet);
    player.setHelmet(Material.AIR);
    
    Hope that helps :p
     
  3. Offline

    HamOmlet

    Ah, I was under the impression that setting the helmet to air would cause issues. Thanks!
     
  4. Offline

    Bavestry

    HamOmlet
    I've never heard that, but if it doesn't work, just tell me. Should work fine though. ;)
     
Thread Status:
Not open for further replies.

Share This Page