I cancelled BlockPlaceEvent so it cancels everything I place but it doesn't cancel bucket of lava and water when i place it
i cant place the lava bucket or water when i cancel interact event though but i think that might cause lag
BlockPlaceEvent only handles placing of BLOCKS, PlayerInteractEvent handles interacting (Potions, tapping a block, buckets, etc) The BucketEmpty and BucketFillEvents are better thought
A bucket of lava isn't a block therefore BlockPlaceEvent will not be triggered , try using something like PlayerInteractEvent PHP: if($event->getItem()->getId() == Item::BUCKET) $event->setCancelled();
error Code: [21:19:53] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'Server v1.0.0': Object of class pocketmine\item\Bucket could not be converted to int on Server\Main [21:19:53] [Server thread/CRITICAL]: ErrorException: "Object of class pocketmine\item\Bucket could not be converted to int" (EXCEPTION) in "plugins/Server/src/Server/Main" at line 701
You're trying to compare an object to an int. The proper way would be: PHP: if($event->getItem()->getId() == Item::BUCKET) $event->setCancelled();
Why use PlayerInteractEvent when there's a dedicated PlayerBucketFillEvent and PlayerBucketEmptyEvent for a reason?