Помогите Как проверить нажатие ПКМ ?

AguRChek_TV

Активный участник
Пользователь
Баллы
76
Имя в Minecraft
AguRChek_TV
Как проверить нажатие ПКМ ?
 
Код:
    @EventHandler
    public void playerInteract(PlayerInteractEvent e){
        if(e.getAction() == Action.RIGHT_CLICK_BLOCK){
            //Код
        }
    }

Я пробовал вот так:

@EventHandler
public void playerInteract(PlayerInteractEvent e){
Action a = e.getAction();
if(a != Action.RIGHT_CLICK_BLOCK && a != Action.RIGHT_CLICK_AIR) return;
}
}

-RIGHT_CLIK_BLOCK cannot be resolved or is not field
-RIGHT_CLIK_AIR cannot be resolved or is not field
 
Я пробовал вот так:

@EventHandler
public void playerInteract(PlayerInteractEvent e){
Action a = e.getAction();
if(a != Action.RIGHT_CLICK_BLOCK && a != Action.RIGHT_CLICK_AIR) return;
}
}

-RIGHT_CLIK_BLOCK cannot be resolved or is not field
-RIGHT_CLIK_AIR cannot be resolved or is not field
Это исключение или ошибка в IDE?
 
Я пробовал вот так:

@EventHandler
public void playerInteract(PlayerInteractEvent e){
Action a = e.getAction();
if(a != Action.RIGHT_CLICK_BLOCK && a != Action.RIGHT_CLICK_AIR) return;
}
}

-RIGHT_CLIK_BLOCK cannot be resolved or is not field
-RIGHT_CLIK_AIR cannot be resolved or is not field
Мб потому что у тебя CLIK, а не CLICK?
 
Я пробовал вот так:

@EventHandler
public void playerInteract(PlayerInteractEvent e){
Action a = e.getAction();
if(a != Action.RIGHT_CLICK_BLOCK && a != Action.RIGHT_CLICK_AIR) return;
}
}

-RIGHT_CLIK_BLOCK cannot be resolved or is not field
-RIGHT_CLIK_AIR cannot be resolved or is not field
Всё работает, просто у тебя Action импортирован не от туда.
Покажи импорты.

PHP:
    @EventHandler
    public void onInteract(PlayerInteractEvent e){
        if(e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {
            //Код
        }
    }
 
Назад
Верх