Right Click Event

Discussion in 'Plugin Development' started by mig4ng, Mar 22, 2013.

Thread Status:
Not open for further replies.
  1. Hey, i'm creating a plugin for a friend, but i'm having a problem, I used this code for calling when the player right click with a new item:
    Code:
        @EventHandler
        public void onPlayerUse(PlayerInteractEvent event){
            Player p = event.getPlayer();
       
            if(event.getAction().equals(Action.RIGHT_CLICK_AIR)){
                if(p.getItemInHand().getType() == Material.MONSTER_EGG){
                    List<String> egglore = new ArrayList<String>();
                    egglore.add(colorize("Um Pequeno Ovo da Páscoa"));
                    egglore.add(colorize("Abre-o e vê as suas surpresas"));
                    egglore.add(colorize("&4Dica: &rPara abrir clica no lado"));
                    egglore.add(colorize("&rdireito do rato, e não podes apontar"));
                    egglore.add(colorize("&rpara nenhum bloco!"));
                   
                    List<String> lore = p.getItemInHand().getItemMeta().getLore();
                    try {
                        String lore1 = lore.get(0);
                        String egglore1 = egglore.get(0);
                        if(lore1 != null || egglore1 != null || egglore1.equalsIgnoreCase(lore1)){
                            p.sendMessage("working bitch!");
                        }
                    } catch(Exception e){
                        //none
                    }
                }
            }
        }
    But this one is called only when the player right click on air, is there any other way to call it when a player just right click?
     
  2. Offline

    gomeow

    Action.RIGHT_CLICK_BLOCK
     
  3. Offline

    unrealdesign

    RIGHT_CLICK_BLOCK

    Use that in conjunction with RIGHT_CLICK_AIR

    EDIT: gomeow beat me to it:(
     
Thread Status:
Not open for further replies.

Share This Page