mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Merge branch 'stable'
This commit is contained in:
commit
8a770d837e
@ -1 +1 @@
|
||||
Subproject commit 7e985c932a5e1a2c3ba22175cb1fab338facd64f
|
||||
Subproject commit fe0e453fc1eec983fecd56fd1e1a3b5a35aae921
|
@ -1 +1 @@
|
||||
Subproject commit 4d4d2a74a6ab9c77480b1eacbf69d0e92e65e1c2
|
||||
Subproject commit 0400f85329092be8ffaaca1b6921a18fae7848e1
|
@ -66,3 +66,16 @@ Plugin developers should **only** update their required API to this version if y
|
||||
- `ClientboundMapItemDataPacket` now uses `MapDecoration` objects for decorations instead of associative arrays.
|
||||
- Updated Composer dependencies to get bug fixes in `pocketmine/nbt` and other libraries.
|
||||
- Packages `pocketmine/classloader` and `pocketmine/log` are now required; these provide classes previously part of `pocketmine/spl`. This change has no effect on API compatibility.
|
||||
|
||||
# 3.11.6
|
||||
- Core code, tests and build scripts are now analyzed using `phpstan-strict-rules` and `phpstan-phpunit` rules.
|
||||
- Added more PHPStan-specific type annotations to improve static analysis.
|
||||
- Fixed more incorrect PHPDoc types.
|
||||
- Added a workaround for player movement not working since 1.14.30.
|
||||
- Fixed lava and water buckets being edible since 1.13.
|
||||
- `AutoUpdater` is now created before any plugins are loaded.
|
||||
- Fixed trees not generating below y=2 in custom generators.
|
||||
- Fixed crash when opening a chest improperly unpaired from its pair (destroyed, setBlock(), unloaded, etc.).
|
||||
- `ThreadManager` is now lazily initialized.
|
||||
- Removed raw NBT storage from `Item` internals. The following methods are now deprecated:
|
||||
- `Item::setCompoundTag()`
|
||||
|
19
composer.lock
generated
19
composer.lock
generated
@ -591,7 +591,7 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://gitlab.irstea.fr/pole-is/tools/phpunit-shim.git",
|
||||
"reference": "39b6155954d6caec1110a9e78582c4816ab247bc"
|
||||
"reference": "8ec63f895972681271191821a36f9081c236b993"
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
@ -613,6 +613,11 @@
|
||||
"phpunit"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"exclude-from-classmap": [
|
||||
"phpunit"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
@ -632,20 +637,20 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2020-01-09T03:20:20+00:00"
|
||||
"time": "2020-01-23T13:39:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "0.12.9",
|
||||
"version": "0.12.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "297cb2458a96ea96d5e9d6ef38f1b7305c071f32"
|
||||
"reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/297cb2458a96ea96d5e9d6ef38f1b7305c071f32",
|
||||
"reference": "297cb2458a96ea96d5e9d6ef38f1b7305c071f32",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ca5f2b7cf81c6d8fba74f9576970399c5817e03b",
|
||||
"reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -671,7 +676,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan - PHP Static Analysis Tool",
|
||||
"time": "2020-02-04T22:30:27+00:00"
|
||||
"time": "2020-02-16T14:00:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-phpunit",
|
||||
|
@ -43,6 +43,7 @@ use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerListPacket;
|
||||
use pocketmine\network\mcpe\protocol\PlayerSkinPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
|
||||
@ -416,6 +417,22 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
}
|
||||
|
||||
public function broadcastMovement(bool $teleport = false) : void{
|
||||
//TODO: workaround 1.14.30 bug: MoveActor(Absolute|Delta)Packet don't work on players anymore :(
|
||||
$pk = new MovePlayerPacket();
|
||||
$pk->entityRuntimeId = $this->getId();
|
||||
$pk->position = $this->getOffsetPosition($this->location);
|
||||
$pk->yaw = $this->location->yaw;
|
||||
$pk->pitch = $this->location->pitch;
|
||||
$pk->headYaw = $this->location->yaw;
|
||||
$pk->mode = $teleport ? MovePlayerPacket::MODE_TELEPORT : MovePlayerPacket::MODE_NORMAL;
|
||||
//we can't assume that everyone who is using our chunk wants to see this movement,
|
||||
//because this human might be a player who shouldn't be receiving his own movement.
|
||||
//this didn't matter when we were able to use MoveActorPacket because
|
||||
//the client just ignored MoveActor for itself, but it doesn't ignore MovePlayer for itself.
|
||||
$this->server->broadcastPackets($this->hasSpawned, [$pk]);
|
||||
}
|
||||
|
||||
protected function onDispose() : void{
|
||||
$this->inventory->removeAllViewers();
|
||||
$this->enderChestInventory->removeAllViewers();
|
||||
|
@ -385,6 +385,10 @@ class Item implements \JsonSerializable{
|
||||
* @return $this
|
||||
*/
|
||||
public function setCount(int $count) : Item{
|
||||
if($count < 0 or $count > 255){
|
||||
throw new \InvalidArgumentException("Count must be in the range 0-255");
|
||||
}
|
||||
|
||||
$this->count = $count;
|
||||
|
||||
return $this;
|
||||
@ -393,7 +397,7 @@ class Item implements \JsonSerializable{
|
||||
/**
|
||||
* Pops an item from the stack and returns it, decreasing the stack count of this item stack by one.
|
||||
*
|
||||
* @return $this
|
||||
* @return static A clone of this itemstack containing the amount of items that were removed from this stack.
|
||||
* @throws \InvalidArgumentException if trying to pop more items than are on the stack
|
||||
*/
|
||||
public function pop(int $count = 1) : Item{
|
||||
|
@ -48,9 +48,9 @@ class UpdateTradePacket extends DataPacket implements ClientboundPacket{
|
||||
/** @var string */
|
||||
public $displayName;
|
||||
/** @var bool */
|
||||
public $isWilling;
|
||||
/** @var bool */
|
||||
public $isV2Trading;
|
||||
/** @var bool */
|
||||
public $isWilling;
|
||||
/** @var string */
|
||||
public $offers;
|
||||
|
||||
@ -62,8 +62,8 @@ class UpdateTradePacket extends DataPacket implements ClientboundPacket{
|
||||
$this->traderEid = $this->buf->getEntityUniqueId();
|
||||
$this->playerEid = $this->buf->getEntityUniqueId();
|
||||
$this->displayName = $this->buf->getString();
|
||||
$this->isWilling = $this->buf->getBool();
|
||||
$this->isV2Trading = $this->buf->getBool();
|
||||
$this->isWilling = $this->buf->getBool();
|
||||
$this->offers = $this->buf->getRemaining();
|
||||
}
|
||||
|
||||
@ -75,8 +75,8 @@ class UpdateTradePacket extends DataPacket implements ClientboundPacket{
|
||||
$this->buf->putEntityUniqueId($this->traderEid);
|
||||
$this->buf->putEntityUniqueId($this->playerEid);
|
||||
$this->buf->putString($this->displayName);
|
||||
$this->buf->putBool($this->isWilling);
|
||||
$this->buf->putBool($this->isV2Trading);
|
||||
$this->buf->putBool($this->isWilling);
|
||||
$this->buf->put($this->offers);
|
||||
}
|
||||
|
||||
|
@ -143,4 +143,18 @@ class ItemTest extends TestCase{
|
||||
$this->item->removeEnchantment(Enchantment::FIRE_ASPECT(), 2);
|
||||
self::assertFalse($this->item->hasEnchantment(Enchantment::FIRE_ASPECT()));
|
||||
}
|
||||
|
||||
public function testSetCountTooBig() : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
$item = ItemFactory::get(ItemIds::STONE);
|
||||
$item->setCount(256);
|
||||
}
|
||||
|
||||
public function testSetCountTooSmall() : void{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
$item = ItemFactory::get(ItemIds::STONE);
|
||||
$item->setCount(-1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user