hey , so am making this crate key plugin which has a bunch of features but theirs one error i can't seem to fix , when the player doesn't have op and places a crate chest the placement cancels but the message doesn't send. heres my code PHP: public function cratePlace(BlockPlaceEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); if($block->getId() == 146 and $player->isOp()){ $event->setCancelled(false); $player->sendMessage(" TheVortex >> Crate Chest placed!"); } else { $player->sendMessage(" TheVortex >> Your not allowed to place a Crate Chest!"); $event->setCancelled(true); return; } }
That formatting was seriously triggering my OCD... PHP: public function cratePlace(BlockPlaceEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); if($block->getId() === 146 and $player->isOp()){ // try using a permission instead of checking for OP $player->sendMessage(" TheVortex >> Crate Chest placed!"); $event->setCancelled(false); } else { $player->sendMessage(" TheVortex >> You're not allowed to place a Crate Chest!"); $event->setCancelled(true); } return;}