mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages. This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API. This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
This commit is contained in:
@ -21,8 +21,8 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\format\io;
|
||||
namespace pocketmine\world\format\io;
|
||||
|
||||
abstract class AbstractLevelProvider implements LevelProvider{
|
||||
abstract class AbstractWorldProvider implements WorldProvider{
|
||||
|
||||
}
|
@ -21,8 +21,8 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\format\io;
|
||||
namespace pocketmine\world\format\io;
|
||||
|
||||
interface InterfaceLevelProvider extends LevelProvider{
|
||||
interface InterfaceWorldProvider extends WorldProvider{
|
||||
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\format\io;
|
||||
namespace pocketmine\world\format\io;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@ -30,24 +30,24 @@ class LevelProviderManagerTest extends TestCase{
|
||||
public function testAddNonClassProvider() : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
LevelProviderManager::addProvider("lol", "nope");
|
||||
WorldProviderManager::addProvider("lol", "nope");
|
||||
}
|
||||
|
||||
public function testAddAbstractClassProvider() : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
LevelProviderManager::addProvider(AbstractLevelProvider::class, "abstract");
|
||||
WorldProviderManager::addProvider(AbstractWorldProvider::class, "abstract");
|
||||
}
|
||||
|
||||
public function testAddInterfaceProvider() : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
LevelProviderManager::addProvider(InterfaceLevelProvider::class, "interface");
|
||||
WorldProviderManager::addProvider(InterfaceWorldProvider::class, "interface");
|
||||
}
|
||||
|
||||
public function testAddWrongClassProvider() : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
LevelProviderManager::addProvider(LevelProviderManagerTest::class, "bad_class");
|
||||
WorldProviderManager::addProvider(LevelProviderManagerTest::class, "bad_class");
|
||||
}
|
||||
}
|
||||
|
38
tests/phpunit/level/format/io/SubChunkConverter.php
Normal file
38
tests/phpunit/level/format/io/SubChunkConverter.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\format\io;
|
||||
|
||||
use pocketmine\world\format\PalettedBlockArray;
|
||||
|
||||
die("This is a stub file for code completion purposes");
|
||||
|
||||
//TODO: this can't be moved right now because of compatibility issues with the extension
|
||||
class SubChunkConverter{
|
||||
public static function convertSubChunkXZY(string $idArray, string $metaArray) : PalettedBlockArray{}
|
||||
|
||||
public static function convertSubChunkYZX(string $idArray, string $metaArray) : PalettedBlockArray{}
|
||||
|
||||
public static function convertSubChunkFromLegacyColumn(string $idArray, string $metaArray, int $yOffset) : PalettedBlockArray{}
|
||||
|
||||
}
|
@ -21,10 +21,10 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\level\format\io\region;
|
||||
namespace pocketmine\world\format\io\region;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use pocketmine\level\format\ChunkException;
|
||||
use pocketmine\world\format\ChunkException;
|
||||
use function file_exists;
|
||||
use function random_bytes;
|
||||
use function str_repeat;
|
||||
@ -105,11 +105,12 @@ class RegionLoaderTest extends TestCase{
|
||||
|
||||
/**
|
||||
* @dataProvider outOfBoundsCoordsProvider
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $z
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws \pocketmine\level\format\io\exception\CorruptedChunkException
|
||||
* @throws \pocketmine\world\format\io\exception\CorruptedChunkException
|
||||
*/
|
||||
public function testReadChunkOutOfBounds(int $x, int $z) : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
Reference in New Issue
Block a user