s/level/world (strings only)

we should look at doing this for code too, but for now I'm not planning to break everyone's plugins.
This commit is contained in:
Dylan K. Taylor 2019-02-20 15:33:46 +00:00
parent 9354929cad
commit 58cafc853f
7 changed files with 23 additions and 23 deletions

View File

@ -1577,7 +1577,7 @@ class Server{
}
public function reload(){
$this->logger->info("Saving levels...");
$this->logger->info("Saving worlds...");
foreach($this->levelManager->getLevels() as $level){
$level->save();
@ -1653,7 +1653,7 @@ class Server{
}
if($this->levelManager instanceof LevelManager){
$this->getLogger()->debug("Unloading all levels");
$this->getLogger()->debug("Unloading all worlds");
foreach($this->levelManager->getLevels() as $level){
$this->levelManager->unloadLevel($level, true);
}

View File

@ -71,7 +71,7 @@ class Explosion{
*/
public function __construct(Position $center, float $size, $what = null){
if(!$center->isValid()){
throw new \InvalidArgumentException("Position does not have a valid level");
throw new \InvalidArgumentException("Position does not have a valid world");
}
$this->source = $center;
$this->level = $center->getLevel();

View File

@ -458,7 +458,7 @@ class Level implements ChunkManager, Metadatable{
*/
public function close(){
if($this->closed){
throw new \InvalidStateException("Tried to close a level which is already closed");
throw new \InvalidStateException("Tried to close a world which is already closed");
}
foreach($this->chunks as $chunk){
@ -753,7 +753,7 @@ class Level implements ChunkManager, Metadatable{
*/
public function doTick(int $currentTick){
if($this->closed){
throw new \InvalidStateException("Attempted to tick a Level which has been closed");
throw new \InvalidStateException("Attempted to tick a world which has been closed");
}
$this->timings->doTick->startTiming();
@ -2488,7 +2488,7 @@ class Level implements ChunkManager, Metadatable{
$this->timings->syncChunkSendTimer->stopTiming();
}else{
$this->server->getLogger()->debug("Dropped prepared chunk $x $z due to level not loaded");
$this->server->getLogger()->debug("Dropped prepared chunk $x $z due to world not loaded");
}
});
$this->server->getAsyncPool()->submitTask($task = new ChunkRequestTask($x, $z, $chunk, $promise));
@ -2508,10 +2508,10 @@ class Level implements ChunkManager, Metadatable{
*/
public function addEntity(Entity $entity){
if($entity->isClosed()){
throw new \InvalidArgumentException("Attempted to add a garbage closed Entity to Level");
throw new \InvalidArgumentException("Attempted to add a garbage closed Entity to world");
}
if($entity->getLevel() !== $this){
throw new \InvalidArgumentException("Invalid Entity level");
throw new \InvalidArgumentException("Invalid Entity world");
}
if($entity instanceof Player){
@ -2529,7 +2529,7 @@ class Level implements ChunkManager, Metadatable{
*/
public function removeEntity(Entity $entity){
if($entity->getLevel() !== $this){
throw new \InvalidArgumentException("Invalid Entity level");
throw new \InvalidArgumentException("Invalid Entity world");
}
if($entity instanceof Player){
@ -2548,10 +2548,10 @@ class Level implements ChunkManager, Metadatable{
*/
public function addTile(Tile $tile){
if($tile->isClosed()){
throw new \InvalidArgumentException("Attempted to add a garbage closed Tile to Level");
throw new \InvalidArgumentException("Attempted to add a garbage closed Tile to world");
}
if($tile->getLevel() !== $this){
throw new \InvalidArgumentException("Invalid Tile level");
throw new \InvalidArgumentException("Invalid Tile world");
}
$chunkX = $tile->getFloorX() >> 4;
@ -2573,7 +2573,7 @@ class Level implements ChunkManager, Metadatable{
*/
public function removeTile(Tile $tile){
if($tile->getLevel() !== $this){
throw new \InvalidArgumentException("Invalid Tile level");
throw new \InvalidArgumentException("Invalid Tile world");
}
unset($this->updateTiles[Level::blockHash($tile->x, $tile->y, $tile->z)]);

View File

@ -162,10 +162,10 @@ class LevelManager{
*/
public function unloadLevel(Level $level, bool $forceUnload = false) : bool{
if($level === $this->getDefaultLevel() and !$forceUnload){
throw new \InvalidArgumentException("The default level cannot be unloaded while running, please switch levels.");
throw new \InvalidArgumentException("The default world cannot be unloaded while running, please switch worlds.");
}
if($level->isDoingTick()){
throw new \InvalidArgumentException("Cannot unload a level during level tick");
throw new \InvalidArgumentException("Cannot unload a world during world tick");
}
$ev = new LevelUnloadEvent($level);
@ -182,7 +182,7 @@ class LevelManager{
$this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.unloading", [$level->getDisplayName()]));
foreach($level->getPlayers() as $player){
if($level === $this->levelDefault or $this->levelDefault === null){
$player->close($player->getLeaveMessage(), "Forced default level unload");
$player->close($player->getLeaveMessage(), "Forced default world unload");
}elseif($this->levelDefault instanceof Level){
$player->teleport($this->levelDefault->getSafeSpawn());
}
@ -208,7 +208,7 @@ class LevelManager{
*/
public function loadLevel(string $name) : bool{
if(trim($name) === ""){
throw new LevelException("Invalid empty level name");
throw new LevelException("Invalid empty world name");
}
if($this->isLevelLoaded($name)){
return true;
@ -382,14 +382,14 @@ class LevelManager{
if($r > $this->baseTickRate){
$level->tickRateCounter = $level->getTickRate();
}
$this->server->getLogger()->debug("Raising level \"{$level->getDisplayName()}\" tick rate to {$level->getTickRate()} ticks");
$this->server->getLogger()->debug("Raising world \"{$level->getDisplayName()}\" tick rate to {$level->getTickRate()} ticks");
}elseif($tickMs >= 50){
if($level->getTickRate() === $this->baseTickRate){
$level->setTickRate(max($this->baseTickRate + 1, min($this->autoTickRateLimit, (int) floor($tickMs / 50))));
$this->server->getLogger()->debug(sprintf("Level \"%s\" took %gms, setting tick rate to %d ticks", $level->getDisplayName(), (int) round($tickMs, 2), $level->getTickRate()));
$this->server->getLogger()->debug(sprintf("World \"%s\" took %gms, setting tick rate to %d ticks", $level->getDisplayName(), (int) round($tickMs, 2), $level->getTickRate()));
}elseif(($tickMs / $level->getTickRate()) >= 50 and $level->getTickRate() < $this->autoTickRateLimit){
$level->setTickRate($level->getTickRate() + 1);
$this->server->getLogger()->debug(sprintf("Level \"%s\" took %gms, setting tick rate to %d ticks", $level->getDisplayName(), (int) round($tickMs, 2), $level->getTickRate()));
$this->server->getLogger()->debug(sprintf("World \"%s\" took %gms, setting tick rate to %d ticks", $level->getDisplayName(), (int) round($tickMs, 2), $level->getTickRate()));
}
$level->tickRateCounter = $level->getTickRate();
}

View File

@ -63,7 +63,7 @@ class Position extends Vector3{
*/
public function getLevel(){
if($this->level !== null and $this->level->isClosed()){
\GlobalLogger::get()->debug("Position was holding a reference to an unloaded Level");
\GlobalLogger::get()->debug("Position was holding a reference to an unloaded world");
$this->level = null;
}
@ -81,7 +81,7 @@ class Position extends Vector3{
*/
public function setLevel(Level $level = null){
if($level !== null and $level->isClosed()){
throw new \InvalidArgumentException("Specified level has been unloaded and cannot be used");
throw new \InvalidArgumentException("Specified world has been unloaded and cannot be used");
}
$this->level = $level;

View File

@ -37,7 +37,7 @@ abstract class BaseLevelProvider implements LevelProvider{
public function __construct(string $path){
if(!file_exists($path)){
throw new LevelException("Level does not exist");
throw new LevelException("World does not exist");
}
$this->path = $path;

View File

@ -130,7 +130,7 @@ class BedrockLevelData extends BaseNbtLevelData{
case self::GENERATOR_LIMITED:
throw new UnsupportedLevelFormatException("Limited worlds are not currently supported");
default:
throw new UnsupportedLevelFormatException("Unknown LevelDB world format type, this level cannot be loaded");
throw new UnsupportedLevelFormatException("Unknown LevelDB world format type, this world cannot be loaded");
}
}else{
$this->compoundTag->setString("generatorName", "default");