mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
Removed redundant filePath from Server constructor
This parameter is hardcoded to \pocketmine\PATH in PocketMine.php. Additionally, it does not make sense for the server source path to not be the server source path. \pocketmine\PATH is accessible from the Server context, therefore it should be used and does not need to be stored.
This commit is contained in:
parent
e58db75396
commit
98cb7f2e10
@ -549,7 +549,7 @@ namespace pocketmine {
|
||||
}
|
||||
|
||||
ThreadManager::init();
|
||||
new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||
new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||
|
||||
$logger->info("Stopping other threads");
|
||||
|
||||
|
@ -234,7 +234,6 @@ class Server{
|
||||
private $serverID;
|
||||
|
||||
private $autoloader;
|
||||
private $filePath;
|
||||
private $dataPath;
|
||||
private $pluginPath;
|
||||
|
||||
@ -318,7 +317,7 @@ class Server{
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath() : string{
|
||||
return $this->filePath;
|
||||
return \pocketmine\PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1422,19 +1421,16 @@ class Server{
|
||||
/**
|
||||
* @param \ClassLoader $autoloader
|
||||
* @param \ThreadedLogger $logger
|
||||
* @param string $filePath
|
||||
* @param string $dataPath
|
||||
* @param string $pluginPath
|
||||
*/
|
||||
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, string $filePath, string $dataPath, string $pluginPath){
|
||||
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, string $dataPath, string $pluginPath){
|
||||
self::$instance = $this;
|
||||
self::$sleeper = new \Threaded;
|
||||
$this->autoloader = $autoloader;
|
||||
$this->logger = $logger;
|
||||
|
||||
try{
|
||||
|
||||
$this->filePath = $filePath;
|
||||
if(!file_exists($dataPath . "worlds/")){
|
||||
mkdir($dataPath . "worlds/", 0777);
|
||||
}
|
||||
@ -1456,7 +1452,7 @@ class Server{
|
||||
|
||||
$this->logger->info("Loading pocketmine.yml...");
|
||||
if(!file_exists($this->dataPath . "pocketmine.yml")){
|
||||
$content = file_get_contents($this->filePath . "src/pocketmine/resources/pocketmine.yml");
|
||||
$content = file_get_contents(\pocketmine\PATH . "src/pocketmine/resources/pocketmine.yml");
|
||||
if($version->isDev()){
|
||||
$content = str_replace("preferred-channel: stable", "preferred-channel: beta", $content);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user