How can I do when a Player uses a item like a slimeball that he gets a message [He should use the slimeball with right klick]
Handle PlayerInteractEvent. If action is PlayerInteractEvent::RIGHT_CLICK_BLOCK. If item ID matches Item::SLIMEBALL. Send message.
if(PlayerInteractEvent::RIGHT_CLICK_BLOCK){ $event->getPlayer()->sendMessage("You are cool"); } @PEMapModder like this?
No. How will PHP know what you are doing with PlayerInteractEvent::RIGHT_CLICK_BLOCK? Compare it with $PlayerInteractEvent->getAction(), to see if they are identical, using the === operator.
if(PlayerInteractEvent->getAction() == RIGHT_CLICK_BLOCK){ $event->getPlayer()->sendMessage("You are cool"); } @@PEMapModder like this?
Do You Want A Cick in the air 1 sec look my plugin TNT Do you want a click a block and do things use PlayerInteractEvent