Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor 2020-03-18 13:17:38 +00:00
commit a95426c373
3 changed files with 74 additions and 52 deletions

View File

@ -39,7 +39,7 @@
"pocketmine/math": "dev-master", "pocketmine/math": "dev-master",
"pocketmine/snooze": "^0.1.0", "pocketmine/snooze": "^0.1.0",
"pocketmine/classloader": "dev-master", "pocketmine/classloader": "dev-master",
"daverandom/callback-validator": "dev-master", "pocketmine/callback-validator": "^1.0.1",
"adhocore/json-comment": "^0.1.0", "adhocore/json-comment": "^0.1.0",
"particle/validator": "^2.3" "particle/validator": "^2.3"
}, },

121
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "659b3a871754524ad5581db691a2ce8b", "content-hash": "b59b043a71525b45752770b4fd1ce2cb",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -50,46 +50,6 @@
], ],
"time": "2020-01-03T13:51:23+00:00" "time": "2020-01-03T13:51:23+00:00"
}, },
{
"name": "daverandom/callback-validator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/DaveRandom/CallbackValidator.git",
"reference": "d87a08cddbc6099816ed01e50ce25cdfc43b542f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/DaveRandom/CallbackValidator/zipball/d87a08cddbc6099816ed01e50ce25cdfc43b542f",
"reference": "d87a08cddbc6099816ed01e50ce25cdfc43b542f",
"shasum": ""
},
"require": {
"ext-reflection": "*",
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"DaveRandom\\CallbackValidator\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Wright",
"email": "cw@daverandom.com"
}
],
"description": "Tools for validating callback signatures",
"time": "2017-04-03T15:22:41+00:00"
},
{ {
"name": "fgrosse/phpasn1", "name": "fgrosse/phpasn1",
"version": "v2.1.1", "version": "v2.1.1",
@ -327,6 +287,49 @@
"description": "Classes and methods for conveniently handling binary data", "description": "Classes and methods for conveniently handling binary data",
"time": "2020-01-28T12:17:38+00:00" "time": "2020-01-28T12:17:38+00:00"
}, },
{
"name": "pocketmine/callback-validator",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/pmmp/CallbackValidator.git",
"reference": "4aef6bb25f97d0b830ba0b4f66834b1a9c86fc9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/CallbackValidator/zipball/4aef6bb25f97d0b830ba0b4f66834b1a9c86fc9a",
"reference": "4aef6bb25f97d0b830ba0b4f66834b1a9c86fc9a",
"shasum": ""
},
"require": {
"ext-reflection": "*",
"php": ">=7.1"
},
"replace": {
"daverandom/callback-validator": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"DaveRandom\\CallbackValidator\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Wright",
"email": "cw@daverandom.com"
}
],
"description": "Fork of daverandom/callback-validator - Tools for validating callback signatures",
"time": "2020-03-17T12:04:22+00:00"
},
{ {
"name": "pocketmine/classloader", "name": "pocketmine/classloader",
"version": "dev-master", "version": "dev-master",
@ -591,7 +594,7 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://gitlab.irstea.fr/pole-is/tools/phpunit-shim.git", "url": "https://gitlab.irstea.fr/pole-is/tools/phpunit-shim.git",
"reference": "39b6155954d6caec1110a9e78582c4816ab247bc" "reference": "8ec63f895972681271191821a36f9081c236b993"
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
@ -613,6 +616,11 @@
"phpunit" "phpunit"
], ],
"type": "library", "type": "library",
"autoload": {
"exclude-from-classmap": [
"phpunit"
]
},
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
@ -632,20 +640,20 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2020-01-09T03:20:20+00:00" "time": "2020-01-23T13:39:47+00:00"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "0.12.14", "version": "0.12.17",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "37bdd26a80235d0f9045b49f4151102b7831cbe2" "reference": "b2c37bda79fdb11d801ce208ce391cffc0f572e6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/37bdd26a80235d0f9045b49f4151102b7831cbe2", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2c37bda79fdb11d801ce208ce391cffc0f572e6",
"reference": "37bdd26a80235d0f9045b49f4151102b7831cbe2", "reference": "b2c37bda79fdb11d801ce208ce391cffc0f572e6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -671,7 +679,21 @@
"MIT" "MIT"
], ],
"description": "PHPStan - PHP Static Analysis Tool", "description": "PHPStan - PHP Static Analysis Tool",
"time": "2020-03-02T22:29:43+00:00" "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-03-17T15:39:11+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
@ -790,8 +812,7 @@
"pocketmine/log": 20, "pocketmine/log": 20,
"pocketmine/nbt": 20, "pocketmine/nbt": 20,
"pocketmine/math": 20, "pocketmine/math": 20,
"pocketmine/classloader": 20, "pocketmine/classloader": 20
"daverandom/callback-validator": 20
}, },
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,

View File

@ -1652,6 +1652,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
} }
$heldItem = $this->inventory->getItemInHand(); $heldItem = $this->inventory->getItemInHand();
$oldItem = clone $heldItem;
$ev = new EntityDamageByEntityEvent($this, $entity, EntityDamageEvent::CAUSE_ENTITY_ATTACK, $heldItem->getAttackPoints()); $ev = new EntityDamageByEntityEvent($this, $entity, EntityDamageEvent::CAUSE_ENTITY_ATTACK, $heldItem->getAttackPoints());
if(!$this->canInteract($entity->getLocation(), 8) or ($entity instanceof Player and !$this->server->getConfigBool("pvp"))){ if(!$this->canInteract($entity->getLocation(), 8) or ($entity instanceof Player and !$this->server->getConfigBool("pvp"))){
@ -1694,7 +1695,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
if($this->isAlive()){ if($this->isAlive()){
//reactive damage like thorns might cause us to be killed by attacking another mob, which //reactive damage like thorns might cause us to be killed by attacking another mob, which
//would mean we'd already have dropped the inventory by the time we reached here //would mean we'd already have dropped the inventory by the time we reached here
if($heldItem->onAttackEntity($entity) and $this->hasFiniteResources() and $heldItem->equalsExact($this->inventory->getItemInHand())){ //always fire the hook, even if we are survival if($heldItem->onAttackEntity($entity) and $this->hasFiniteResources() and $oldItem->equalsExact($this->inventory->getItemInHand())){ //always fire the hook, even if we are survival
$this->inventory->setItemInHand($heldItem); $this->inventory->setItemInHand($heldItem);
} }