mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 01:16:15 +00:00
Merge branch 'next-minor'
This commit is contained in:
10
composer.lock
generated
10
composer.lock
generated
@ -636,16 +636,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "0.12.11",
|
"version": "0.12.14",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b"
|
"reference": "37bdd26a80235d0f9045b49f4151102b7831cbe2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ca5f2b7cf81c6d8fba74f9576970399c5817e03b",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/37bdd26a80235d0f9045b49f4151102b7831cbe2",
|
||||||
"reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b",
|
"reference": "37bdd26a80235d0f9045b49f4151102b7831cbe2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -671,7 +671,7 @@
|
|||||||
"MIT"
|
"MIT"
|
||||||
],
|
],
|
||||||
"description": "PHPStan - PHP Static Analysis Tool",
|
"description": "PHPStan - PHP Static Analysis Tool",
|
||||||
"time": "2020-02-16T14:00:29+00:00"
|
"time": "2020-03-02T22:29:43+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan-phpunit",
|
"name": "phpstan/phpstan-phpunit",
|
||||||
|
@ -23,6 +23,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine;
|
namespace pocketmine;
|
||||||
|
|
||||||
|
use function define;
|
||||||
|
use function defined;
|
||||||
|
use function dirname;
|
||||||
|
|
||||||
// composer autoload doesn't use require_once and also pthreads can inherit things
|
// composer autoload doesn't use require_once and also pthreads can inherit things
|
||||||
if(defined('pocketmine\_CORE_CONSTANTS_INCLUDED')){
|
if(defined('pocketmine\_CORE_CONSTANTS_INCLUDED')){
|
||||||
return;
|
return;
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// composer autoload doesn't use require_once and also pthreads can inherit things
|
// composer autoload doesn't use require_once and also pthreads can inherit things
|
||||||
if(defined('pocketmine\_GLOBAL_CONSTANTS_INCLUDED')){
|
if(defined('pocketmine\_GLOBAL_CONSTANTS_INCLUDED')){
|
||||||
return;
|
return;
|
||||||
|
@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine;
|
namespace pocketmine;
|
||||||
|
|
||||||
|
use function defined;
|
||||||
|
|
||||||
// composer autoload doesn't use require_once and also pthreads can inherit things
|
// composer autoload doesn't use require_once and also pthreads can inherit things
|
||||||
// TODO: drop this file and use a final class with constants
|
// TODO: drop this file and use a final class with constants
|
||||||
if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
|
if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
|
||||||
|
@ -43,7 +43,7 @@ class Effect{
|
|||||||
/**
|
/**
|
||||||
* @param int $id Effect ID as per Minecraft PE
|
* @param int $id Effect ID as per Minecraft PE
|
||||||
* @param string $name Translation key used for effect name
|
* @param string $name Translation key used for effect name
|
||||||
* @param Color $color
|
* @param Color $color Color of bubbles given by this effect
|
||||||
* @param bool $isBad Whether the effect is harmful
|
* @param bool $isBad Whether the effect is harmful
|
||||||
* @param bool $hasBubbles Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles)
|
* @param bool $hasBubbles Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles)
|
||||||
*/
|
*/
|
||||||
|
@ -39,14 +39,10 @@ class ExperienceOrb extends Entity{
|
|||||||
public const TAG_VALUE_PC = "Value"; //short
|
public const TAG_VALUE_PC = "Value"; //short
|
||||||
public const TAG_VALUE_PE = "experience value"; //int (WTF?)
|
public const TAG_VALUE_PE = "experience value"; //int (WTF?)
|
||||||
|
|
||||||
/**
|
/** Max distance an orb will follow a player across. */
|
||||||
* Max distance an orb will follow a player across.
|
|
||||||
*/
|
|
||||||
public const MAX_TARGET_DISTANCE = 8.0;
|
public const MAX_TARGET_DISTANCE = 8.0;
|
||||||
|
|
||||||
/**
|
/** Split sizes used for dropping experience orbs. */
|
||||||
* Split sizes used for dropping experience orbs.
|
|
||||||
*/
|
|
||||||
public const ORB_SPLIT_SIZES = [2477, 1237, 617, 307, 149, 73, 37, 17, 7, 3, 1]; //This is indexed biggest to smallest so that we can return as soon as we found the biggest value.
|
public const ORB_SPLIT_SIZES = [2477, 1237, 617, 307, 149, 73, 37, 17, 7, 3, 1]; //This is indexed biggest to smallest so that we can return as soon as we found the biggest value.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,9 +77,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
|||||||
*/
|
*/
|
||||||
public const ARG_FLAG_ENUM = 0x200000;
|
public const ARG_FLAG_ENUM = 0x200000;
|
||||||
|
|
||||||
/**
|
/** This is used for /xp <level: int>L. It can only be applied to integer parameters. */
|
||||||
* This is used for /xp <level: int>L. It can only be applied to integer parameters.
|
|
||||||
*/
|
|
||||||
public const ARG_FLAG_POSTFIX = 0x1000000;
|
public const ARG_FLAG_POSTFIX = 0x1000000;
|
||||||
|
|
||||||
public const HARDCODED_ENUM_NAMES = [
|
public const HARDCODED_ENUM_NAMES = [
|
||||||
|
@ -40,17 +40,11 @@ final class ProtocolInfo{
|
|||||||
* This file is generated automatically, do not edit it manually.
|
* This file is generated automatically, do not edit it manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/** Actual Minecraft: PE protocol version */
|
||||||
* Actual Minecraft: PE protocol version
|
|
||||||
*/
|
|
||||||
public const CURRENT_PROTOCOL = 389;
|
public const CURRENT_PROTOCOL = 389;
|
||||||
/**
|
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
|
||||||
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
|
|
||||||
*/
|
|
||||||
public const MINECRAFT_VERSION = 'v1.14.0';
|
public const MINECRAFT_VERSION = 'v1.14.0';
|
||||||
/**
|
/** Version number sent to clients in ping responses. */
|
||||||
* Version number sent to clients in ping responses.
|
|
||||||
*/
|
|
||||||
public const MINECRAFT_VERSION_NETWORK = '1.14.0';
|
public const MINECRAFT_VERSION_NETWORK = '1.14.0';
|
||||||
|
|
||||||
public const LOGIN_PACKET = 0x01;
|
public const LOGIN_PACKET = 0x01;
|
||||||
|
@ -1601,7 +1601,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
|||||||
$item = $this->inventory->getItemInHand();
|
$item = $this->inventory->getItemInHand();
|
||||||
$oldItem = clone $item;
|
$oldItem = clone $item;
|
||||||
if($this->getWorld()->useBreakOn($pos, $item, $this, true)){
|
if($this->getWorld()->useBreakOn($pos, $item, $this, true)){
|
||||||
if($this->hasFiniteResources() and !$item->equalsExact($oldItem)){
|
if($this->hasFiniteResources() and !$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
|
||||||
$this->inventory->setItemInHand($item);
|
$this->inventory->setItemInHand($item);
|
||||||
}
|
}
|
||||||
$this->hungerManager->exhaust(0.025, PlayerExhaustEvent::CAUSE_MINING);
|
$this->hungerManager->exhaust(0.025, PlayerExhaustEvent::CAUSE_MINING);
|
||||||
@ -1625,7 +1625,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
|||||||
$item = $this->inventory->getItemInHand(); //this is a copy of the real item
|
$item = $this->inventory->getItemInHand(); //this is a copy of the real item
|
||||||
$oldItem = clone $item;
|
$oldItem = clone $item;
|
||||||
if($this->getWorld()->useItemOn($pos, $item, $face, $clickOffset, $this, true)){
|
if($this->getWorld()->useItemOn($pos, $item, $face, $clickOffset, $this, true)){
|
||||||
if($this->hasFiniteResources() and !$item->equalsExact($oldItem)){
|
if($this->hasFiniteResources() and !$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
|
||||||
$this->inventory->setItemInHand($item);
|
$this->inventory->setItemInHand($item);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1694,7 +1694,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()){ //always fire the hook, even if we are survival
|
if($heldItem->onAttackEntity($entity) and $this->hasFiniteResources() and $heldItem->equalsExact($this->inventory->getItemInHand())){ //always fire the hook, even if we are survival
|
||||||
$this->inventory->setItemInHand($heldItem);
|
$this->inventory->setItemInHand($heldItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@ class PluginDescription{
|
|||||||
private $api;
|
private $api;
|
||||||
/** @var int[] */
|
/** @var int[] */
|
||||||
private $compatibleMcpeProtocols = [];
|
private $compatibleMcpeProtocols = [];
|
||||||
|
/** @var string[] */
|
||||||
|
private $compatibleOperatingSystems = [];
|
||||||
/**
|
/**
|
||||||
* @var string[][]
|
* @var string[][]
|
||||||
* @phpstan-var array<string, list<mixed>>
|
* @phpstan-var array<string, list<mixed>>
|
||||||
@ -112,6 +114,7 @@ class PluginDescription{
|
|||||||
|
|
||||||
$this->api = array_map("\strval", (array) ($plugin["api"] ?? []));
|
$this->api = array_map("\strval", (array) ($plugin["api"] ?? []));
|
||||||
$this->compatibleMcpeProtocols = array_map("\intval", (array) ($plugin["mcpe-protocol"] ?? []));
|
$this->compatibleMcpeProtocols = array_map("\intval", (array) ($plugin["mcpe-protocol"] ?? []));
|
||||||
|
$this->compatibleOperatingSystems = array_map("\strval", (array) ($plugin["os"] ?? []));
|
||||||
|
|
||||||
if(isset($plugin["commands"]) and is_array($plugin["commands"])){
|
if(isset($plugin["commands"]) and is_array($plugin["commands"])){
|
||||||
$this->commands = $plugin["commands"];
|
$this->commands = $plugin["commands"];
|
||||||
@ -185,6 +188,13 @@ class PluginDescription{
|
|||||||
return $this->compatibleMcpeProtocols;
|
return $this->compatibleMcpeProtocols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getCompatibleOperatingSystems() : array{
|
||||||
|
return $this->compatibleOperatingSystems;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
|
@ -46,6 +46,7 @@ use function explode;
|
|||||||
use function file_exists;
|
use function file_exists;
|
||||||
use function get_class;
|
use function get_class;
|
||||||
use function implode;
|
use function implode;
|
||||||
|
use function in_array;
|
||||||
use function is_a;
|
use function is_a;
|
||||||
use function is_array;
|
use function is_array;
|
||||||
use function is_dir;
|
use function is_dir;
|
||||||
@ -251,6 +252,14 @@ class PluginManager{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(count($description->getCompatibleOperatingSystems()) > 0 and !in_array(Utils::getOS(), $description->getCompatibleOperatingSystems(), true)) {
|
||||||
|
$this->server->getLogger()->error($this->server->getLanguage()->translateString("pocketmine.plugin.loadError", [
|
||||||
|
$name,
|
||||||
|
$this->server->getLanguage()->translateString("%pocketmine.plugin.incompatibleOS", [implode(", ", $description->getCompatibleOperatingSystems())])
|
||||||
|
]));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(count($pluginMcpeProtocols = $description->getCompatibleMcpeProtocols()) > 0){
|
if(count($pluginMcpeProtocols = $description->getCompatibleMcpeProtocols()) > 0){
|
||||||
$serverMcpeProtocols = [ProtocolInfo::CURRENT_PROTOCOL];
|
$serverMcpeProtocols = [ProtocolInfo::CURRENT_PROTOCOL];
|
||||||
if(count(array_intersect($pluginMcpeProtocols, $serverMcpeProtocols)) === 0){
|
if(count(array_intersect($pluginMcpeProtocols, $serverMcpeProtocols)) === 0){
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pocketmine\thread;
|
namespace pocketmine\thread;
|
||||||
|
use const PTHREADS_INHERIT_ALL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class must be extended by all custom threading classes
|
* This class must be extended by all custom threading classes
|
||||||
@ -29,7 +30,7 @@ namespace pocketmine\thread;
|
|||||||
abstract class Thread extends \Thread{
|
abstract class Thread extends \Thread{
|
||||||
use CommonThreadPartsTrait;
|
use CommonThreadPartsTrait;
|
||||||
|
|
||||||
public function start(?int $options = \PTHREADS_INHERIT_ALL) : bool{
|
public function start(?int $options = PTHREADS_INHERIT_ALL) : bool{
|
||||||
//this is intentionally not traitified
|
//this is intentionally not traitified
|
||||||
ThreadManager::getInstance()->add($this);
|
ThreadManager::getInstance()->add($this);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pocketmine\thread;
|
namespace pocketmine\thread;
|
||||||
|
use const PTHREADS_INHERIT_ALL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class must be extended by all custom threading classes
|
* This class must be extended by all custom threading classes
|
||||||
@ -29,7 +30,7 @@ namespace pocketmine\thread;
|
|||||||
abstract class Worker extends \Worker{
|
abstract class Worker extends \Worker{
|
||||||
use CommonThreadPartsTrait;
|
use CommonThreadPartsTrait;
|
||||||
|
|
||||||
public function start(?int $options = \PTHREADS_INHERIT_ALL) : bool{
|
public function start(?int $options = PTHREADS_INHERIT_ALL) : bool{
|
||||||
//this is intentionally not traitified
|
//this is intentionally not traitified
|
||||||
ThreadManager::getInstance()->add($this);
|
ThreadManager::getInstance()->add($this);
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class Chunk{
|
|||||||
* Returns the internal ID of the blockstate at the given coordinates.
|
* Returns the internal ID of the blockstate at the given coordinates.
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
*
|
*
|
||||||
* @return int bitmap, (id << 4) | meta
|
* @return int bitmap, (id << 4) | meta
|
||||||
@ -180,7 +180,7 @@ class Chunk{
|
|||||||
* Returns the sky light level at the specified chunk block coordinates
|
* Returns the sky light level at the specified chunk block coordinates
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
*
|
*
|
||||||
* @return int 0-15
|
* @return int 0-15
|
||||||
@ -193,7 +193,7 @@ class Chunk{
|
|||||||
* Sets the sky light level at the specified chunk block coordinates
|
* Sets the sky light level at the specified chunk block coordinates
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
* @param int $level 0-15
|
* @param int $level 0-15
|
||||||
*/
|
*/
|
||||||
@ -211,7 +211,7 @@ class Chunk{
|
|||||||
* Returns the block light level at the specified chunk block coordinates
|
* Returns the block light level at the specified chunk block coordinates
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y 0-15
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
*
|
*
|
||||||
* @return int 0-15
|
* @return int 0-15
|
||||||
@ -224,7 +224,7 @@ class Chunk{
|
|||||||
* Sets the block light level at the specified chunk block coordinates
|
* Sets the block light level at the specified chunk block coordinates
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y 0-15
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
* @param int $level 0-15
|
* @param int $level 0-15
|
||||||
*/
|
*/
|
||||||
@ -452,7 +452,7 @@ class Chunk{
|
|||||||
* Returns the tile at the specified chunk block coordinates, or null if no tile exists.
|
* Returns the tile at the specified chunk block coordinates, or null if no tile exists.
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
*/
|
*/
|
||||||
public function getTile(int $x, int $y, int $z) : ?Tile{
|
public function getTile(int $x, int $y, int $z) : ?Tile{
|
||||||
@ -630,7 +630,7 @@ class Chunk{
|
|||||||
* Hashes the given chunk block coordinates into a single integer.
|
* Hashes the given chunk block coordinates into a single integer.
|
||||||
*
|
*
|
||||||
* @param int $x 0-15
|
* @param int $x 0-15
|
||||||
* @param int $y
|
* @param int $y 0-255
|
||||||
* @param int $z 0-15
|
* @param int $z 0-15
|
||||||
*/
|
*/
|
||||||
public static function blockHash(int $x, int $y, int $z) : int{
|
public static function blockHash(int $x, int $y, int $z) : int{
|
||||||
|
Reference in New Issue
Block a user