Solved Checking If An Item In A Players Hand Is A Custom ItemStack?

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

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

    yewtree8

    So i am making this kind of test plugin for custom items and it says the boolean and itemstack are uncompatible? this is the code? can anyone fix this?

    Code:java
    1. package me.mat.woodenwands;
    2.  
    3. import java.util.Arrays;
    4. import java.util.List;
    5.  
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.Material;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.event.EventHandler;
    10. import org.bukkit.event.Listener;
    11. import org.bukkit.event.block.Action;
    12. import org.bukkit.event.player.PlayerInteractEvent;
    13. import org.bukkit.inventory.ItemStack;
    14. import org.bukkit.inventory.meta.ItemMeta;
    15.  
    16. public class ArrowWandListener implements Listener {
    17.  
    18.  
    19.  
    20. public ItemStack ArrowWand = setMeta(new ItemStack(Material.WOOD_HOE), ChatColor.BOLD + " " + ChatColor.GOLD + "Arrow Wand",
    21. Arrays.asList(ChatColor.AQUA + "Right Click To Shoot Arrow"));
    22.  
    23.  
    24. @EventHandler
    25. public void onArrowWandInteract(PlayerInteractEvent event) {
    26. Player player = event.getPlayer();
    27. Action action = event.getAction();
    28. Material block = event.getClickedBlock().getType();
    29. if(event.getAction() == Action.RIGHT_CLICK_AIR) {
    30. if(player.getItemInHand().hasItemMeta() == ArrowWand) {
    31.  
    32.  
    33. } return;
    34.  
    35.  
    36. }
    37.  
    38.  
    39.  
    40. }
    41.  
    42.  
    43. public ItemStack setMeta(ItemStack material, String name, List<String> lore) {
    44. if(((material == null) || material.getType() == Material.AIR) || (name == null && lore == null))
    45.  
    46. return null;
    47.  
    48. ItemMeta im = material.getItemMeta();
    49. if (name != null)
    50. im.setDisplayName(name);
    51. if(lore != null) {
    52. im.setLore(lore);
    53.  
    54. material.setItemMeta(im);
    55. return material;
    56.  
    57. }
    58. return material;
    59.  
    60.  
    61. }
    62.  
    63.  
    64. }
    65.  


    Thanks guys, if anyone could help that would be great.
     
  2. Code:java
    1. player.getItemInHand().equals(arrorwand)
     
  3. Offline

    killerzz1

    i don't know :(
     
  4. Offline

    yewtree8

    sohardhun15


    yes that was correct, i did it before you said :p
     
  5. Set the thread to solved ;)
     
Thread Status:
Not open for further replies.

Share This Page