Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2020-06-03 13:04:08 +01:00
commit c864647cd1
5 changed files with 19 additions and 66 deletions

View File

@ -44,4 +44,10 @@ Plugin developers should **only** update their required API to this version if y
- `mobflame` particle can now be spawned using the `/particle` command.
- Fixed several internal errors that could occur while modifying writable books.
- Fixed swapping writable book pages not working in some cases.
- `WritableBook->getPageText()` no longer throws an exception when the page doesn't exist, but returns null (as it was originally intended to).
- `WritableBook->getPageText()` no longer throws an exception when the page doesn't exist, but returns null (as it was originally intended to).
# 3.12.4
- Fixed absorption hearts not being consumed.
# 3.12.5
- Fixed broken attack cooldowns.

65
composer.lock generated
View File

@ -527,20 +527,6 @@
"constructor",
"instantiate"
],
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
"type": "tidelift"
}
],
"time": "2020-05-29T17:27:14+00:00"
},
{
@ -944,34 +930,20 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://www.patreon.com/phpstan",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2020-05-10T20:36:16+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
"version": "0.12.10",
"version": "0.12.11",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "74c1c5f00312e23533fdf579aea71a8343dd3e78"
"reference": "ab783a8ea634ea23305a8818c4750603e714489b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/74c1c5f00312e23533fdf579aea71a8343dd3e78",
"reference": "74c1c5f00312e23533fdf579aea71a8343dd3e78",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/ab783a8ea634ea23305a8818c4750603e714489b",
"reference": "ab783a8ea634ea23305a8818c4750603e714489b",
"shasum": ""
},
"require": {
@ -1014,7 +986,7 @@
"MIT"
],
"description": "PHPUnit extensions and rules for PHPStan",
"time": "2020-05-31T06:33:59+00:00"
"time": "2020-06-01T16:43:31+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
@ -1400,16 +1372,6 @@
"testing",
"xunit"
],
"funding": [
{
"url": "https://phpunit.de/donate.html",
"type": "custom"
},
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-05-22T13:51:52+00:00"
},
{
@ -2083,20 +2045,6 @@
"polyfill",
"portable"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-05-12T16:14:59+00:00"
},
{
@ -2214,6 +2162,5 @@
"ext-zip": "*",
"ext-zlib": ">=1.2.11"
},
"platform-dev": [],
"plugin-api-version": "1.1.0"
"platform-dev": []
}

View File

@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
const _VERSION_INFO_INCLUDED = true;
const NAME = "PocketMine-MP";
const BASE_VERSION = "3.12.4";
const BASE_VERSION = "3.12.6";
const IS_DEVELOPMENT_BUILD = true;
const BUILD_NUMBER = 0;

View File

@ -437,6 +437,9 @@ abstract class Living extends Entity implements Damageable{
*/
public function applyDamageModifiers(EntityDamageEvent $source) : void{
if($this->lastDamageCause !== null and $this->attackTime > 0){
if($this->lastDamageCause->getBaseDamage() >= $source->getBaseDamage()){
$source->setCancelled();
}
$source->setModifier(-$this->lastDamageCause->getBaseDamage(), EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN);
}
if($source->canBeReducedByArmor()){

View File

@ -26,6 +26,7 @@ namespace pocketmine\event\entity;
use pocketmine\entity\Entity;
use pocketmine\event\Cancellable;
use function array_sum;
use function max;
/**
* Called when an entity takes damage.
@ -144,7 +145,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
}
public function getFinalDamage() : float{
return $this->baseDamage + array_sum($this->modifiers);
return max(0, $this->baseDamage + array_sum($this->modifiers));
}
/**
@ -182,8 +183,4 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
public function setAttackCooldown(int $attackCooldown) : void{
$this->attackCooldown = $attackCooldown;
}
public function isCancelled() : bool{
return parent::isCancelled() or $this->getFinalDamage() <= 0;
}
}