PlayerInteractEvent (wrong section)

Discussion in 'BungeeCord Plugin Development' started by MaxKrissigo, May 11, 2016.

Thread Status:
Not open for further replies.
  1. So, for some reason my code isn't doing anything when a player right clicks a material with a certain lure and name. Not really sure why it isn't working, but there are no errors at all in the console etc.
    Code (Text):
           @EventHandler
            public void onPlayerInteract(PlayerInteractEvent e) {
             
                Player player = e.getPlayer();
                Action action = e.getAction();
             
                String name = Basic.getItemMeta().getDisplayName();
                List<String> lore = Basic.getItemMeta().getLore();
                     
                 if ((action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) &&  player.getItemInHand().getType() == Material.DIAMOND && lore.contains("Right click this book for a random Basic Enchantment") && name.contains("Basic Random Enchantment Book")) {
                   
                     player.sendMessage("lol");
                   
                    }
            }
     
  2. xD, wrong section.
    EDIT: Just created a post in the correct section. Please delete this.
     
Thread Status:
Not open for further replies.