Merge branch 'release/3.3'

This commit is contained in:
Dylan K. Taylor 2018-09-04 11:58:19 +01:00
commit 034472bfe7
3 changed files with 23 additions and 9 deletions

View File

@ -30,7 +30,7 @@
"pocketmine/raklib": "^0.12.0",
"pocketmine/spl": "^0.3.0",
"pocketmine/binaryutils": "^0.1.0",
"pocketmine/nbt": "^0.2.0",
"pocketmine/nbt": "^0.2.1",
"pocketmine/math": "^0.2.0",
"pocketmine/snooze": "^0.1.0"
},

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "85fe0f9aca77848b0f753dbc28815c79",
"content-hash": "9ff16274822f181c2ed533797d2e22f7",
"packages": [
{
"name": "fgrosse/phpasn1",
@ -217,16 +217,16 @@
},
{
"name": "pocketmine/nbt",
"version": "0.2.0",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/pmmp/NBT.git",
"reference": "da19487ff92f6f7a16b5ce8894132bb1d1e9ea0c"
"reference": "a4ee39f313c6870153fb7c7e513b211217f7daf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/NBT/zipball/da19487ff92f6f7a16b5ce8894132bb1d1e9ea0c",
"reference": "da19487ff92f6f7a16b5ce8894132bb1d1e9ea0c",
"url": "https://api.github.com/repos/pmmp/NBT/zipball/a4ee39f313c6870153fb7c7e513b211217f7daf8",
"reference": "a4ee39f313c6870153fb7c7e513b211217f7daf8",
"shasum": ""
},
"require": {
@ -250,10 +250,10 @@
],
"description": "PHP library for working with Named Binary Tags",
"support": {
"source": "https://github.com/pmmp/NBT/tree/0.2.0",
"source": "https://github.com/pmmp/NBT/tree/0.2.1",
"issues": "https://github.com/pmmp/NBT/issues"
},
"time": "2018-06-13T09:56:00+00:00"
"time": "2018-09-04T10:36:02+00:00"
},
{
"name": "pocketmine/raklib",

View File

@ -3281,6 +3281,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* @param bool $isPermanent Prevents the window being removed if true.
*
* @return int
*
* @throws \InvalidArgumentException if a forceID which is already in use is specified
* @throws \InvalidStateException if trying to add a window without forceID when no slots are free
*/
public function addWindow(Inventory $inventory, int $forceId = null, bool $isPermanent = false) : int{
if(($id = $this->getWindowId($inventory)) !== ContainerIds::NONE){
@ -3288,10 +3291,21 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
if($forceId === null){
$this->windowCnt = $cnt = max(ContainerIds::FIRST, ++$this->windowCnt % ContainerIds::LAST);
$cnt = $this->windowCnt;
do{
$cnt = max(ContainerIds::FIRST, ($cnt + 1) % ContainerIds::LAST);
if($cnt === $this->windowCnt){ //wraparound, no free slots
throw new \InvalidStateException("No free window IDs found");
}
}while(isset($this->windowIndex[$cnt]));
$this->windowCnt = $cnt;
}else{
$cnt = $forceId;
if(isset($this->windowIndex[$cnt])){
throw new \InvalidArgumentException("Requested force ID $forceId already in use");
}
}
$this->windowIndex[$cnt] = $inventory;
$this->windows[spl_object_hash($inventory)] = $cnt;
if($inventory->open($this)){