Any idea why this code won't work, i have checked through everything and doesn't work. PHP: public function onInteract(PlayerInteractEvent $event){ $player = $event->getPlayer(); $iteminhand = $player->getInventory()->getItemInHand(); if($iteminhand->getId() === 399){ if($iteminhand->getCustomName() === c::GREEN. "BankNote : $10000"){ if($ev->getAction() === PlayerInteractEvent::RIGHT_CLICK_BLOCK){ $player->sendMessage(c::GREEN. "Redeemed BankNote worth $10000"); $player->removeItem($iteminhand); } } } }
PHP: public function onInteract(PlayerInteractEvent $event){ $player = $event->getPlayer(); $iteminhand = $player->getInventory()->getItemInHand(); if($iteminhand->getId() === 399){ if($iteminhand->getCustomName() === c::GREEN. "BankNote : $10000"){ if($ev->getAction() === PlayerInteractEvent::RIGHT_CLICK_BLOCK){ $player->sendMessage(c::GREEN. "Redeemed BankNote worth $10000"); $player->removeItem($iteminhand); } }else{ $player->getServer()->getLogger()->notice("Skipped note redeeming due to unmatched item name."); var_dump($iteminhand->getCustomName(), c::GREEN. "BankNote : $10000"); } }} That should help you debug your problem.
The code he displayed gives console output. Is there anything in the console from the plugin? you said you tested it.
that additional code is supposed to help you debug the problem you're facing, it doesn't fix it http://php.net/manual/en/function.var-dump.php
Maybe try using single quotes PHP: c::GREEN. 'BankNote : $10000' instead of PHP: c::GREEN. "BankNote : $10000" if the dollar sign will interpret it as a variable (although this wouldn't be a valid variable name).