Merge remote-tracking branch 'origin/stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2020-05-19 11:26:25 +01:00
commit dc9351b024
4 changed files with 6 additions and 13 deletions

View File

@ -557,13 +557,6 @@ abstract class Living extends Entity implements Damageable{
}
if($e !== null){
if((
$source->getCause() === EntityDamageEvent::CAUSE_PROJECTILE or
$source->getCause() === EntityDamageEvent::CAUSE_ENTITY_ATTACK
) and $e->isOnFire()){
$this->setOnFire(2 * $this->level->getDifficulty());
}
$deltaX = $this->x - $e->x;
$deltaZ = $this->z - $e->z;
$this->knockBack($e, $source->getBaseDamage(), $deltaX, $deltaZ, $source->getKnockBack());

View File

@ -59,7 +59,6 @@ class Bow extends Tool{
($player->yaw > 180 ? 360 : 0) - $player->yaw,
-$player->pitch
);
$nbt->setShort("Fire", $player->isOnFire() ? 45 * 60 : 0);
$diff = $player->getItemUseDuration();
$p = $diff / 20;

View File

@ -79,8 +79,8 @@ abstract class PluginBase implements Plugin{
$this->loader = $loader;
$this->server = $server;
$this->description = $description;
$this->dataFolder = rtrim($dataFolder, "\\/") . "/";
$this->file = rtrim($file, "\\/") . "/";
$this->dataFolder = rtrim($dataFolder, "/" . DIRECTORY_SEPARATOR) . "/";
$this->file = rtrim($file, "/" . DIRECTORY_SEPARATOR) . "/";
$this->configFile = $this->dataFolder . "config.yml";
$this->logger = new PluginLogger($this);
$this->scheduler = new TaskScheduler($this->logger, $this->getFullName());
@ -170,7 +170,7 @@ abstract class PluginBase implements Plugin{
* @return null|resource Resource data, or null
*/
public function getResource(string $filename){
$filename = rtrim(str_replace("\\", "/", $filename), "/");
$filename = rtrim(str_replace(DIRECTORY_SEPARATOR, "/", $filename), "/");
if(file_exists($this->file . "resources/" . $filename)){
$resource = fopen($this->file . "resources/" . $filename, "rb");
if($resource === false) throw new AssumptionFailedError("fopen() should not fail on a file which exists");

View File

@ -86,6 +86,7 @@ use function sys_get_temp_dir;
use function trim;
use function unlink;
use function xdebug_get_function_stack;
use const DIRECTORY_SEPARATOR;
use const PHP_EOL;
use const PHP_INT_MAX;
use const PHP_INT_SIZE;
@ -591,7 +592,7 @@ class Utils{
* @return string
*/
public static function cleanPath($path){
$result = str_replace(["\\", ".php", "phar://"], ["/", "", ""], $path);
$result = str_replace([DIRECTORY_SEPARATOR, ".php", "phar://"], ["/", "", ""], $path);
//remove relative paths
//TODO: make these paths dynamic so they can be unit-tested against
@ -600,7 +601,7 @@ class Utils{
\pocketmine\PATH => ""
];
foreach($cleanPaths as $cleanPath => $replacement){
$cleanPath = rtrim(str_replace(["\\", "phar://"], ["/", ""], $cleanPath), "/");
$cleanPath = rtrim(str_replace([DIRECTORY_SEPARATOR, "phar://"], ["/", ""], $cleanPath), "/");
if(strpos($result, $cleanPath) === 0){
$result = ltrim(str_replace($cleanPath, $replacement, $result), "/");
}