Fixed constructors, default memory to -1, default async generator

This commit is contained in:
Shoghi Cervantes 2015-03-14 15:50:33 +01:00
parent 11c13cd666
commit 94c2ec8498
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
5 changed files with 11 additions and 12 deletions

View File

@ -116,7 +116,7 @@ namespace pocketmine {
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "256M"); //Default
ini_set("memory_limit", -1);
define("pocketmine\\START_TIME", microtime(true));
$opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]);

View File

@ -1508,7 +1508,7 @@ class Server{
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, [
"motd" => "Minecraft: PE Server",
"server-port" => 19132,
"memory-limit" => "256M",
"memory-limit" => -1,
"white-list" => false,
"announce-player-achievements" => true,
"spawn-protection" => 16,
@ -1558,15 +1558,15 @@ class Server{
$this->maxPlayers = $this->getConfigInt("max-players", 20);
$this->setAutoSave($this->getConfigBoolean("auto-save", true));
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", -1)))) !== false and $memory > 1){
$value = ["M" => 1, "G" => 1024];
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
if($real < 128){
$this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0);
$this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM");
}
@ini_set("memory_limit", $memory);
}else{
$this->setConfigString("memory-limit", "256M");
$this->setConfigString("memory-limit", -1);
}
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){
@ -1852,7 +1852,7 @@ class Server{
$this->properties->reload();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", -1)))) !== false and $memory > 1){
$value = ["M" => 1, "G" => 1024];
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
if($real < 256){
@ -1860,7 +1860,7 @@ class Server{
}
@ini_set("memory_limit", $memory);
}else{
$this->setConfigString("memory-limit", "256M");
$this->setConfigString("memory-limit", -1);
}
if($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3){

View File

@ -32,7 +32,7 @@ class CommandReader extends Thread{
/**
* @param \Threaded $threaded
*/
public function __construct(\Threaded $threaded){
public function __construct(){
$this->buffer = \ThreadedFactory::create();
$this->start();
}

View File

@ -77,7 +77,7 @@ class GenerationThread extends Thread{
return $this->logger;
}
public function __construct(\Threaded $internalThreaded, \Threaded $externalThreaded, \ThreadedLogger $logger, \ClassLoader $loader){
public function __construct(\ThreadedLogger $logger, \ClassLoader $loader){
$this->loader = $loader;
$this->logger = $logger;
$loadPaths = [];

View File

@ -52,8 +52,7 @@ chunk-generation:
#Whether to run the generation on a different thread or on the main thread
#Generation will be less glitchy on the main thread, but will lag more
#Using this with fast generators is recommended
#If enabled, the dedicated generation thread may leak memory
use-async: false
use-async: true
#Max. amount of chunks to generate per tick, only for use-async: false
per-tick: 1