is their anyway to check if a player is in Creative Mode? this code doesn't work PHP: public function preventPlace(BlockPlaceEvent $event){ $player = $event->getPlayer(); $bedrock = Item::get(7, 0, 1); if($player->getInventory()->getItemInHand()->getId() === 7){ $event->setCancelled(true); $player->sendMessage(" §l§cTheVortex §7>> §r§f§4Your not allowed to use Bedrock!"); } if($player->getId() === 46 and $player->isCreative() === true){ $event->setCancelled(true); $player->sendMessage(" §l§cTheVortex §7>> §r§f§4Your not allowed to use TNT in Creative!"); } }
$player->isCreative === true and $player->getId() === 46 WTF ? Just use if($player->getGamemode () == 1 and $event->getBlock()->getId() === 46){
$player->isCreative() will work, the "=== true" also isn't needed. Where you put "if($player->getId() == X" did you mean "if($event->getBlock()->getId() == X"? $player->getId() will return the entity id of the player in the world. $event->getBlock()->getId() will return the id of the block the player is attempting to place. Edit: Sorry, whenever I started composing my message you hadn't posted yours yet.