hello =3 can you tell me how if player say i want op summon tnt in hes lacton -sorry for my bad english-
PHP: public $optnts = [];public function onChat(PlayerChatEvent $event){$msg = $event->getMessage();if(strtolower($msg) == "i want op"){$player = $event->getPlayer(); $nbt = new Compound("", ["Pos" => new Enum("Pos", [new Double("", $player->x), new Double("", $player->y), new Double("", $player->z)]), "Motion" => new Enum("Motion", [new Double("",0), new Double("",-1), new Double("",0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)]), "Fuse" => new Byte("Fuse", 1 //time when tnt explodes)]); $entity = Entity::createEntity("PrimedTNT", $player->getLevel()->getChunk($player->x >> 4, $player->z >> 4), $nbt); $entity->spawnToAll();array_push($this->optnts, $tnt->getId());}}// code to prevent block breaking// not sure if the code down below works, the last time I tried that code it returned me an on null error on $event->getEntity(); I know the entity removes during the explosion but so the function is uselesspublic function onExplode(ExplosionPrimeEvent $event){if(in_array($event->getEntity()->getId(), $this->optnt)){$event->setBlockBreaking(false);unset($this->optnt[$tnt->getId()]);}}