Solved Need help with deceting itemstack

Discussion in 'Plugin Development' started by 119mikkel, Apr 20, 2014.

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

    119mikkel

    Hello, i'm trying to decet if a player is using my itemstack.

    Here is my code:
    Code:java
    1. @EventHandler
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    3.  
    4. Player player = event.getPlayer();
    5.  
    6. Action a = event.getAction();
    7. //ItemStack Item = event.getItem();
    8. ItemStack Item = player.getItemInHand();
    9.  
    10. if(a == Action.PHYSICAL || Item == null || Item.getType() == Material.AIR) {
    11. player.sendMessage(ChatColor.DARK_RED + "It did not work!");
    12. return;
    13. }
    14.  
    15. if (Item.getItemMeta().getDisplayName().equals(ChatColor.DARK_RED + "myItem")) {
    16. player.sendMessage("It worked!");
    17. }
    18. }


    I hope someone can help me.
     
  2. Offline

    ButterSquidz

    Try getting rid of "a == Action.PHYSICAL"
     
  3. Offline

    TheMcScavenger

    What's the problem?.... Error? Crash?

    Apparently you can't... lol.
     
  4. Offline

    119mikkel

    Thanks that help with testing:D


    LoL xD I'm sorry to disappoint you but... I have fixed it:p
     
Thread Status:
Not open for further replies.

Share This Page