mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Merge branch 'release/3.1'
This commit is contained in:
commit
4ccbb8b21a
@ -53,26 +53,25 @@ namespace pocketmine {
|
|||||||
* Enjoy it as much as I did writing it. I don't want to do it again.
|
* Enjoy it as much as I did writing it. I don't want to do it again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
function check_platform_dependencies(){
|
||||||
if(version_compare(MIN_PHP_VERSION, PHP_VERSION) > 0){
|
if(version_compare(MIN_PHP_VERSION, PHP_VERSION) > 0){
|
||||||
critical_error(\pocketmine\NAME . " requires PHP >= " . MIN_PHP_VERSION . ", but you have PHP " . PHP_VERSION . ".");
|
//If PHP version isn't high enough, anything below might break, so don't bother checking it.
|
||||||
critical_error("Please refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
|
return [
|
||||||
exit(1);
|
\pocketmine\NAME . " requires PHP >= " . MIN_PHP_VERSION . ", but you have PHP " . PHP_VERSION . "."
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$messages = [];
|
||||||
|
|
||||||
if(PHP_INT_SIZE < 8){
|
if(PHP_INT_SIZE < 8){
|
||||||
critical_error("Running " . \pocketmine\NAME . " with 32-bit systems/PHP is no longer supported.");
|
$messages[] = "Running " . \pocketmine\NAME . " with 32-bit systems/PHP is no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system.";
|
||||||
critical_error("Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system.");
|
|
||||||
critical_error("Please refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dependencies check */
|
|
||||||
|
|
||||||
$errors = 0;
|
|
||||||
|
|
||||||
if(php_sapi_name() !== "cli"){
|
if(php_sapi_name() !== "cli"){
|
||||||
critical_error("You must run " . \pocketmine\NAME . " using the CLI.");
|
$messages[] = "You must run " . \pocketmine\NAME . " using the CLI.";
|
||||||
++$errors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$extensions = [
|
$extensions = [
|
||||||
@ -97,8 +96,7 @@ namespace pocketmine {
|
|||||||
|
|
||||||
foreach($extensions as $ext => $name){
|
foreach($extensions as $ext => $name){
|
||||||
if(!extension_loaded($ext)){
|
if(!extension_loaded($ext)){
|
||||||
critical_error("Unable to find the $name ($ext) extension.");
|
$messages[] = "Unable to find the $name ($ext) extension.";
|
||||||
++$errors;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,28 +106,36 @@ namespace pocketmine {
|
|||||||
$pthreads_version = "0.$pthreads_version";
|
$pthreads_version = "0.$pthreads_version";
|
||||||
}
|
}
|
||||||
if(version_compare($pthreads_version, "3.1.7dev") < 0){
|
if(version_compare($pthreads_version, "3.1.7dev") < 0){
|
||||||
critical_error("pthreads >= 3.1.7dev is required, while you have $pthreads_version.");
|
$messages[] = "pthreads >= 3.1.7dev is required, while you have $pthreads_version.";
|
||||||
++$errors;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extension_loaded("leveldb")){
|
if(extension_loaded("leveldb")){
|
||||||
$leveldb_version = phpversion("leveldb");
|
$leveldb_version = phpversion("leveldb");
|
||||||
if(version_compare($leveldb_version, "0.2.1") < 0){
|
if(version_compare($leveldb_version, "0.2.1") < 0){
|
||||||
critical_error("php-leveldb >= 0.2.1 is required, while you have $leveldb_version");
|
$messages[] = "php-leveldb >= 0.2.1 is required, while you have $leveldb_version.";
|
||||||
++$errors;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extension_loaded("pocketmine")){
|
if(extension_loaded("pocketmine")){
|
||||||
critical_error("The native PocketMine extension is no longer supported.");
|
$messages[] = "The native PocketMine extension is no longer supported.";
|
||||||
++$errors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($errors > 0){
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($messages = check_platform_dependencies())){
|
||||||
|
echo PHP_EOL;
|
||||||
|
$binary = version_compare(PHP_VERSION, "5.4") >= 0 ? PHP_BINARY : "unknown";
|
||||||
|
critical_error("Selected PHP binary ($binary) does not satisfy some requirements.");
|
||||||
|
foreach($messages as $m){
|
||||||
|
echo " - $m" . PHP_EOL;
|
||||||
|
}
|
||||||
critical_error("Please recompile PHP with the needed configuration, or refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
|
critical_error("Please recompile PHP with the needed configuration, or refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
|
||||||
|
echo PHP_EOL;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
unset($messages);
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
@ -64,7 +64,12 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setItem(int $index, Item $item, bool $send = true) : bool{
|
public function setItem(int $index, Item $item, bool $send = true) : bool{
|
||||||
return $index < $this->left->getSize() ? $this->left->setItem($index, $item, $send) : $this->right->setItem($index - $this->left->getSize(), $item, $send);
|
$old = $this->getItem($index);
|
||||||
|
if($index < $this->left->getSize() ? $this->left->setItem($index, $item, $send) : $this->right->setItem($index - $this->left->getSize(), $item, $send)){
|
||||||
|
$this->onSlotChange($index, $old, $send);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getContents(bool $includeEmpty = false) : array{
|
public function getContents(bool $includeEmpty = false) : array{
|
||||||
|
@ -113,12 +113,16 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
$pair->checkPairing();
|
$pair->checkPairing();
|
||||||
}
|
}
|
||||||
if($this->doubleInventory === null){
|
if($this->doubleInventory === null){
|
||||||
|
if($pair->doubleInventory !== null){
|
||||||
|
$this->doubleInventory = $pair->doubleInventory;
|
||||||
|
}else{
|
||||||
if(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){ //Order them correctly
|
if(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){ //Order them correctly
|
||||||
$this->doubleInventory = new DoubleChestInventory($pair, $this);
|
$this->doubleInventory = new DoubleChestInventory($pair, $this);
|
||||||
}else{
|
}else{
|
||||||
$this->doubleInventory = new DoubleChestInventory($this, $pair);
|
$this->doubleInventory = new DoubleChestInventory($this, $pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->doubleInventory = null;
|
$this->doubleInventory = null;
|
||||||
$this->pairX = $this->pairZ = null;
|
$this->pairX = $this->pairZ = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user