Getting a players head

Discussion in 'Plugin Development' started by DominicGamesHD, Jun 4, 2016.

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

    DominicGamesHD

    I was wondering if I could get an example line of code to get a players head??
     
  2. Offline

    I Al Istannen

    @DominicGamesHD
    Well:
    should help you.
     
  3. Offline

    Zombie_Striker

    @DominicGamesHD
    No one will write the code for you. We are here to help you, not do your job for you.

    @I Al Istannen showed you how you would get the skull as an itemstack. In case you wanted it to be a block, you would need to use Material SKULL (no item), and use Block#getState() and cast that to a Skull. From there, set the owner and reset the block's state.
     
    I Al Istannen likes this.
  4. Offline

    I Al Istannen

    @Zombie_Striker @DominicGamesHD
    Just make sure to cast it to a "org.bukkit.block.Skull". Imports are sneaky, there is also a "org.bukkit.material.Skull".

    At the end, call BlockState#update() (which is Skull#update(), as Skull is a subclass of BlockState) to push the changes to the world (don't know what you meant with reset, Zombie).
     
Thread Status:
Not open for further replies.

Share This Page