right click to player spigot code example
Example: get wen player right clicks entity spigot
@EventHandler(priority=EventPriority.NORMAL, ignoreCancelled=true)
public void onRightClick(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
if (event.getRightClicked().getType()==EntityType.VILLAGER) {
event.setCancelled(true);
//continued code