protected function clearZone($level, $id)
 {
     if ($level instanceof Level) {
         $level = $level->getId();
     }
     if (isset($this->activeZones[$level]) && isset($this->activeZones[$level][$id])) {
         foreach ($this->plugin->getServer()->getOnlinePlayers() as $player) {
             if ($player->getLevel()->getId() === $level && $this->isInsideZone($player->getPosition(), $this->activeZones[$level][$id][0], $this->activeZones[$level][$id][1])) {
                 $player->teleport($player->getSpawn());
                 $player->sendMessage("You have been teleported because you were inside a mine when it was resetting.");
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function resetMine()
 {
     $chunks = [];
     for ($x = $this->getA()->getX(); $x - 16 <= $this->getB()->getX(); $x += 16) {
         for ($z = $this->getA()->getZ(); $z - 16 <= $this->getB()->getZ(); $z += 16) {
             //$this->getLevel()->getServer()->getLogger()->info(Level::chunkHash($x >> 4, $z >> 4));
             $chunk = $this->level->getChunk($x >> 4, $z >> 4, true);
             $chunkClass = get_class($chunk);
             $chunks[Level::chunkHash($x >> 4, $z >> 4)] = $chunk->toBinary();
         }
     }
     //var_dump($chunks);
     $resetTask = new MineResetTask($chunks, $this->a, $this->b, $this->data, $this->getLevel()->getId(), $this->base->getRegionBlocker()->blockZone($this->a, $this->b, $this->level), $chunkClass);
     $this->base->scheduleReset($resetTask);
 }