PHP: foreach($this->getServer()->getLevels() as $level){ foreach($level->getEntities() as $entity){ if($entity instanceof Human){ $entity->close(); } } } this is if you want to kill all the entities of all the level: explanation, You get all the levels of a server through a foreach. You get all the entities of all the levels. You check and filter the entities that are Humans. You kill the entity.
I restart server without plugin - all humans disappeared Restart again with plugins and all cleared.... no humans...
PHP: $nbt = $this->getServer()::getInstance()->getOfflinePlayerData($player->getName()); $npc = new Human($world, $nbt); $npc->setNameTag($player->getName()); $npc->getInventory()->clearAll(); $npc->setNameTagVisible(false); $npc->setPosition($player->getPosition()); $npc->setRotation($yaw, $pitch); $npc->spawnToAll();