public function onLoadChunk(ChunkLoadEvent $event) { if ($event->getLevel()->getName() !== "world_pvp") { return; } $chunk = $event->getChunk(); $hash = Level::chunkHash($chunk->getX(), $chunk->getZ()); if (isset($this->modelLocs[$hash])) { foreach ($this->modelLocs[$hash] as $id => $loc) { $model = new PvpKitModel($this->game, $id, $loc); $model->spawnToAll(); $this->models[$id] = $model; } } if (isset($this->shopLocs[$hash])) { foreach ($this->shopLocs[$hash] as $col => $loc) { $shop = new PvpUpgradeDummyShop($this->game, $loc, $col); $shop->spawnToAll(); $this->shops[$col] = $shop; } } if ($hash === $this->bowHash) { $this->bow = new PvpBowHolder(Settings::kitpvp_getBowLocation($this->game->getMain()->getServer()), $this->game); } }
public function onLoad(ChunkLoadEvent $event) { if ($event->getLevel() === $this->level) { foreach ($this->locs[Level::chunkHash($event->getChunk()->getX(), $event->getChunk()->getZ())] as $id => $spawn) { /** @var string|Entity|CustomEntity $class */ $class = $spawn->getClass(); /** @var Entity|CustomEntity $ent */ $this->spawns[$id] = $ent = new $class($spawn, $spawn->getData(), $id, $this->level); $ent->spawnToAll(); } } }