Im sorry to waste your time, but im able to make it works how i want. What i want is, while the player holds right click do something (for example writin 1 in the chat), and when he relese the button do something else once (for example writing 2 in the chat). I tried with this code:
@Override
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) {
pPlayer.startUsingItem(pUsedHand);
return super.use(pLevel, pPlayer, pUsedHand);
}
@Override
public void onUsingTick(ItemStack BasicWandItem, LivingEntity player, int count) {
player.sendMessage(new TranslatableComponent("1"),player.getUUID());
super.onUsingTick(BasicWandItem, player, count);
}
@Override
public void releaseUsing(ItemStack pStack, Level pLevel, LivingEntity pLivingEntity, int pTimeCharged) {
pLivingEntity.stopUsingItem();
pLivingEntity.sendMessage(new TranslatableComponent("2"),pLivingEntity.getUUID());
super.releaseUsing(pStack, pLevel, pLivingEntity, pTimeCharged);
}