mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Replace disallowed operators in src/world/
This commit is contained in:
@@ -104,7 +104,7 @@ class WorldManager{
|
||||
* it only affects the server on runtime
|
||||
*/
|
||||
public function setDefaultWorld(?World $world) : void{
|
||||
if($world === null or ($this->isWorldLoaded($world->getFolderName()) and $world !== $this->defaultWorld)){
|
||||
if($world === null || ($this->isWorldLoaded($world->getFolderName()) && $world !== $this->defaultWorld)){
|
||||
$this->defaultWorld = $world;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class WorldManager{
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function unloadWorld(World $world, bool $forceUnload = false) : bool{
|
||||
if($world === $this->getDefaultWorld() and !$forceUnload){
|
||||
if($world === $this->getDefaultWorld() && !$forceUnload){
|
||||
throw new \InvalidArgumentException("The default world cannot be unloaded while running, please switch worlds.");
|
||||
}
|
||||
if($world->isDoingTick()){
|
||||
@@ -142,13 +142,13 @@ class WorldManager{
|
||||
}
|
||||
|
||||
$ev = new WorldUnloadEvent($world);
|
||||
if($world === $this->defaultWorld and !$forceUnload){
|
||||
if($world === $this->defaultWorld && !$forceUnload){
|
||||
$ev->cancel();
|
||||
}
|
||||
|
||||
$ev->call();
|
||||
|
||||
if(!$forceUnload and $ev->isCancelled()){
|
||||
if(!$forceUnload && $ev->isCancelled()){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class WorldManager{
|
||||
$safeSpawn = null;
|
||||
}
|
||||
foreach($world->getPlayers() as $player){
|
||||
if($world === $this->defaultWorld or $safeSpawn === null){
|
||||
if($world === $this->defaultWorld || $safeSpawn === null){
|
||||
$player->disconnect("Forced default world unload");
|
||||
}else{
|
||||
$player->teleport($safeSpawn);
|
||||
@@ -271,7 +271,7 @@ class WorldManager{
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function generateWorld(string $name, WorldCreationOptions $options, bool $backgroundGeneration = true) : bool{
|
||||
if(trim($name) === "" or $this->isWorldGenerated($name)){
|
||||
if(trim($name) === "" || $this->isWorldGenerated($name)){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ class WorldManager{
|
||||
}
|
||||
}
|
||||
|
||||
if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){
|
||||
if($this->autoSave && ++$this->autoSaveTicker >= $this->autoSaveTicks){
|
||||
$this->autoSaveTicker = 0;
|
||||
$this->server->getLogger()->debug("[Auto Save] Saving worlds...");
|
||||
$start = microtime(true);
|
||||
|
Reference in New Issue
Block a user