From e0818e7e5285f0a78bb2c46c8b9693d10020008a Mon Sep 17 00:00:00 2001 From: David Schwartz Date: Fri, 29 Jun 2018 09:48:29 -0400 Subject: [PATCH 01/14] reorganize and optimize start.sh (#2267) --- start.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/start.sh b/start.sh index fcc6dd074..ac84f829d 100755 --- a/start.sh +++ b/start.sh @@ -2,8 +2,6 @@ DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" cd "$DIR" -DO_LOOP="no" - while getopts "p:f:l" OPTION 2> /dev/null; do case ${OPTION} in p) @@ -46,19 +44,18 @@ fi LOOPS=0 set +e -while [ "$LOOPS" -eq 0 ] || [ "$DO_LOOP" == "yes" ]; do - if [ "$DO_LOOP" == "yes" ]; then - "$PHP_BINARY" "$POCKETMINE_FILE" $@ - else - exec "$PHP_BINARY" "$POCKETMINE_FILE" $@ - fi - if [ "$DO_LOOP" == "yes" ]; then + +if [ "$DO_LOOP" == "yes" ]; then + while true; do if [ ${LOOPS} -gt 0 ]; then echo "Restarted $LOOPS times" fi + "$PHP_BINARY" "$POCKETMINE_FILE" $@ echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart." echo "" sleep 5 ((LOOPS++)) - fi -done + done +else + exec "$PHP_BINARY" "$POCKETMINE_FILE" $@ +fi From b6b3dcc1aa3255d819b24d3705979c3564c55a53 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 18 Jul 2018 11:01:16 +0100 Subject: [PATCH 02/14] Improve documentation of SourceInterface and AdvancedSourceInterface --- src/pocketmine/network/AdvancedSourceInterface.php | 10 ++++++++++ src/pocketmine/network/SourceInterface.php | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/network/AdvancedSourceInterface.php b/src/pocketmine/network/AdvancedSourceInterface.php index 3e58140f2..44bf863ed 100644 --- a/src/pocketmine/network/AdvancedSourceInterface.php +++ b/src/pocketmine/network/AdvancedSourceInterface.php @@ -26,15 +26,23 @@ declare(strict_types=1); */ namespace pocketmine\network; +/** + * Advanced network interfaces have some additional capabilities, such as being able to ban addresses and process raw + * packets. + */ interface AdvancedSourceInterface extends SourceInterface{ /** + * Prevents packets received from the IP address getting processed for the given timeout. + * * @param string $address * @param int $timeout Seconds */ public function blockAddress(string $address, int $timeout = 300); /** + * Unblocks a previously-blocked address. + * * @param string $address */ public function unblockAddress(string $address); @@ -45,6 +53,8 @@ interface AdvancedSourceInterface extends SourceInterface{ public function setNetwork(Network $network); /** + * Sends a raw payload to the network interface, bypassing any sessions. + * * @param string $address * @param int $port * @param string $payload diff --git a/src/pocketmine/network/SourceInterface.php b/src/pocketmine/network/SourceInterface.php index 02f47488d..75e14c98b 100644 --- a/src/pocketmine/network/SourceInterface.php +++ b/src/pocketmine/network/SourceInterface.php @@ -30,7 +30,7 @@ use pocketmine\network\mcpe\protocol\DataPacket; use pocketmine\Player; /** - * Classes that implement this interface will be able to be attached to players + * Network interfaces are transport layers which can be used to transmit packets between the server and clients. */ interface SourceInterface{ @@ -69,10 +69,14 @@ interface SourceInterface{ */ public function process() : void; + /** + * Gracefully shuts down the network interface. + */ public function shutdown(); /** * @deprecated + * Shuts down the network interface in an emergency situation, such as due to a crash. */ public function emergencyShutdown(); From 810bdeb965777ce94f513bb92b90ca157227d663 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 26 Jul 2018 15:17:16 +0100 Subject: [PATCH 03/14] Test one extra case for LevelProviderManager --- tests/phpunit/level/format/io/LevelProviderManagerTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/phpunit/level/format/io/LevelProviderManagerTest.php b/tests/phpunit/level/format/io/LevelProviderManagerTest.php index 7661de234..64b620622 100644 --- a/tests/phpunit/level/format/io/LevelProviderManagerTest.php +++ b/tests/phpunit/level/format/io/LevelProviderManagerTest.php @@ -44,4 +44,10 @@ class LevelProviderManagerTest extends TestCase{ LevelProviderManager::addProvider(InterfaceLevelProvider::class); } + + public function testAddWrongClassProvider() : void{ + $this->expectException(\InvalidArgumentException::class); + + LevelProviderManager::addProvider(LevelProviderManagerTest::class); + } } From 25890e76e23ad32153577b144b222505ebefb56c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 7 Aug 2018 17:33:57 +0100 Subject: [PATCH 04/14] Player: replace redundant usage of Server->broadcast() --- src/pocketmine/Player.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 7ffcb0e1e..490240df7 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3644,7 +3644,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->setXpAndProgress(0, 0); if($ev->getDeathMessage() != ""){ - $this->server->broadcast($ev->getDeathMessage(), Server::BROADCAST_CHANNEL_USERS); + $this->server->broadcastMessage($ev->getDeathMessage()); } } From 39360f127a6871f019d9a352a8b538fb5fd4189f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 18 Aug 2018 13:42:00 +0100 Subject: [PATCH 05/14] Player: Don't use iusername in cases where it's useless these calls all do strtolower() anyway, so having iusername here just makes it confusing. --- src/pocketmine/Player.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 490240df7..2997ce568 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -393,7 +393,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } public function isBanned() : bool{ - return $this->server->getNameBans()->isBanned($this->iusername); + return $this->server->getNameBans()->isBanned($this->username); } public function setBanned(bool $value){ @@ -406,14 +406,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } public function isWhitelisted() : bool{ - return $this->server->isWhitelisted($this->iusername); + return $this->server->isWhitelisted($this->username); } public function setWhitelisted(bool $value){ if($value){ - $this->server->addWhitelist($this->iusername); + $this->server->addWhitelist($this->username); }else{ - $this->server->removeWhitelist($this->iusername); + $this->server->removeWhitelist($this->username); } } @@ -1931,7 +1931,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ return true; } - if(!$this->server->isWhitelisted($this->iusername) and $this->kick("Server is white-listed", false)){ + if(!$this->server->isWhitelisted($this->username) and $this->kick("Server is white-listed", false)){ return true; } From 48dfc5b232cd9ac224a57f31e0a55d573bb6d38e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 18 Oct 2018 15:43:17 +0100 Subject: [PATCH 06/14] Level: reduce complexity of populateChunk() --- src/pocketmine/level/Level.php | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index f09bfb045..22f7a8348 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -3108,35 +3108,31 @@ class Level implements ChunkManager, Metadatable{ if(isset($this->chunkPopulationQueue[$index = Level::chunkHash($x, $z)]) or (count($this->chunkPopulationQueue) >= $this->chunkPopulationQueueSize and !$force)){ return false; } + for($xx = -1; $xx <= 1; ++$xx){ + for($zz = -1; $zz <= 1; ++$zz){ + if(isset($this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)])){ + return false; + } + } + } $chunk = $this->getChunk($x, $z, true); if(!$chunk->isPopulated()){ Timings::$populationTimer->startTiming(); - $populate = true; + + $this->chunkPopulationQueue[$index] = true; for($xx = -1; $xx <= 1; ++$xx){ for($zz = -1; $zz <= 1; ++$zz){ - if(isset($this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)])){ - $populate = false; - break; - } + $this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)] = true; } } - if($populate){ - $this->chunkPopulationQueue[$index] = true; - for($xx = -1; $xx <= 1; ++$xx){ - for($zz = -1; $zz <= 1; ++$zz){ - $this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)] = true; - } - } - - $task = new PopulationTask($this, $chunk); - $workerId = $this->server->getAsyncPool()->selectWorker(); - if(!isset($this->generatorRegisteredWorkers[$workerId])){ - $this->registerGeneratorToWorker($workerId); - } - $this->server->getAsyncPool()->submitTaskToWorker($task, $workerId); + $task = new PopulationTask($this, $chunk); + $workerId = $this->server->getAsyncPool()->selectWorker(); + if(!isset($this->generatorRegisteredWorkers[$workerId])){ + $this->registerGeneratorToWorker($workerId); } + $this->server->getAsyncPool()->submitTaskToWorker($task, $workerId); Timings::$populationTimer->stopTiming(); return false; From 3b103dcd622580efcab67a2e8b08ba3f8153c346 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 4 Nov 2018 12:59:34 +0000 Subject: [PATCH 07/14] Level: use isInWorld() where appropriate --- src/pocketmine/level/Level.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 22f7a8348..2c0e512bd 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1898,7 +1898,7 @@ class Level implements ChunkManager, Metadatable{ $clickVector = new Vector3(0.0, 0.0, 0.0); } - if($blockReplace->y >= $this->worldHeight or $blockReplace->y < 0){ + if(!$this->isInWorld($blockReplace->x, $blockReplace->y, $blockReplace->z)){ //TODO: build height limit messages for custom world heights and mcregion cap return false; } From 86c4e936cbb08f4acf7952a37743b33a84423aa8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 25 Nov 2018 17:13:35 +0000 Subject: [PATCH 08/14] Player now drops the contents of temporary inventories these inventories are just glorified crafting tables. --- src/pocketmine/inventory/AnvilInventory.php | 5 ++++- src/pocketmine/inventory/EnchantInventory.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/inventory/AnvilInventory.php b/src/pocketmine/inventory/AnvilInventory.php index 7d74fdc01..c13d87251 100644 --- a/src/pocketmine/inventory/AnvilInventory.php +++ b/src/pocketmine/inventory/AnvilInventory.php @@ -59,6 +59,9 @@ class AnvilInventory extends ContainerInventory{ public function onClose(Player $who) : void{ parent::onClose($who); - $this->dropContents($this->holder->getLevel(), $this->holder->add(0.5, 0.5, 0.5)); + foreach($this->getContents() as $item){ + $who->dropItem($item); + } + $this->clearAll(); } } diff --git a/src/pocketmine/inventory/EnchantInventory.php b/src/pocketmine/inventory/EnchantInventory.php index e6f9cf118..059b229b6 100644 --- a/src/pocketmine/inventory/EnchantInventory.php +++ b/src/pocketmine/inventory/EnchantInventory.php @@ -59,6 +59,9 @@ class EnchantInventory extends ContainerInventory{ public function onClose(Player $who) : void{ parent::onClose($who); - $this->dropContents($this->holder->getLevel(), $this->holder->add(0.5, 0.5, 0.5)); + foreach($this->getContents() as $item){ + $who->dropItem($item); + } + $this->clearAll(); } } From c2c210e25a89c3f938b37835c459c02860532daa Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 29 Dec 2018 11:23:32 +0000 Subject: [PATCH 09/14] Fixed --enable-ansi and --disable-ansi not being respected on threads this causes some breakage to the behaviour of Terminal, and for that reason this is going on 4.0. Terminal::hasFormattingCodes() will no longer auto-detect whether colour codes are supported. --- src/pocketmine/PocketMine.php | 10 ++++++- src/pocketmine/utils/MainLogger.php | 14 ++++------ src/pocketmine/utils/Terminal.php | 43 +++++++++++++++-------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index fa7eee849..04c07673c 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -177,7 +177,7 @@ namespace pocketmine { define('pocketmine\RESOURCE_PATH', \pocketmine\PATH . 'src' . DIRECTORY_SEPARATOR . 'pocketmine' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR); - $opts = getopt("", ["data:", "plugins:", "no-wizard"]); + $opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]); define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR); define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR); @@ -197,6 +197,14 @@ namespace pocketmine { //Logger has a dependency on timezone $tzError = Timezone::init(); + if(isset($opts["enable-ansi"])){ + Terminal::init(true); + }elseif(isset($opts["disable-ansi"])){ + Terminal::init(false); + }else{ + Terminal::init(); + } + $logger = new MainLogger(\pocketmine\DATA . "server.log"); $logger->registerStatic(); diff --git a/src/pocketmine/utils/MainLogger.php b/src/pocketmine/utils/MainLogger.php index f3922d00f..83d0f379b 100644 --- a/src/pocketmine/utils/MainLogger.php +++ b/src/pocketmine/utils/MainLogger.php @@ -302,20 +302,18 @@ class MainLogger extends \AttachableThreadedLogger{ $message = sprintf($this->format, $time->format("H:i:s"), $color, $threadName, $prefix, $message); - $this->synchronized(function() use ($message, $level, $time) : void{ - $cleanMessage = TextFormat::clean($message); + if(!Terminal::isInit()){ + Terminal::init($this->mainThreadHasFormattingCodes); //lazy-init colour codes because we don't know if they've been registered on this thread + } - if($this->mainThreadHasFormattingCodes and Terminal::hasFormattingCodes()){ //hasFormattingCodes() lazy-inits colour codes because we don't know if they've been registered on this thread - echo Terminal::toANSI($message) . PHP_EOL; - }else{ - echo $cleanMessage . PHP_EOL; - } + $this->synchronized(function() use ($message, $level, $time) : void{ + echo Terminal::toANSI($message) . PHP_EOL; foreach($this->attachments as $attachment){ $attachment->call($level, $message); } - $this->logStream[] = $time->format("Y-m-d") . " " . $cleanMessage . PHP_EOL; + $this->logStream[] = $time->format("Y-m-d") . " " . TextFormat::clean($message) . PHP_EOL; }); } diff --git a/src/pocketmine/utils/Terminal.php b/src/pocketmine/utils/Terminal.php index 5d1d171b4..5061f76cf 100644 --- a/src/pocketmine/utils/Terminal.php +++ b/src/pocketmine/utils/Terminal.php @@ -57,31 +57,29 @@ abstract class Terminal{ public static $COLOR_YELLOW = ""; public static $COLOR_WHITE = ""; + /** @var bool|null */ private static $formattingCodes = null; - public static function hasFormattingCodes(){ + public static function hasFormattingCodes() : bool{ if(self::$formattingCodes === null){ - $opts = getopt("", ["enable-ansi", "disable-ansi"]); - if(isset($opts["disable-ansi"])){ - self::$formattingCodes = false; - }else{ - $stdout = fopen("php://stdout", "w"); - self::$formattingCodes = (isset($opts["enable-ansi"]) or ( //user explicitly told us to enable ANSI - stream_isatty($stdout) and //STDOUT isn't being piped - ( - getenv('TERM') !== false or //Console says it supports colours - (function_exists('sapi_windows_vt100_support') and sapi_windows_vt100_support($stdout)) //we're on windows and have vt100 support - ) - )); - fclose($stdout); - } - - self::init(); + throw new \InvalidStateException("Formatting codes have not been initialized"); } - return self::$formattingCodes; } + private static function detectFormattingCodesSupport() : bool{ + $stdout = fopen("php://stdout", "w"); + $result = ( + stream_isatty($stdout) and //STDOUT isn't being piped + ( + getenv('TERM') !== false or //Console says it supports colours + (function_exists('sapi_windows_vt100_support') and sapi_windows_vt100_support($stdout)) //we're on windows and have vt100 support + ) + ); + fclose($stdout); + return $result; + } + protected static function getFallbackEscapeCodes(){ self::$FORMAT_BOLD = "\x1b[1m"; self::$FORMAT_OBFUSCATED = ""; @@ -148,8 +146,9 @@ abstract class Terminal{ } } - public static function init(){ - if(!self::hasFormattingCodes()){ + public static function init(?bool $enableFormatting = null) : void{ + self::$formattingCodes = $enableFormatting ?? self::detectFormattingCodesSupport(); + if(!self::$formattingCodes){ return; } @@ -169,6 +168,10 @@ abstract class Terminal{ //TODO: iOS } + public static function isInit() : bool{ + return self::$formattingCodes !== null; + } + /** * Returns a string with colorized ANSI Escape codes for the current terminal * Note that this is platform-dependent and might produce different results depending on the terminal type and/or OS. From 00644dd529eb99ab3def2975aa26c06757584128 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 7 Jan 2019 22:23:51 +0000 Subject: [PATCH 10/14] Fixed an edge-case in AvailableCommandsPacket decoding --- .../network/mcpe/protocol/AvailableCommandsPacket.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php index b158a6d84..e61668c2c 100644 --- a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php @@ -147,8 +147,12 @@ class AvailableCommandsPacket extends DataPacket{ $retval->enumName = $this->getString(); for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){ + $index = $this->getEnumValueIndex(); + if(!isset($this->enumValues[$index])){ + throw new \UnexpectedValueException("Invalid enum value index $index"); + } //Get the enum value from the initial pile of mess - $retval->enumValues[] = $this->enumValues[$this->getEnumValueIndex()]; + $retval->enumValues[] = $this->enumValues[$index]; } return $retval; From 396efbac7e02bf5e909ea4045b475508f2c6b72c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Jan 2019 17:33:58 +0000 Subject: [PATCH 11/14] Human: simplify setFood() --- src/pocketmine/entity/Human.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 1ab41d691..a058fc23e 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -196,18 +196,13 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $old = $attr->getValue(); $attr->setValue($new); - $reset = false; // ranges: 18-20 (regen), 7-17 (none), 1-6 (no sprint), 0 (health depletion) foreach([17, 6, 0] as $bound){ if(($old > $bound) !== ($new > $bound)){ - $reset = true; + $this->foodTickTimer = 0; break; } } - if($reset){ - $this->foodTickTimer = 0; - } - } public function getMaxFood() : float{ From 3c90ed13b9cf0c9aeeb4186e3bbd9a0050e9e609 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 28 Feb 2019 19:59:33 +0000 Subject: [PATCH 12/14] NoteBlock: added //TODO --- src/pocketmine/block/NoteBlock.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pocketmine/block/NoteBlock.php b/src/pocketmine/block/NoteBlock.php index ca0d3c661..cd9c0dc79 100644 --- a/src/pocketmine/block/NoteBlock.php +++ b/src/pocketmine/block/NoteBlock.php @@ -46,4 +46,6 @@ class NoteBlock extends Solid{ public function getToolType() : int{ return BlockToolType::TYPE_AXE; } + + //TODO } From 22d9260a3bd4df2c669e26190c9a6143c03b01e8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 26 Apr 2019 13:56:32 +0100 Subject: [PATCH 13/14] remove unused import --- src/pocketmine/utils/Terminal.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pocketmine/utils/Terminal.php b/src/pocketmine/utils/Terminal.php index 5061f76cf..dd52d6951 100644 --- a/src/pocketmine/utils/Terminal.php +++ b/src/pocketmine/utils/Terminal.php @@ -27,7 +27,6 @@ use function fclose; use function fopen; use function function_exists; use function getenv; -use function getopt; use function is_array; use function stream_isatty; From d850a84d0d57519929b43703631b5aca3082f3ba Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 6 Aug 2018 19:00:00 +0100 Subject: [PATCH 14/14] Level: clean up and remove checkTime() --- src/pocketmine/level/Level.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 2c0e512bd..4834377cd 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -755,17 +755,6 @@ class Level implements ChunkManager, Metadatable{ } } - /** - * @internal - */ - public function checkTime(){ - if($this->stopTime){ - return; - }else{ - ++$this->time; - } - } - /** * @internal * @@ -800,7 +789,9 @@ class Level implements ChunkManager, Metadatable{ } protected function actuallyDoTick(int $currentTick) : void{ - $this->checkTime(); + if(!$this->stopTime){ + $this->time++; + } $this->sunAnglePercentage = $this->computeSunAnglePercentage(); //Sun angle depends on the current time $this->skyLightReduction = $this->computeSkyLightReduction(); //Sky light reduction depends on the sun angle