Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor
2020-01-11 22:36:57 +00:00
12 changed files with 137 additions and 4 deletions

View File

@@ -73,6 +73,11 @@ final class Filesystem{
}
}
/**
* @param string $path
*
* @return string
*/
public static function cleanPath($path){
$result = str_replace(["\\", ".php", "phar://"], ["/", "", ""], $path);

View File

@@ -223,6 +223,12 @@ class MainLogger extends \AttachableThreadedLogger{
$this->notify();
}
/**
* @param string $message
* @param string $level
* @param string $prefix
* @param string $color
*/
protected function send($message, $level, $prefix, $color) : void{
$time = new \DateTime('now', new \DateTimeZone($this->timezone));

View File

@@ -119,6 +119,9 @@ final class Process{
return count(ThreadManager::getInstance()->getAll()) + 3; //RakLib + MainLogger + Main Thread
}
/**
* @param int $pid
*/
public static function kill($pid) : void{
$logger = \GlobalLogger::get();
if($logger instanceof MainLogger){

View File

@@ -25,7 +25,14 @@ namespace pocketmine\utils;
class ReversePriorityQueue extends \SplPriorityQueue{
/**
* @param mixed $priority1
* @param mixed $priority2
*
* @return int
*/
public function compare($priority1, $priority2){
//TODO: this will crash if non-numeric priorities are used
return (int) -($priority1 - $priority2);
}
}

View File

@@ -35,6 +35,9 @@ class ServerKiller extends Thread{
/** @var bool */
private $stopped = false;
/**
* @param int $time
*/
public function __construct($time = 15){
$this->time = $time;
}