Right Clicking Player Heads.

Discussion in 'Plugin Development' started by ThatCoffeeBean, Oct 27, 2014.

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

    ThatCoffeeBean

    Im working on code the allows an output whenever you right click a player head when it has been places down. It's like right clicking a block but instead a Player Head!
    Heres what i have so far:

    @EventHandler
    public void OnPlayerInteract(PlayerInteractEvent event){
    Player player = event.getPlayer();
    if(event.getMaterial() == Material.SKULL_ITEM){
    player.sendMessage(ChatColor.GOLD + ">" + ChatColor.RED + "Quest Lobby");
    }
    }
    }


    I think the problem is the Highlighted Item.
    I just need some confirmation.
     
  2. Offline

    CraftCreeper6

    ThatCoffeeBean
    SKULL_ITEM can be used as a player head, zombie head etc... Try giving it a data value by adding , (byte) dataValue
     
  3. Offline

    ThatCoffeeBean

    Im not sure what you mean. Do you have an example?
     
  4. Offline

    CraftCreeper6

    ThatCoffeeBean
    Create an ItemStack
    Code:java
    1. ItemStack i = new ItemStack(Material.SKULL_ITEM);


    Then add a data value.
    Code:java
    1. ItemStack i = new ItemStack(Material.SKULL_ITEM, (byte) myData);
     
  5. Offline

    FabeGabeMC

    ThatCoffeeBean CraftCreeper6
    SKULL_ITEM would be the actual item in hand, SKULL is the block. Also check if the data is 3 to know it's a player head.
     
    ChipDev likes this.
  6. Offline

    ThatCoffeeBean

    I don't need to specify which head. I just to know how to right click heads in general
    CraftCreeper6

    I tried right clicking SKULL but it didn't work.@FabeGabeMC

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  7. Offline

    CraftCreeper6

    ThatCoffeeBean
    Yes, create an ItemStack with a data value, check if the player clicks an Item matching that ItemStack. Do your code...
     
  8. Offline

    ThatCoffeeBean

    CraftCreeper6
    What do I put in place of MyData
    Do I put 3 for player head?

    I'm confused

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  9. Offline

    CraftCreeper6

  10. Offline

    FabeGabeMC

  11. Offline

    CraftCreeper6

  12. Offline

    Cyber_Pigeon

    I cant believe its taken so many people THIS long.
    Its material.SKULL not SKULL_ITEM
     
  13. Offline

    CraftCreeper6

    Cyber_Pigeon
    "I tried right clicking SKULL but it didn't work.@FabeGabeMC"
    Read the thread...
     
    FabeGabeMC likes this.
  14. Offline

    FabeGabeMC

  15. Offline

    CraftCreeper6

Thread Status:
Not open for further replies.

Share This Page