1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Pocketmine getLevels i not find please

Discussion in 'Plugin Help' started by FanTSM, Apr 26, 2022.

  1. FanTSM

    FanTSM Spider Jockey

    Messages:
    28
    GitHub:
    nam2k
    foreach ($this->getServer()->getLevels() as $level) {
    foreach ($level->getEntities() as $entity) {
    if ($entity instanceof TradeNPC) {
    file_put_contents($this->getDataFolder() . $entity->getNameTag() . ".dat", $entity->getSaveNBT());
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    PHP:
    $this->getServer()->getWorldManager()->getWorlds()
     
  3. GamingFR91

    GamingFR91 Spider Jockey

    Messages:
    29
    GitHub:
    kanekilechomeur
    PHP:
    foreach ($this->getServer()->->getWorldManager()->getWorlds() as $world) {
    foreach (
    $world->getEntities() as $entity) {
    if (
    $entity instanceof TradeNPC) {
    file_put_contents($this->getDataFolder() . $entity->getNameTag() . ".dat"$entity->getSaveNBT());
        }
      }
    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.