mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Merge branch 'stable'
This commit is contained in:
commit
3e1ac66abf
16
.github/support.yml
vendored
16
.github/support.yml
vendored
@ -1,16 +0,0 @@
|
|||||||
# Configuration for support-requests - https://github.com/dessant/support-requests
|
|
||||||
|
|
||||||
# Label used to mark issues as support requests
|
|
||||||
supportLabel: "Support request"
|
|
||||||
# Comment to post on issues marked as support requests. Add a link
|
|
||||||
# to a support page, or set to `false` to disable
|
|
||||||
supportComment: >
|
|
||||||
Thanks, but this issue tracker is not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue).
|
|
||||||
|
|
||||||
|
|
||||||
[Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io)
|
|
||||||
|
|
||||||
# Whether to close issues marked as support requests
|
|
||||||
close: true
|
|
||||||
# Whether to lock issues marked as support requests
|
|
||||||
lock: false
|
|
22
.github/workflows/support.yml
vendored
Normal file
22
.github/workflows/support.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
name: 'Manage support request issues'
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [labeled, unlabeled, reopened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
support:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: dessant/support-requests@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
support-label: "Support request"
|
||||||
|
issue-comment: >
|
||||||
|
Thanks, but this issue tracker is not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue).
|
||||||
|
|
||||||
|
|
||||||
|
[Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io)
|
||||||
|
|
||||||
|
close-issue: true
|
||||||
|
lock-issue: false
|
@ -50,7 +50,7 @@
|
|||||||
"composer-runtime-api": "^2.0"
|
"composer-runtime-api": "^2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "0.12.69",
|
"phpstan/phpstan": "0.12.71",
|
||||||
"phpstan/phpstan-phpunit": "^0.12.6",
|
"phpstan/phpstan-phpunit": "^0.12.6",
|
||||||
"phpstan/phpstan-strict-rules": "^0.12.2",
|
"phpstan/phpstan-strict-rules": "^0.12.2",
|
||||||
"phpunit/phpunit": "^9.2"
|
"phpunit/phpunit": "^9.2"
|
||||||
|
14
composer.lock
generated
14
composer.lock
generated
@ -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": "516f0ca0b6b64244f81ea8340c48347f",
|
"content-hash": "4ef66ad9f915fd8a82409bbf2a46c9cf",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adhocore/json-comment",
|
"name": "adhocore/json-comment",
|
||||||
@ -1521,16 +1521,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "0.12.69",
|
"version": "0.12.71",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "8f436ea35241da33487fd0d38b4bc3e6dfe30ea8"
|
"reference": "d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/8f436ea35241da33487fd0d38b4bc3e6dfe30ea8",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5",
|
||||||
"reference": "8f436ea35241da33487fd0d38b4bc3e6dfe30ea8",
|
"reference": "d508fa3b0ecc5fc91ac70c6c7ac2862f968ba2b5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1561,7 +1561,7 @@
|
|||||||
"description": "PHPStan - PHP Static Analysis Tool",
|
"description": "PHPStan - PHP Static Analysis Tool",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||||
"source": "https://github.com/phpstan/phpstan/tree/0.12.69"
|
"source": "https://github.com/phpstan/phpstan/tree/0.12.71"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -1577,7 +1577,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-01-24T14:55:37+00:00"
|
"time": "2021-02-01T18:24:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan-phpunit",
|
"name": "phpstan/phpstan-phpunit",
|
||||||
|
@ -51,7 +51,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
|
|||||||
/**
|
/**
|
||||||
* @param Item[] $drops
|
* @param Item[] $drops
|
||||||
*/
|
*/
|
||||||
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops, int $xpDrops = 0){
|
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops = [], int $xpDrops = 0){
|
||||||
parent::__construct($block);
|
parent::__construct($block);
|
||||||
$this->item = $item;
|
$this->item = $item;
|
||||||
$this->player = $player;
|
$this->player = $player;
|
||||||
|
@ -30,6 +30,7 @@ use pocketmine\inventory\transaction\action\SlotChangeAction;
|
|||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\player\Player;
|
use pocketmine\player\Player;
|
||||||
use function array_keys;
|
use function array_keys;
|
||||||
|
use function array_values;
|
||||||
use function assert;
|
use function assert;
|
||||||
use function count;
|
use function count;
|
||||||
use function get_class;
|
use function get_class;
|
||||||
@ -171,6 +172,8 @@ class InventoryTransaction{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$needItems = array_values($needItems);
|
||||||
|
$haveItems = array_values($haveItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +32,7 @@ use pocketmine\world\format\io\exception\CorruptedChunkException;
|
|||||||
use function assert;
|
use function assert;
|
||||||
use function ceil;
|
use function ceil;
|
||||||
use function chr;
|
use function chr;
|
||||||
|
use function clearstatcache;
|
||||||
use function fclose;
|
use function fclose;
|
||||||
use function feof;
|
use function feof;
|
||||||
use function file_exists;
|
use function file_exists;
|
||||||
@ -91,6 +92,7 @@ class RegionLoader{
|
|||||||
* @throws CorruptedRegionException
|
* @throws CorruptedRegionException
|
||||||
*/
|
*/
|
||||||
public function open() : void{
|
public function open() : void{
|
||||||
|
clearstatcache(false, $this->filePath);
|
||||||
$exists = file_exists($this->filePath);
|
$exists = file_exists($this->filePath);
|
||||||
if(!$exists){
|
if(!$exists){
|
||||||
touch($this->filePath);
|
touch($this->filePath);
|
||||||
@ -370,6 +372,7 @@ class RegionLoader{
|
|||||||
fwrite($this->filePointer, Binary::writeInt($entry !== null ? ($entry->getFirstSector() << 8) | $entry->getSectorCount() : 0), 4);
|
fwrite($this->filePointer, Binary::writeInt($entry !== null ? ($entry->getFirstSector() << 8) | $entry->getSectorCount() : 0), 4);
|
||||||
fseek($this->filePointer, 4096 + ($index << 2));
|
fseek($this->filePointer, 4096 + ($index << 2));
|
||||||
fwrite($this->filePointer, Binary::writeInt($entry !== null ? $entry->getTimestamp() : 0), 4);
|
fwrite($this->filePointer, Binary::writeInt($entry !== null ? $entry->getTimestamp() : 0), 4);
|
||||||
|
clearstatcache(false, $this->filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createBlank() : void{
|
protected function createBlank() : void{
|
||||||
|
@ -115,4 +115,19 @@ class RegionLoaderTest extends TestCase{
|
|||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$this->region->readChunk($x, $z);
|
$this->region->readChunk($x, $z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that cached filesize() values don't break validation of region headers
|
||||||
|
*/
|
||||||
|
public function testRegionHeaderCachedFilesizeRegression() : void{
|
||||||
|
$this->region->close();
|
||||||
|
$region = new RegionLoader($this->regionPath, 0, 0); //now we have a region, so the header will be verified, triggering two filesize() calls
|
||||||
|
$region->open();
|
||||||
|
$data = str_repeat("hello", 2000);
|
||||||
|
$region->writeChunk(0, 0, $data); //add some data to the end of the file, to make the cached filesize invalid
|
||||||
|
$region->close();
|
||||||
|
$region = new RegionLoader($this->regionPath, 0, 0);
|
||||||
|
$region->open();
|
||||||
|
self::assertSame($data, $region->readChunk(0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user