public function onUpdate($type) { if ($type === Level::BLOCK_UPDATE_NORMAL) { if ($this->getSide(0)->isTransparent === true) { //Replace with common break method //TODO //Server::getInstance()->api->entity->drop($this, Item::get($this->id)); $this->getLevel()->setBlock($this, new Air(), false, false, true); return Level::BLOCK_UPDATE_NORMAL; } } elseif ($type === Level::BLOCK_UPDATE_RANDOM) { //Growth if (mt_rand(1, 7) === 1) { if (($this->meta & 0x8) === 0x8) { Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x7); } else { $this->meta |= 0x8; $this->getLevel()->setBlock($this, $this, true); return Level::BLOCK_UPDATE_RANDOM; } } else { return Level::BLOCK_UPDATE_RANDOM; } } return false; }
public function onSapling(BlockUpdateEvent $event) { if ($event->isCancelled()) { return; } if ($event->getBlock() instanceof Sapling) { Tree::growTree($event->getBlock()->getLevel(), $event->getBlock()->x, $event->getBlock()->y, $event->getBlock()->z, new Random(\mt_rand()), $event->getBlock()->getDamage() & 0x7); } }
public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random) { $this->level = $level; $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount; for ($i = 0; $i < $amount; ++$i) { $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15); $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15); $y = $this->getHighestWorkableBlock($x, $z); if ($y === -1) { continue; } ObjectTree::growTree($this->level, $x, $y, $z, $random, $this->type); } }
/** * @param CommandSender $sender * @param string $alias * @param array $args * @return bool */ public function execute(CommandSender $sender, $alias, array $args) { if (!$this->testPermission($sender)) { return false; } if (!$sender instanceof Player || count($args) !== 1) { $this->sendUsage($sender, $alias); return false; } $block = $sender->getTargetBlock(100, BaseAPI::NON_SOLID_BLOCKS); if ($block === null) { $sender->sendMessage(TextFormat::RED . "There isn't a reachable block"); return false; } switch (strtolower($args[0])) { case "oak": default: $type = Sapling::OAK; break; case "birch": $type = Sapling::BIRCH; break; case "redwood": $type = Sapling::SPRUCE; break; case "jungle": $type = Sapling::JUNGLE; break; /*case "redmushroom": $type = Sapling::RED_MUSHROOM; break; case "brownmushroom": $type = Sapling::BROWN_MUSHROOM; break; case "swamp": $type = Sapling::SWAMP; break;*/ } Tree::growTree($sender->getLevel(), $block->x, $block->y + 1, $block->z, new Random(mt_rand()), $type & 0x7); return true; }
public function onUpdate($type) { if ($type === Level::BLOCK_UPDATE_NORMAL) { if ($this->getSide(0)->isTransparent() === true) { $this->getLevel()->useBreakOn($this); return Level::BLOCK_UPDATE_NORMAL; } } elseif ($type === Level::BLOCK_UPDATE_RANDOM) { //Growth if (mt_rand(1, 7) === 1) { if (($this->meta & 0x8) === 0x8) { Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x7, false); } else { $this->meta |= 0x8; $this->getLevel()->setBlock($this, $this, true); return Level::BLOCK_UPDATE_RANDOM; } } else { return Level::BLOCK_UPDATE_RANDOM; } } return false; }
public function makeIsland($name) { $player = $this->getServer()->getPlayer($name); if (!$player instanceof Player) { return TextFormat::RED . "[Skyblock] Error: Jugador no Encontrado"; } else { // Make a file for the island @mkdir($this->getDataFolder() . "Islands/" . $name . ".txt"); $level = new Config($this->getDataFolder() . "Islands/" . $name . ".txt", Config::ENUM); $level->set("location", $level . "," . $x . "," . $y . "," . $z); $level->setAll($level->getAll()); $level->save(); //get pos $pos = explode(",", $level->get("location")); $level = $pos[0]; $x = $pos[1]; $y = $pos[2]; $z = $pos[3]; //set block $level = $this->getServer()->getLevelByName($level); // Top layer of the island // 1st side $level->setBlock(new Position($x, $y, $z, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 6, $y, $z + 6, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 6, $y, $z + 5, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 6, $y, $z + 4, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 6, $y, $z + 3, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 6, $y, $z + 2, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 6, $y, $z + 1, $level), Block::get(Block::GRASS)); // 2nd side $level->setBlock(new Position($x + 5, $y, $z + 6, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 5, $y, $z + 5, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 5, $y, $z + 4, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 5, $y, $z + 3, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 5, $y, $z + 2, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 5, $y, $z + 1, $level), Block::get(Block::GRASS)); // 3rd side $level->setBlock(new Position($x + 4, $y, $z + 6, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 4, $y, $z + 5, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 4, $y, $z + 4, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 4, $y, $z + 3, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 4, $y, $z + 2, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 4, $y, $z + 1, $level), Block::get(Block::GRASS)); // 4th side $level->setBlock(new Position($x + 3, $y, $z + 6, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 3, $y, $z + 5, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 3, $y, $z + 4, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 3, $y, $z + 3, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 3, $y, $z + 2, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 3, $y, $z + 1, $level), Block::get(Block::GRASS)); // 5th side $level->setBlock(new Position($x + 2, $y, $z + 6, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 2, $y, $z + 5, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 2, $y, $z + 4, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 2, $y, $z + 3, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 2, $y, $z + 2, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 2, $y, $z + 1, $level), Block::get(Block::GRASS)); // 6th side $level->setBlock(new Position($x + 1, $y, $z + 6, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 1, $y, $z + 5, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 1, $y, $z + 4, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 1, $y, $z + 3, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 1, $y, $z + 2, $level), Block::get(Block::GRASS)); $level->setBlock(new Position($x + 1, $y, $z + 1, $level), Block::get(Block::GRASS)); // Middle layer of the island // 1st Side $level->setBlock(new Position($x + 6, $y - 1, $z + 6, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 6, $y - 1, $z + 5, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 6, $y - 1, $z + 4, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 6, $y - 1, $z + 3, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 6, $y - 1, $z + 2, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 6, $y - 1, $z + 1, $level), Block::get(Block::SAND)); // 2nd side $level->setBlock(new Position($x + 5, $y - 1, $z + 6, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 5, $y - 1, $z + 5, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 5, $y - 1, $z + 4, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 5, $y - 1, $z + 3, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 5, $y - 1, $z + 2, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 5, $y - 1, $z + 1, $level), Block::get(Block::SAND)); // 3rd side $level->setBlock(new Position($x + 4, $y - 1, $z + 6, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 4, $y - 1, $z + 5, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 4, $y - 1, $z + 4, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 4, $y - 1, $z + 3, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 4, $y - 1, $z + 2, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 4, $y - 1, $z + 1, $level), Block::get(Block::SAND)); // 4th side $level->setBlock(new Position($x + 3, $y - 1, $z + 6, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 3, $y - 1, $z + 5, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 3, $y - 1, $z + 4, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 3, $y - 1, $z + 3, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 3, $y - 1, $z + 2, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 3, $y - 1, $z + 1, $level), Block::get(Block::SAND)); // 5th side $level->setBlock(new Position($x + 2, $y - 1, $z + 6, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 2, $y - 1, $z + 5, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 2, $y - 1, $z + 4, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 2, $y - 1, $z + 3, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 2, $y - 1, $z + 2, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 2, $y - 1, $z + 1, $level), Block::get(Block::SAND)); // 6th side $level->setBlock(new Position($x + 1, $y - 1, $z + 6, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 1, $y - 1, $z + 5, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 1, $y - 1, $z + 4, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 1, $y - 1, $z + 3, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 1, $y - 1, $z + 2, $level), Block::get(Block::SAND)); $level->setBlock(new Position($x + 1, $y - 1, $z + 1, $level), Block::get(Block::SAND)); // Bottom layer of the island // 1st side $level->setBlock(new Position($x + 6, $y - 1, $z + 6, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 6, $y - 1, $z + 5, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 6, $y - 1, $z + 4, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 6, $y - 1, $z + 3, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 6, $y - 1, $z + 2, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 6, $y - 1, $z + 1, $level), Block::get(Block::DIRT)); // 2nd side $level->setBlock(new Position($x + 5, $y - 1, $z + 6, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 5, $y - 1, $z + 5, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 5, $y - 1, $z + 4, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 5, $y - 1, $z + 3, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 5, $y - 1, $z + 2, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 5, $y - 1, $z + 1, $level), Block::get(Block::DIRT)); // 3rd side $level->setBlock(new Position($x + 4, $y - 1, $z + 6, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 4, $y - 1, $z + 5, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 4, $y - 1, $z + 4, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 4, $y - 1, $z + 3, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 4, $y - 1, $z + 2, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 4, $y - 1, $z + 1, $level), Block::get(Block::DIRT)); // 4th side $level->setBlock(new Position($x + 3, $y - 1, $z + 6, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 3, $y - 1, $z + 5, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 3, $y - 1, $z + 4, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 3, $y - 1, $z + 3, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 3, $y - 1, $z + 2, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 3, $y - 1, $z + 1, $level), Block::get(Block::DIRT)); // 5th side $level->setBlock(new Position($x + 2, $y - 1, $z + 6, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 2, $y - 1, $z + 5, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 2, $y - 1, $z + 4, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 2, $y - 1, $z + 3, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 2, $y - 1, $z + 2, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 2, $y - 1, $z + 1, $level), Block::get(Block::DIRT)); // 6th side $level->setBlock(new Position($x + 1, $y - 1, $z + 6, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 1, $y - 1, $z + 5, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 1, $y - 1, $z + 4, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 1, $y - 1, $z + 3, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 1, $y - 1, $z + 2, $level), Block::get(Block::DIRT)); $level->setBlock(new Position($x + 1, $y - 1, $z + 1, $level), Block::get(Block::DIRT)); // Tree $type = 0; Tree::growTree($level, $x + 6, $x + 1, $x + 6, new Random(mt_rand()), Sapling::OAK); // Teleport the player to their new island $player->teleport(new Position($randX, $randY + 5, $randZ, $this->getServer()->getLevelByName($levelName))); $player->sendMessage(TextFormat::GREEN . "[Skyblock] Bienvenido a tu Isla"); $player->sendMessage(TextFormat::GREEN . "[Skyblock] Si tu Isla No se Creo,"); $player->sendMessage(TextFormat::GREEN . "[Skyblock] Usa /is delete"); $player->sendMessage(TextFormat::GREEN . "[Skyblock] Y create otra ;D"); // Give the player a starter kit // String $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); // Emerald $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); // Sapling $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); // Water $player->getInventory()->addItem(Item::get(8)); $player->getInventory()->addItem(Item::get(8)); // Lava $player->getInventory()->addItem(Item::get(10)); // Seeds $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); // Melon seeds $player->getInventory()->addItem(Item::get(362)); // Cactus $player->getInventory()->addItem(Item::get(81)); // Iron $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); // Chest $player->getInventory()->addItem(Item::get(54)); $this->getLogger()->info(TextFormat::BLUE . "[Skyblock] " . $name . TextFormat::YELLOW . " Hiso una isla"); } }
public function makeIsland($name) { $player = $this->getServer()->getPlayer($name); if (!$player instanceof Player) { return "Error: Player not found"; } else { $randX = rand(1, 800); $randZ = rand(1, 800); $Y = 75; $levelName = $this->getServer()->getPlayer($name)->getLevel(); // Make a file for the island $islandFile = fopen($this->getDataFolder() . "Islands/" . $name . ".txt", "w"); fwrite($islandFile, $randX . ", " . $Y . ", " . $randZ); $playerFile = fopen($this->getDataFolder() . "Players/" . $name . ".txt", "w"); fwrite($playerFile, $player->getLevel()->getName()); // Top layer of the island // 1st side $levelName->setBlock(new Vector3($randX, $Y, $randZ), new Grass()); $levelName->setBlock(new Vector3($randX + 6, $Y, $randZ + 6), new Grass()); $levelName->setBlock(new Vector3($randX + 6, $Y, $randZ + 5), new Grass()); $levelName->setBlock(new Vector3($randX + 6, $Y, $randZ + 4), new Grass()); $levelName->setBlock(new Vector3($randX + 6, $Y, $randZ + 3), new Grass()); $levelName->setBlock(new Vector3($randX + 6, $Y, $randZ + 2), new Grass()); $levelName->setBlock(new Vector3($randX + 6, $Y, $randZ + 1), new Grass()); // 2nd side $levelName->setBlock(new Vector3($randX + 5, $Y, $randZ + 6), new Grass()); $levelName->setBlock(new Vector3($randX + 5, $Y, $randZ + 5), new Grass()); $levelName->setBlock(new Vector3($randX + 5, $Y, $randZ + 4), new Grass()); $levelName->setBlock(new Vector3($randX + 5, $Y, $randZ + 3), new Grass()); $levelName->setBlock(new Vector3($randX + 5, $Y, $randZ + 2), new Grass()); $levelName->setBlock(new Vector3($randX + 5, $Y, $randZ + 1), new Grass()); // 3rd side $levelName->setBlock(new Vector3($randX + 4, $Y, $randZ + 6), new Grass()); $levelName->setBlock(new Vector3($randX + 4, $Y, $randZ + 5), new Grass()); $levelName->setBlock(new Vector3($randX + 4, $Y, $randZ + 4), new Grass()); $levelName->setBlock(new Vector3($randX + 4, $Y, $randZ + 3), new Grass()); $levelName->setBlock(new Vector3($randX + 4, $Y, $randZ + 2), new Grass()); $levelName->setBlock(new Vector3($randX + 4, $Y, $randZ + 1), new Grass()); // 4th side $levelName->setBlock(new Vector3($randX + 3, $Y, $randZ + 6), new Grass()); $levelName->setBlock(new Vector3($randX + 3, $Y, $randZ + 5), new Grass()); $levelName->setBlock(new Vector3($randX + 3, $Y, $randZ + 4), new Grass()); $levelName->setBlock(new Vector3($randX + 3, $Y, $randZ + 3), new Grass()); $levelName->setBlock(new Vector3($randX + 3, $Y, $randZ + 2), new Grass()); $levelName->setBlock(new Vector3($randX + 3, $Y, $randZ + 1), new Grass()); // 5th side $levelName->setBlock(new Vector3($randX + 2, $Y, $randZ + 6), new Grass()); $levelName->setBlock(new Vector3($randX + 2, $Y, $randZ + 5), new Grass()); $levelName->setBlock(new Vector3($randX + 2, $Y, $randZ + 4), new Grass()); $levelName->setBlock(new Vector3($randX + 2, $Y, $randZ + 3), new Grass()); $levelName->setBlock(new Vector3($randX + 2, $Y, $randZ + 2), new Grass()); $levelName->setBlock(new Vector3($randX + 2, $Y, $randZ + 1), new Grass()); // 6th side $levelName->setBlock(new Vector3($randX + 1, $Y, $randZ + 6), new Grass()); $levelName->setBlock(new Vector3($randX + 1, $Y, $randZ + 5), new Grass()); $levelName->setBlock(new Vector3($randX + 1, $Y, $randZ + 4), new Grass()); $levelName->setBlock(new Vector3($randX + 1, $Y, $randZ + 3), new Grass()); $levelName->setBlock(new Vector3($randX + 1, $Y, $randZ + 2), new Grass()); $levelName->setBlock(new Vector3($randX + 1, $Y, $randZ + 1), new Grass()); // Middle layer of the island // 1st side $levelName->setBlock(new Vector3($randX, $Y - 1, $randZ), new Sand()); $levelName->setBlock(new Vector3($randX + 6, $Y - 1, $randZ + 6), new Sand()); $levelName->setBlock(new Vector3($randX + 6, $Y - 1, $randZ + 5), new Sand()); $levelName->setBlock(new Vector3($randX + 6, $Y - 1, $randZ + 4), new Sand()); $levelName->setBlock(new Vector3($randX + 6, $Y - 1, $randZ + 3), new Sand()); $levelName->setBlock(new Vector3($randX + 6, $Y - 1, $randZ + 2), new Sand()); $levelName->setBlock(new Vector3($randX + 6, $Y - 1, $randZ + 1), new Sand()); // 2nd side $levelName->setBlock(new Vector3($randX + 5, $Y - 1, $randZ + 6), new Sand()); $levelName->setBlock(new Vector3($randX + 5, $Y - 1, $randZ + 5), new Sand()); $levelName->setBlock(new Vector3($randX + 5, $Y - 1, $randZ + 4), new Sand()); $levelName->setBlock(new Vector3($randX + 5, $Y - 1, $randZ + 3), new Sand()); $levelName->setBlock(new Vector3($randX + 5, $Y - 1, $randZ + 2), new Sand()); $levelName->setBlock(new Vector3($randX + 5, $Y - 1, $randZ + 1), new Sand()); // 3rd side $levelName->setBlock(new Vector3($randX + 4, $Y - 1, $randZ + 6), new Sand()); $levelName->setBlock(new Vector3($randX + 4, $Y - 1, $randZ + 5), new Sand()); $levelName->setBlock(new Vector3($randX + 4, $Y - 1, $randZ + 4), new Sand()); $levelName->setBlock(new Vector3($randX + 4, $Y - 1, $randZ + 3), new Sand()); $levelName->setBlock(new Vector3($randX + 4, $Y - 1, $randZ + 2), new Sand()); $levelName->setBlock(new Vector3($randX + 4, $Y - 1, $randZ + 1), new Sand()); // 4th side $levelName->setBlock(new Vector3($randX + 3, $Y - 1, $randZ + 6), new Sand()); $levelName->setBlock(new Vector3($randX + 3, $Y - 1, $randZ + 5), new Sand()); $levelName->setBlock(new Vector3($randX + 3, $Y - 1, $randZ + 4), new Sand()); $levelName->setBlock(new Vector3($randX + 3, $Y - 1, $randZ + 3), new Sand()); $levelName->setBlock(new Vector3($randX + 3, $Y - 1, $randZ + 2), new Sand()); $levelName->setBlock(new Vector3($randX + 3, $Y - 1, $randZ + 1), new Sand()); // 5th side $levelName->setBlock(new Vector3($randX + 2, $Y - 1, $randZ + 6), new Sand()); $levelName->setBlock(new Vector3($randX + 2, $Y - 1, $randZ + 5), new Sand()); $levelName->setBlock(new Vector3($randX + 2, $Y - 1, $randZ + 4), new Sand()); $levelName->setBlock(new Vector3($randX + 2, $Y - 1, $randZ + 3), new Sand()); $levelName->setBlock(new Vector3($randX + 2, $Y - 1, $randZ + 2), new Sand()); $levelName->setBlock(new Vector3($randX + 2, $Y - 1, $randZ + 1), new Sand()); // 6th side $levelName->setBlock(new Vector3($randX + 1, $Y - 1, $randZ + 6), new Sand()); $levelName->setBlock(new Vector3($randX + 1, $Y - 1, $randZ + 5), new Sand()); $levelName->setBlock(new Vector3($randX + 1, $Y - 1, $randZ + 4), new Sand()); $levelName->setBlock(new Vector3($randX + 1, $Y - 1, $randZ + 3), new Sand()); $levelName->setBlock(new Vector3($randX + 1, $Y - 1, $randZ + 2), new Sand()); $levelName->setBlock(new Vector3($randX + 1, $Y - 1, $randZ + 1), new Sand()); // Bottom layer of the island // 1st side $levelName->setBlock(new Vector3($randX, $Y - 2, $randZ), new Dirt()); $levelName->setBlock(new Vector3($randX + 6, $Y - 2, $randZ + 6), new Dirt()); $levelName->setBlock(new Vector3($randX + 6, $Y - 2, $randZ + 5), new Dirt()); $levelName->setBlock(new Vector3($randX + 6, $Y - 2, $randZ + 4), new Dirt()); $levelName->setBlock(new Vector3($randX + 6, $Y - 2, $randZ + 3), new Dirt()); $levelName->setBlock(new Vector3($randX + 6, $Y - 2, $randZ + 2), new Dirt()); $levelName->setBlock(new Vector3($randX + 6, $Y - 2, $randZ + 1), new Dirt()); // 2nd side $levelName->setBlock(new Vector3($randX + 5, $Y - 2, $randZ + 6), new Dirt()); $levelName->setBlock(new Vector3($randX + 5, $Y - 2, $randZ + 5), new Dirt()); $levelName->setBlock(new Vector3($randX + 5, $Y - 2, $randZ + 4), new Dirt()); $levelName->setBlock(new Vector3($randX + 5, $Y - 2, $randZ + 3), new Dirt()); $levelName->setBlock(new Vector3($randX + 5, $Y - 2, $randZ + 2), new Dirt()); $levelName->setBlock(new Vector3($randX + 5, $Y - 2, $randZ + 1), new Dirt()); // 3rd side $levelName->setBlock(new Vector3($randX + 4, $Y - 2, $randZ + 6), new Dirt()); $levelName->setBlock(new Vector3($randX + 4, $Y - 2, $randZ + 5), new Dirt()); $levelName->setBlock(new Vector3($randX + 4, $Y - 2, $randZ + 4), new Dirt()); $levelName->setBlock(new Vector3($randX + 4, $Y - 2, $randZ + 3), new Dirt()); $levelName->setBlock(new Vector3($randX + 4, $Y - 2, $randZ + 2), new Dirt()); $levelName->setBlock(new Vector3($randX + 4, $Y - 2, $randZ + 1), new Dirt()); // 4th side $levelName->setBlock(new Vector3($randX + 3, $Y - 2, $randZ + 6), new Dirt()); $levelName->setBlock(new Vector3($randX + 3, $Y - 2, $randZ + 5), new Dirt()); $levelName->setBlock(new Vector3($randX + 3, $Y - 2, $randZ + 4), new Dirt()); $levelName->setBlock(new Vector3($randX + 3, $Y - 2, $randZ + 3), new Dirt()); $levelName->setBlock(new Vector3($randX + 3, $Y - 2, $randZ + 2), new Dirt()); $levelName->setBlock(new Vector3($randX + 3, $Y - 2, $randZ + 1), new Dirt()); // 5th side $levelName->setBlock(new Vector3($randX + 2, $Y - 2, $randZ + 6), new Dirt()); $levelName->setBlock(new Vector3($randX + 2, $Y - 2, $randZ + 5), new Dirt()); $levelName->setBlock(new Vector3($randX + 2, $Y - 2, $randZ + 4), new Dirt()); $levelName->setBlock(new Vector3($randX + 2, $Y - 2, $randZ + 3), new Dirt()); $levelName->setBlock(new Vector3($randX + 2, $Y - 2, $randZ + 2), new Dirt()); $levelName->setBlock(new Vector3($randX + 2, $Y - 2, $randZ + 1), new Dirt()); // 6th side $levelName->setBlock(new Vector3($randX + 1, $Y - 2, $randZ + 6), new Dirt()); $levelName->setBlock(new Vector3($randX + 1, $Y - 2, $randZ + 5), new Dirt()); $levelName->setBlock(new Vector3($randX + 1, $Y - 2, $randZ + 4), new Dirt()); $levelName->setBlock(new Vector3($randX + 1, $Y - 2, $randZ + 3), new Dirt()); $levelName->setBlock(new Vector3($randX + 1, $Y - 2, $randZ + 2), new Dirt()); $levelName->setBlock(new Vector3($randX + 1, $Y - 2, $randZ + 1), new Dirt()); // Tree $type = 0; Tree::growTree($levelName, $randX + 6, $Y + 1, $randZ + 6, new Random(mt_rand()), Sapling::OAK); // Teleport the player to their new island $player->teleport(new Position($randX, $Y + 5, $randZ, $this->getServer()->getLevelByName($levelName))); $player->sendMessage(TextFormat::GREEN . "Welcome to your new island"); $player->sendMessage(TextFormat::GREEN . "If your island didn't spawn,"); $player->sendMessage(TextFormat::GREEN . "Use /is delete"); $player->sendMessage(TextFormat::GREEN . "Then make a new island"); // Give the player a starter kit // String $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); $player->getInventory()->addItem(Item::get(287)); // Emerald $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); $player->getInventory()->addItem(Item::get(388)); // Sapling $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); $player->getInventory()->addItem(Item::get(6)); // Water $player->getInventory()->addItem(Item::get(8)); $player->getInventory()->addItem(Item::get(8)); // Lava $player->getInventory()->addItem(Item::get(10)); // Seeds $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); $player->getInventory()->addItem(Item::get(295)); // Melon seeds $player->getInventory()->addItem(Item::get(362)); // Cactus $player->getInventory()->addItem(Item::get(81)); // Iron $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); $player->getInventory()->addItem(Item::get(265)); // Chest $player->getInventory()->addItem(Item::get(54)); $this->getLogger()->info($name . TextFormat::YELLOW . " made an island"); } }