I cant check player in main hand item for hub plugin (1.19)

Discussion in 'Plugin Development' started by Lzay, Aug 21, 2022.

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

    Lzay

    Code:
    @EventHandler
        public void onPlayerInterract(PlayerInteractEvent event) { 
            if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
                final ItemStack currentItem = event.getPlayer().getItemInHand();
                if(currentItem.getType() != Material.AIR && currentItem != null) {
                    if(currentItem.getItemMeta().getDisplayName() == ChatColor.YELLOW + "Kit Seçici") {
                        event.getPlayer().sendMessage("test");
    
                    }
    
    
                }
            }
     

    Attached Files:

  2. Offline

    timtower Administrator Administrator Moderator

    @Lzay Strings are checked with equals or equalsIgnoreCase, not with ==
     
  3. Offline

    Lzay

    oh i forgot java syntax thank you :d
     
Thread Status:
Not open for further replies.

Share This Page