diff --git a/src/API/QueryAPI.php b/src/API/QueryAPI.php index 46357c6f..531b66cb 100644 --- a/src/API/QueryAPI.php +++ b/src/API/QueryAPI.php @@ -2,7 +2,7 @@ class QueryAPI{ - public static $NOT_FOUND_VALUE; + public static $NOT_FOUND_VALUE; //TODO just use null private $queryData; private $server; diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index 7003300d..8443fdb0 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -143,11 +143,8 @@ class ServerAPI{ Entity::$allowedAI = $this->getProperty("enable-mob-ai", true); //Load advanced properties define("DEBUG", $this->getProperty("debug", 1)); - define("ADVANCED_CACHE", $this->getProperty("enable-advanced-cache", false)); + define("ADVANCED_CACHE", false); //define("MAX_CHUNK_RATE", 20 / $this->getProperty("max-chunks-per-second", 8)); //Default rate ~512 kB/s - if(ADVANCED_CACHE == true){ - console("[INFO] Advanced cache enabled"); - } MobSpawner::$spawnAnimals = $this->getProperty("spawn-animals"); MobSpawner::$spawnMobs = $this->getProperty("spawn-mobs"); if($this->getProperty("upnp-forwarding") == true){ diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 3b9c8333..a70a0965 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -439,7 +439,6 @@ class PocketMinecraftServer{ } $this->schedule(20 * 15, [$this, "checkTicks"], [], true); $this->schedule(20 * 60, [$this, "checkMemory"], [], true); - $this->schedule(20 * 45, "Cache::cleanup", [], true); $this->schedule(20, [$this, "asyncOperationChecker"], [], true); } @@ -488,7 +487,7 @@ class PocketMinecraftServer{ } elseif($this->tick() > 0){ $lastLoop = 0; } else{ - ++ $lastLoop; + ++$lastLoop; if($lastLoop < 16){ usleep(1); } elseif($lastLoop < 128){ diff --git a/src/utils/Cache.php b/src/utils/Cache.php deleted file mode 100644 index 9091e6f5..00000000 --- a/src/utils/Cache.php +++ /dev/null @@ -1,36 +0,0 @@ - $data){ - if($data[1] < $time){ - unset(self::$cached[$index]); - } - } - } -} \ No newline at end of file diff --git a/src/world/Level.php b/src/world/Level.php index 7da4b4c6..1dad5c63 100644 --- a/src/world/Level.php +++ b/src/world/Level.php @@ -292,9 +292,6 @@ class Level{ } $block->position($pos); $i = ($pos->x >> 4) . ":" . ($pos->y >> 4) . ":" . ($pos->z >> 4); - if(ADVANCED_CACHE == true){ - Cache::remove("world:{$this->name}:" . ($pos->x >> 4) . ":" . ($pos->z >> 4)); - } if(!isset($this->changedBlocks[$i])){ $this->changedBlocks[$i] = []; $this->changedCount[$i] = 0; @@ -451,9 +448,6 @@ class Level{ $this->changedBlocks[$i] = []; $this->changedCount[$i] = 0; } - if(ADVANCED_CACHE == true){ - Cache::remove("world:{$this->name}:" . ($pos->x >> 4) . ":" . ($pos->z >> 4)); - } $this->changedBlocks[$i][] = [$block->x, $block->y, $block->z, $block->id, $block->getMetadata()]; ++$this->changedCount[$i]; } @@ -482,9 +476,6 @@ class Level{ return false; } $this->changedCount[$X . ":" . $Y . ":" . $Z] = 4096; - if(ADVANCED_CACHE == true){ - Cache::remove("world:{$this->name}:$X:$Z"); - } return $this->level->setMiniChunk($X, $Z, $Y, $data); } @@ -503,7 +494,6 @@ class Level{ if($force !== true and $this->isSpawnChunk($X, $Z)){ return false; } - Cache::remove("world:{$this->name}:$X:$Z"); return $this->level->unloadChunk($X, $Z, $this->server->saveEnabled); } @@ -511,13 +501,6 @@ class Level{ if(!isset($this->level)){ return false; } - if(ADVANCED_CACHE == true and $Yndex == 0xff){ - $identifier = "world:{$this->name}:$X:$Z"; - if(($cache = Cache::get($identifier)) !== false){ - return $cache; - } - } - $raw = []; for($Y = 0; $Y < 8; ++$Y){ @@ -534,9 +517,6 @@ class Level{ $ordered .= substr($mini, $j << 5, 24); //16 + 8 } } - if(ADVANCED_CACHE == true and $Yndex == 0xff){ - Cache::add($identifier, $ordered, 60); - } return $ordered; }