PHP: public function onInteract(PlayerInteractEvent $event){ $blockId = 1; if($event->getBlock()->getId() === $blockId){ //Do what wolf just said. }}
This Code dosn't work and it comes no errors PHP: <?phpnamespace Leap;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\event\player\PlayerInteractEvent;use pocketmine\math\Vector3;use pocketmine\Server;class Main extends PluginBase implements Listener { public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onInteract(PlayerInteractEvent $event) { if($event->getItem()->getID() === 276) { $player->setMotion(new Vector3(0, 3, 0)); } }}
getID() doesn't exist. It must be getId() If you are using getItem(), then you must tap any block with item 276 in your hand. You didn't define $player.