mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
Merge branch 'next-minor' into next-major
This commit is contained in:
@@ -105,7 +105,7 @@ class Vine extends Flowable{
|
||||
}
|
||||
|
||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
if(!$blockClicked->isSolid() || Facing::axis($face) === Axis::Y){
|
||||
if(!$blockClicked->isFullCube() || Facing::axis($face) === Axis::Y){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class SignText{
|
||||
private bool $glowing;
|
||||
|
||||
/**
|
||||
* @param string[]|null $lines index-sensitive; omitting an index will leave it unchanged
|
||||
* @param string[]|null $lines index-sensitive; keys 0-3 will be used, regardless of array order
|
||||
*
|
||||
* @throws \InvalidArgumentException if the array size is greater than 4
|
||||
* @throws \InvalidArgumentException if invalid keys (out of bounds or string) are found in the array
|
||||
|
@@ -71,7 +71,11 @@ class GiveCommand extends VanillaCommand{
|
||||
if(!isset($args[2])){
|
||||
$item->setCount($item->getMaxStackSize());
|
||||
}else{
|
||||
$item->setCount((int) $args[2]);
|
||||
$count = $this->getBoundedInt($sender, $args[2], 1, 32767);
|
||||
if($count === null){
|
||||
return true;
|
||||
}
|
||||
$item->setCount($count);
|
||||
}
|
||||
|
||||
if(isset($args[3])){
|
||||
|
@@ -32,9 +32,7 @@ use pocketmine\utils\TextFormat;
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\VersionInfo;
|
||||
use function count;
|
||||
use function function_exists;
|
||||
use function implode;
|
||||
use function opcache_get_status;
|
||||
use function sprintf;
|
||||
use function stripos;
|
||||
use function strtolower;
|
||||
@@ -67,16 +65,10 @@ class VersionCommand extends VanillaCommand{
|
||||
));
|
||||
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_version_phpVersion(PHP_VERSION));
|
||||
|
||||
if(
|
||||
function_exists('opcache_get_status') &&
|
||||
($opcacheStatus = opcache_get_status(false)) !== false &&
|
||||
isset($opcacheStatus["jit"]["on"])
|
||||
){
|
||||
$jit = $opcacheStatus["jit"];
|
||||
if($jit["on"] === true){
|
||||
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(
|
||||
sprintf("CRTO: %s%s%s%s", $jit["opt_flags"] >> 2, $jit["opt_flags"] & 0x03, $jit["kind"], $jit["opt_level"])
|
||||
);
|
||||
$jitMode = Utils::getOpcacheJitMode();
|
||||
if($jitMode !== null){
|
||||
if($jitMode !== 0){
|
||||
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitEnabled(sprintf("CRTO: %d", $jitMode));
|
||||
}else{
|
||||
$jitStatus = KnownTranslationFactory::pocketmine_command_version_phpJitDisabled();
|
||||
}
|
||||
|
@@ -164,6 +164,8 @@ class CrashDump{
|
||||
}
|
||||
$this->data->extensions = $extensions;
|
||||
|
||||
$this->data->jit_mode = Utils::getOpcacheJitMode();
|
||||
|
||||
if($this->server->getConfigGroup()->getPropertyBool("auto-report.send-phpinfo", true)){
|
||||
ob_start();
|
||||
phpinfo();
|
||||
|
@@ -66,6 +66,8 @@ final class CrashDumpData implements \JsonSerializable{
|
||||
*/
|
||||
public array $extensions = [];
|
||||
|
||||
public ?int $jit_mode = null;
|
||||
|
||||
public string $phpinfo = "";
|
||||
|
||||
public CrashDumpDataGeneral $general;
|
||||
|
@@ -42,6 +42,9 @@ class DropItemAction extends InventoryAction{
|
||||
if($this->targetItem->isNull()){
|
||||
throw new TransactionValidationException("Cannot drop an empty itemstack");
|
||||
}
|
||||
if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
|
||||
throw new TransactionValidationException("Target item exceeds item type max stack size");
|
||||
}
|
||||
}
|
||||
|
||||
public function onPreExecute(Player $source) : bool{
|
||||
|
@@ -68,6 +68,12 @@ class SlotChangeAction extends InventoryAction{
|
||||
if(!$this->inventory->getItem($this->inventorySlot)->equalsExact($this->sourceItem)){
|
||||
throw new TransactionValidationException("Slot does not contain expected original item");
|
||||
}
|
||||
if($this->targetItem->getCount() > $this->targetItem->getMaxStackSize()){
|
||||
throw new TransactionValidationException("Target item exceeds item type max stack size");
|
||||
}
|
||||
if($this->targetItem->getCount() > $this->inventory->getMaxStackSize()){
|
||||
throw new TransactionValidationException("Target item exceeds inventory max stack size");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -56,7 +56,9 @@ abstract class Worker extends \Worker{
|
||||
$this->isKilled = true;
|
||||
|
||||
if(!$this->isShutdown()){
|
||||
while($this->unstack() !== null);
|
||||
$this->synchronized(function() : void{
|
||||
while($this->unstack() !== null);
|
||||
});
|
||||
$this->notify();
|
||||
$this->shutdown();
|
||||
}
|
||||
|
@@ -69,6 +69,7 @@ use function mb_check_encoding;
|
||||
use function ob_end_clean;
|
||||
use function ob_get_contents;
|
||||
use function ob_start;
|
||||
use function opcache_get_status;
|
||||
use function ord;
|
||||
use function php_uname;
|
||||
use function phpversion;
|
||||
@@ -486,8 +487,8 @@ final class Utils{
|
||||
*/
|
||||
public static function currentTrace(int $skipFrames = 0) : array{
|
||||
++$skipFrames; //omit this frame from trace, in addition to other skipped frames
|
||||
if(function_exists("xdebug_get_function_stack")){
|
||||
$trace = array_reverse(xdebug_get_function_stack());
|
||||
if(function_exists("xdebug_get_function_stack") && count($trace = @xdebug_get_function_stack()) !== 0){
|
||||
$trace = array_reverse($trace);
|
||||
}else{
|
||||
$e = new \Exception();
|
||||
$trace = $e->getTrace();
|
||||
@@ -634,4 +635,30 @@ final class Utils{
|
||||
public static function checkLocationNotInfOrNaN(Location $location) : void{
|
||||
self::checkVector3NotInfOrNaN($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer describing the current OPcache JIT setting.
|
||||
* @see https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit
|
||||
*/
|
||||
public static function getOpcacheJitMode() : ?int{
|
||||
if(
|
||||
function_exists('opcache_get_status') &&
|
||||
($opcacheStatus = opcache_get_status(false)) !== false &&
|
||||
isset($opcacheStatus["jit"]["on"])
|
||||
){
|
||||
$jit = $opcacheStatus["jit"];
|
||||
if($jit["on"] === true){
|
||||
return (($jit["opt_flags"] >> 2) * 1000) +
|
||||
(($jit["opt_flags"] & 0x03) * 100) +
|
||||
($jit["kind"] * 10) +
|
||||
$jit["opt_level"];
|
||||
}
|
||||
|
||||
//jit available, but disabled
|
||||
return 0;
|
||||
}
|
||||
|
||||
//jit not available
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user