mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-13 21:05:08 +00:00
Compare commits
61 Commits
Author | SHA1 | Date | |
---|---|---|---|
c32026333f | |||
915224c8e5 | |||
734bc6c4a7 | |||
d36b24c518 | |||
d554d8060b | |||
b48243fd09 | |||
92cffc00d0 | |||
e87e974323 | |||
a3f6338626 | |||
21aef97ba7 | |||
ed0d1978aa | |||
d64561b0b1 | |||
d234d3e45e | |||
5056754cea | |||
2dc3cf8162 | |||
8c5a81cf5c | |||
2b58f2bafd | |||
5dadf12374 | |||
0d4e473bdd | |||
11cedc4011 | |||
3f2455f090 | |||
9d26a224a2 | |||
c4ad390463 | |||
42e14f749e | |||
3f07f06874 | |||
10279e11ed | |||
673e444456 | |||
89c49d77c6 | |||
c3a795e876 | |||
4199c3796f | |||
bf6af269c8 | |||
a29424f5b3 | |||
ff3af492f8 | |||
80b804f7aa | |||
3a78735982 | |||
ab32784c74 | |||
816234a379 | |||
b7bf92a5e9 | |||
dcca000ead | |||
c4ea51f985 | |||
8202bb1cd8 | |||
b75758e35e | |||
38a06f76f8 | |||
84f99ed418 | |||
fd63f19199 | |||
66d44aa814 | |||
f3089f577e | |||
9516ef1632 | |||
e982a57cb5 | |||
f57fa2252b | |||
02cc370855 | |||
0a5d14a840 | |||
3ec2994d7f | |||
786f416f2e | |||
a67d2ae978 | |||
089180fef4 | |||
fffa4b9501 | |||
71a8b0340c | |||
e544055bbc | |||
8f5db7c297 | |||
27f55e4c96 |
@ -30,9 +30,9 @@ If you use a custom binary, you'll need to replace `composer` usages in this gui
|
||||
Preprocessor requires that the `cpp` (c preprocessor) is available in your PATH.
|
||||
|
||||
## Building `PocketMine-MP.phar`
|
||||
Run `build/server.phar` using your preferred PHP binary. It'll drop a `PocketMine-MP.phar` into the current working directory.
|
||||
Run `build/server-phar.php` using your preferred PHP binary. It'll drop a `PocketMine-MP.phar` into the current working directory.
|
||||
|
||||
You can also use the `--out` option to change the output filename.
|
||||
|
||||
## Running PocketMine-MP from source code
|
||||
Run `src/pocketmine/PocketMine.php` using your preferred PHP binary.
|
||||
Run `src/pocketmine/PocketMine.php` using your preferred PHP binary.
|
||||
|
Submodule build/php updated: a6ab41089e...d475b694e4
@ -21,7 +21,33 @@ Plugin developers should **only** update their required API to this version if y
|
||||
- Fixed permission default timings not being reported in timings reports (they were never stopped, only started).
|
||||
- Resource packs with a directory tree like `pack.zip/MyPack/manifest.json` are now supported. Note that the manifest closest to the root will be used.
|
||||
- Fixed `SkinImage` height and width being inverted at the protocol layer.
|
||||
- Fixed blocks being able to be placed inside the spawn protectionb radius by clicking the side of a block outside the radius.
|
||||
- Fixed blocks being able to be placed inside the spawn protection radius by clicking the side of a block outside the radius.
|
||||
- Fixed server crash when `network.compression-level` is overridden by a CLI parameter.
|
||||
- Fixed moving entities spawning themselves to players registered on chunks when the players haven't received the chunk yet.
|
||||
- Cocoa pods now drop cocoa beans when broken instead of the block itself.
|
||||
|
||||
# 3.12.3
|
||||
- Core code is now analyzed using PHPStan level 8 (using baselines). While not all the code is level 8 compliant, this does mean that new code will be held to a higher standard, ensuring quality going forwards.
|
||||
- Players no longer burn when melee-attacked by other players. (vanilla parity)
|
||||
- Arrows shot by burning players are no longer on fire. (vanilla parity)
|
||||
- Fixed a crash that could occur with plugins on Unix filesystems that had backslashes in their names.
|
||||
- Cleaned up a whole bunch of unknowns in the protocol layer. Many new constants have been added.
|
||||
- Fixed player walking sounds.
|
||||
- Default generation queue size has been raised to 32 (previously 8). The previous default was selected in a time when PHP was much less performant than it is today, and in today's world it just needlessly slows things down.
|
||||
- Double plants are now burned away by fire.
|
||||
- Snow layers can now be stacked. (vanilla parity)
|
||||
- Resource pack sending chunk size has been reduced to 128 KB (previously 1 MB). This change was made after analyzing the effects that larger pack chunk sizes have on RakNet. Given the technical evidence, a smaller size, while slightly less bandwidth-efficient, should be more manageable for RakNet due to lower split reassembly overhead and reduced memory pressure.
|
||||
- Fixed "switching" (an exploit often complained about by PvP players). Now, the previous damage is subtracted from current damage when an entity is attacked while on cooldown. This means that attacking with a wooden sword and then diamond sword while attack cooldown is active will only deal as much damage as the diamond sword would have, instead of the combined total. This can be controlled using the `EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN` modifier. (vanilla parity)
|
||||
- Fixed projectiles knocking mobs back in unexpected directions on collision.
|
||||
- Fixed inventories not being synchronized on failed inventory transactions.
|
||||
- Vector3s decoded from packets are no longer rounded directly. Instead, the player movement handler takes responsibility for rounding the coordinates to prevent anti cheat doing something it's not supposed to.
|
||||
- `mobflame` particle can now be spawned using the `/particle` command.
|
||||
- Fixed several internal errors that could occur while modifying writable books.
|
||||
- Fixed swapping writable book pages not working in some cases.
|
||||
- `WritableBook->getPageText()` no longer throws an exception when the page doesn't exist, but returns null (as it was originally intended to).
|
||||
|
||||
# 3.12.4
|
||||
- Fixed absorption hearts not being consumed.
|
||||
|
||||
# 3.12.5
|
||||
- Fixed broken attack cooldowns.
|
@ -38,9 +38,9 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^0.12.25",
|
||||
"irstea/phpunit-shim": "^8.5",
|
||||
"phpstan/phpstan-phpunit": "^0.12.6",
|
||||
"phpstan/phpstan-strict-rules": "^0.12.2"
|
||||
"phpstan/phpstan-strict-rules": "^0.12.2",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
1554
composer.lock
generated
1554
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,8 @@ includes:
|
||||
- tests/phpstan/configs/com-dotnet-magic.neon
|
||||
- tests/phpstan/configs/custom-leveldb.neon
|
||||
- tests/phpstan/configs/gc-hacks.neon
|
||||
- tests/phpstan/configs/l7-baseline.neon
|
||||
- tests/phpstan/configs/l8-baseline.neon
|
||||
- tests/phpstan/configs/php-bugs.neon
|
||||
- tests/phpstan/configs/phpstan-bugs.neon
|
||||
- tests/phpstan/configs/phpunit-wiring-tests.neon
|
||||
@ -13,13 +15,12 @@ includes:
|
||||
- vendor/phpstan/phpstan-strict-rules/rules.neon
|
||||
|
||||
parameters:
|
||||
level: 6
|
||||
level: 8
|
||||
autoload_files:
|
||||
- tests/phpstan/bootstrap.php
|
||||
- src/pocketmine/PocketMine.php
|
||||
- build/make-release.php
|
||||
- build/server-phar.php
|
||||
- vendor/irstea/phpunit-shim/phpunit
|
||||
paths:
|
||||
- src
|
||||
- build/make-release.php
|
||||
|
@ -146,6 +146,7 @@ use pocketmine\network\mcpe\protocol\types\CommandEnum;
|
||||
use pocketmine\network\mcpe\protocol\types\CommandParameter;
|
||||
use pocketmine\network\mcpe\protocol\types\ContainerIds;
|
||||
use pocketmine\network\mcpe\protocol\types\DimensionIds;
|
||||
use pocketmine\network\mcpe\protocol\types\GameMode;
|
||||
use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor;
|
||||
use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
|
||||
@ -216,6 +217,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
public const SPECTATOR = 3;
|
||||
public const VIEW = Player::SPECTATOR;
|
||||
|
||||
private const RESOURCE_PACK_CHUNK_SIZE = 128 * 1024; //128KB
|
||||
|
||||
/**
|
||||
* Validates the given username.
|
||||
*/
|
||||
@ -1333,12 +1336,13 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* TODO: remove this when Spectator Mode gets added properly to MCPE
|
||||
*/
|
||||
public static function getClientFriendlyGamemode(int $gamemode) : int{
|
||||
$gamemode &= 0x03;
|
||||
if($gamemode === Player::SPECTATOR){
|
||||
return Player::CREATIVE;
|
||||
}
|
||||
|
||||
return $gamemode;
|
||||
static $map = [
|
||||
self::SURVIVAL => GameMode::SURVIVAL,
|
||||
self::CREATIVE => GameMode::CREATIVE,
|
||||
self::ADVENTURE => GameMode::ADVENTURE,
|
||||
self::SPECTATOR => GameMode::CREATIVE
|
||||
];
|
||||
return $map[$gamemode & 0x3];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2068,7 +2072,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$pk = new ResourcePackDataInfoPacket();
|
||||
$pk->packId = $pack->getPackId();
|
||||
$pk->maxChunkSize = 1048576; //1MB
|
||||
$pk->maxChunkSize = self::RESOURCE_PACK_CHUNK_SIZE;
|
||||
$pk->chunkCount = (int) ceil($pack->getPackSize() / $pk->maxChunkSize);
|
||||
$pk->compressedPackSize = $pack->getPackSize();
|
||||
$pk->sha256 = $pack->getSha256();
|
||||
@ -2234,7 +2238,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function handleMovePlayer(MovePlayerPacket $packet) : bool{
|
||||
$newPos = $packet->position->subtract(0, $this->baseOffset, 0);
|
||||
$newPos = $packet->position->round(4)->subtract(0, $this->baseOffset, 0);
|
||||
|
||||
if($this->isTeleporting and $newPos->distanceSquared($this) > 1){ //Tolerate up to 1 block to avoid problems with client-sided physics when spawning in blocks
|
||||
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);
|
||||
@ -2303,11 +2307,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->isSpectator()){
|
||||
$this->sendAllInventories();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @var InventoryAction[] $actions */
|
||||
$actions = [];
|
||||
foreach($packet->actions as $networkInventoryAction){
|
||||
@ -2401,7 +2400,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
$this->setUsingItem(false);
|
||||
|
||||
if(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13) or $this->isSpectator()){
|
||||
if(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13)){
|
||||
}elseif($this->isCreative()){
|
||||
$item = $this->inventory->getItemInHand();
|
||||
if($this->level->useItemOn($blockVector, $item, $face, $packet->trData->clickPos, $this, true)){
|
||||
@ -2507,7 +2506,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
$ev = new PlayerInteractEvent($this, $item, null, $directionVector, $face, PlayerInteractEvent::RIGHT_CLICK_AIR);
|
||||
if($this->hasItemCooldown($item)){
|
||||
if($this->hasItemCooldown($item) or $this->isSpectator()){
|
||||
$ev->setCancelled();
|
||||
}
|
||||
|
||||
@ -2558,7 +2557,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$heldItem = $this->inventory->getItemInHand();
|
||||
$oldItem = clone $heldItem;
|
||||
|
||||
if(!$this->canInteract($target, 8)){
|
||||
if(!$this->canInteract($target, 8) or $this->isSpectator()){
|
||||
$cancelled = true;
|
||||
}elseif($target instanceof Player){
|
||||
if(!$this->server->getConfigBool("pvp")){
|
||||
@ -3056,8 +3055,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$pk = new ResourcePackChunkDataPacket();
|
||||
$pk->packId = $pack->getPackId();
|
||||
$pk->chunkIndex = $packet->chunkIndex;
|
||||
$pk->data = $pack->getPackChunk(1048576 * $packet->chunkIndex, 1048576);
|
||||
$pk->progress = (1048576 * $packet->chunkIndex);
|
||||
$pk->data = $pack->getPackChunk(self::RESOURCE_PACK_CHUNK_SIZE * $packet->chunkIndex, self::RESOURCE_PACK_CHUNK_SIZE);
|
||||
$pk->progress = (self::RESOURCE_PACK_CHUNK_SIZE * $packet->chunkIndex);
|
||||
$this->dataPacket($pk);
|
||||
return true;
|
||||
}
|
||||
@ -3078,14 +3077,26 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$modifiedPages[] = $packet->pageNumber;
|
||||
break;
|
||||
case BookEditPacket::TYPE_ADD_PAGE:
|
||||
if(!$newBook->pageExists($packet->pageNumber)){
|
||||
//this may only come before a page which already exists
|
||||
//TODO: the client can send insert-before actions on trailing client-side pages which cause odd behaviour on the server
|
||||
return false;
|
||||
}
|
||||
$newBook->insertPage($packet->pageNumber, $packet->text);
|
||||
$modifiedPages[] = $packet->pageNumber;
|
||||
break;
|
||||
case BookEditPacket::TYPE_DELETE_PAGE:
|
||||
if(!$newBook->pageExists($packet->pageNumber)){
|
||||
return false;
|
||||
}
|
||||
$newBook->deletePage($packet->pageNumber);
|
||||
$modifiedPages[] = $packet->pageNumber;
|
||||
break;
|
||||
case BookEditPacket::TYPE_SWAP_PAGES:
|
||||
if(!$newBook->pageExists($packet->pageNumber) or !$newBook->pageExists($packet->secondaryPageNumber)){
|
||||
//the client will create pages on its own without telling us until it tries to switch them
|
||||
$newBook->addPage(max($packet->pageNumber, $packet->secondaryPageNumber));
|
||||
}
|
||||
$newBook->swapPages($packet->pageNumber, $packet->secondaryPageNumber);
|
||||
$modifiedPages = [$packet->pageNumber, $packet->secondaryPageNumber];
|
||||
break;
|
||||
@ -3741,6 +3752,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$pk->headYaw = $yaw;
|
||||
$pk->yaw = $yaw;
|
||||
$pk->mode = $mode;
|
||||
$pk->onGround = $this->onGround;
|
||||
|
||||
if($targets !== null){
|
||||
$this->server->broadcastPacket($targets, $pk);
|
||||
|
@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
|
||||
const _VERSION_INFO_INCLUDED = true;
|
||||
|
||||
const NAME = "PocketMine-MP";
|
||||
const BASE_VERSION = "3.12.2";
|
||||
const BASE_VERSION = "3.12.5";
|
||||
const IS_DEVELOPMENT_BUILD = false;
|
||||
const BUILD_NUMBER = 0;
|
||||
|
@ -124,4 +124,12 @@ class DoublePlant extends Flowable{
|
||||
|
||||
return parent::getAffectedBlocks();
|
||||
}
|
||||
|
||||
public function getFlameEncouragement() : int{
|
||||
return 60;
|
||||
}
|
||||
|
||||
public function getFlammability() : int{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class SnowLayer extends Flowable{
|
||||
}
|
||||
|
||||
public function canBeReplaced() : bool{
|
||||
return true;
|
||||
return $this->meta < 7; //8 snow layers
|
||||
}
|
||||
|
||||
public function getHardness() : float{
|
||||
@ -57,9 +57,15 @@ class SnowLayer extends Flowable{
|
||||
return TieredTool::TIER_WOODEN;
|
||||
}
|
||||
|
||||
private function canBeSupportedBy(Block $b) : bool{
|
||||
return $b->isSolid() or ($b->getId() === $this->getId() and $b->getDamage() === 7);
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
if($blockReplace->getSide(Vector3::SIDE_DOWN)->isSolid()){
|
||||
//TODO: fix placement
|
||||
if($blockReplace->getId() === $this->getId() and $blockReplace->getDamage() < 7){
|
||||
$this->setDamage($blockReplace->getDamage() + 1);
|
||||
}
|
||||
if($this->canBeSupportedBy($blockReplace->getSide(Vector3::SIDE_DOWN))){
|
||||
$this->getLevel()->setBlock($blockReplace, $this, true);
|
||||
|
||||
return true;
|
||||
@ -69,7 +75,7 @@ class SnowLayer extends Flowable{
|
||||
}
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
if(!$this->getSide(Vector3::SIDE_DOWN)->isSolid()){
|
||||
if(!$this->canBeSupportedBy($this->getSide(Vector3::SIDE_DOWN))){
|
||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false, false);
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,6 @@ class Water extends Liquid{
|
||||
if($entity->isOnFire()){
|
||||
$entity->extinguish();
|
||||
}
|
||||
|
||||
$entity->resetFallDistance();
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||
|
@ -37,6 +37,7 @@ use pocketmine\level\particle\CriticalParticle;
|
||||
use pocketmine\level\particle\DustParticle;
|
||||
use pocketmine\level\particle\EnchantmentTableParticle;
|
||||
use pocketmine\level\particle\EnchantParticle;
|
||||
use pocketmine\level\particle\EntityFlameParticle;
|
||||
use pocketmine\level\particle\ExplodeParticle;
|
||||
use pocketmine\level\particle\FlameParticle;
|
||||
use pocketmine\level\particle\HappyVillagerParticle;
|
||||
@ -204,7 +205,8 @@ class ParticleCommand extends VanillaCommand{
|
||||
return new AngryVillagerParticle($pos);
|
||||
case "forcefield":
|
||||
return new BlockForceFieldParticle($pos, $data ?? 0);
|
||||
|
||||
case "mobflame":
|
||||
return new EntityFlameParticle($pos);
|
||||
}
|
||||
|
||||
if(strpos($name, "iconcrack_") === 0){
|
||||
|
@ -1168,6 +1168,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
if($teleport){
|
||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_TELEPORT;
|
||||
}
|
||||
if($this->onGround){
|
||||
$pk->flags |= MoveActorAbsolutePacket::FLAG_GROUND;
|
||||
}
|
||||
|
||||
$this->level->broadcastPacketToViewers($this, $pk);
|
||||
}
|
||||
|
@ -436,6 +436,12 @@ abstract class Living extends Entity implements Damageable{
|
||||
* to effects or armour.
|
||||
*/
|
||||
public function applyDamageModifiers(EntityDamageEvent $source) : void{
|
||||
if($this->lastDamageCause !== null and $this->attackTime > 0){
|
||||
if($this->lastDamageCause->getBaseDamage() >= $source->getBaseDamage()){
|
||||
$source->setCancelled();
|
||||
}
|
||||
$source->setModifier(-$this->lastDamageCause->getBaseDamage(), EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN);
|
||||
}
|
||||
if($source->canBeReducedByArmor()){
|
||||
//MCPE uses the same system as PC did pre-1.9
|
||||
$source->setModifier(-$source->getFinalDamage() * $this->getArmorPoints() * 0.04, EntityDamageEvent::MODIFIER_ARMOR);
|
||||
@ -514,11 +520,6 @@ abstract class Living extends Entity implements Damageable{
|
||||
public function attack(EntityDamageEvent $source) : void{
|
||||
if($this->noDamageTicks > 0){
|
||||
$source->setCancelled();
|
||||
}elseif($this->attackTime > 0){
|
||||
$lastCause = $this->getLastDamageCause();
|
||||
if($lastCause !== null and $lastCause->getBaseDamage() >= $source->getBaseDamage()){
|
||||
$source->setCancelled();
|
||||
}
|
||||
}
|
||||
|
||||
if($this->hasEffect(Effect::FIRE_RESISTANCE) and (
|
||||
@ -550,20 +551,15 @@ abstract class Living extends Entity implements Damageable{
|
||||
|
||||
$this->attackTime = $source->getAttackCooldown();
|
||||
|
||||
if($source instanceof EntityDamageByEntityEvent){
|
||||
$e = $source->getDamager();
|
||||
if($source instanceof EntityDamageByChildEntityEvent){
|
||||
$e = $source->getChild();
|
||||
}
|
||||
|
||||
if($source instanceof EntityDamageByChildEntityEvent){
|
||||
$e = $source->getChild();
|
||||
if($e !== null){
|
||||
$motion = $e->getMotion();
|
||||
$this->knockBack($e, $source->getBaseDamage(), $motion->x, $motion->z, $source->getKnockBack());
|
||||
}
|
||||
}elseif($source instanceof EntityDamageByEntityEvent){
|
||||
$e = $source->getDamager();
|
||||
if($e !== null){
|
||||
if((
|
||||
$source->getCause() === EntityDamageEvent::CAUSE_PROJECTILE or
|
||||
$source->getCause() === EntityDamageEvent::CAUSE_ENTITY_ATTACK
|
||||
) and $e->isOnFire()){
|
||||
$this->setOnFire(2 * $this->level->getDifficulty());
|
||||
}
|
||||
|
||||
$deltaX = $this->x - $e->x;
|
||||
$deltaZ = $this->z - $e->z;
|
||||
$this->knockBack($e, $source->getBaseDamage(), $deltaX, $deltaZ, $source->getKnockBack());
|
||||
|
@ -111,7 +111,7 @@ class FallingBlock extends Entity{
|
||||
$this->flagForDespawn();
|
||||
|
||||
$block = $this->level->getBlock($pos);
|
||||
if(($block->isTransparent() and !$block->canBeReplaced()) or ($this->onGround and abs($this->y - $this->getFloorY()) > 0.001)){
|
||||
if(!$block->canBeReplaced() or ($this->onGround and abs($this->y - $this->getFloorY()) > 0.001)){
|
||||
//FIXME: anvils are supposed to destroy torches
|
||||
$this->getLevel()->dropItem($this, ItemFactory::get($this->getBlock(), $this->getDamage()));
|
||||
}else{
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\event\entity;
|
||||
use pocketmine\entity\Entity;
|
||||
use pocketmine\event\Cancellable;
|
||||
use function array_sum;
|
||||
use function max;
|
||||
|
||||
/**
|
||||
* Called when an entity takes damage.
|
||||
@ -40,6 +41,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
||||
public const MODIFIER_CRITICAL = 7;
|
||||
public const MODIFIER_TOTEM = 8;
|
||||
public const MODIFIER_WEAPON_ENCHANTMENTS = 9;
|
||||
public const MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10;
|
||||
|
||||
public const CAUSE_CONTACT = 0;
|
||||
public const CAUSE_ENTITY_ATTACK = 1;
|
||||
@ -143,7 +145,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
||||
}
|
||||
|
||||
public function getFinalDamage() : float{
|
||||
return $this->baseDamage + array_sum($this->modifiers);
|
||||
return max(0, $this->baseDamage + array_sum($this->modifiers));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\event\player;
|
||||
|
||||
use pocketmine\lang\TextContainer;
|
||||
use pocketmine\lang\TranslationContainer;
|
||||
use pocketmine\Player;
|
||||
|
||||
/**
|
||||
|
@ -293,7 +293,12 @@ class InventoryTransaction{
|
||||
|
||||
$this->shuffleActions();
|
||||
|
||||
$this->validate();
|
||||
try{
|
||||
$this->validate();
|
||||
}catch(TransactionValidationException $e){
|
||||
$this->sendInventories();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if(!$this->callExecuteEvent()){
|
||||
$this->sendInventories();
|
||||
|
@ -59,7 +59,6 @@ class Bow extends Tool{
|
||||
($player->yaw > 180 ? 360 : 0) - $player->yaw,
|
||||
-$player->pitch
|
||||
);
|
||||
$nbt->setShort("Fire", $player->isOnFire() ? 45 * 60 : 0);
|
||||
|
||||
$diff = $player->getItemUseDuration();
|
||||
$p = $diff / 20;
|
||||
@ -84,7 +83,7 @@ class Bow extends Tool{
|
||||
}
|
||||
$ev = new EntityShootBowEvent($player, $this, $entity, $baseForce * 3);
|
||||
|
||||
if($baseForce < 0.1 or $diff < 5){
|
||||
if($baseForce < 0.1 or $diff < 5 or $player->isSpectator()){
|
||||
$ev->setCancelled();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class WritableBook extends Item{
|
||||
*/
|
||||
public function getPageText(int $pageId) : ?string{
|
||||
$pages = $this->getNamedTag()->getListTag(self::TAG_PAGES);
|
||||
if($pages === null){
|
||||
if($pages === null or !$pages->isset($pageId)){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1856,7 +1856,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
if($player !== null){
|
||||
$ev = new PlayerInteractEvent($player, $item, $blockClicked, $clickVector, $face, PlayerInteractEvent::RIGHT_CLICK_BLOCK);
|
||||
if($this->checkSpawnProtection($player, $blockClicked)){
|
||||
if($this->checkSpawnProtection($player, $blockClicked) or $player->isSpectator()){
|
||||
$ev->setCancelled(); //set it to cancelled so plugins can bypass this
|
||||
}
|
||||
|
||||
@ -1909,7 +1909,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
if($player !== null){
|
||||
$ev = new BlockPlaceEvent($player, $hand, $blockReplace, $blockClicked, $item);
|
||||
if($this->checkSpawnProtection($player, $blockReplace)){
|
||||
if($this->checkSpawnProtection($player, $blockReplace) or $player->isSpectator()){
|
||||
$ev->setCancelled();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\network\mcpe\protocol\types\CommandOriginData;
|
||||
use pocketmine\network\mcpe\protocol\types\EntityLink;
|
||||
use pocketmine\network\mcpe\protocol\types\GameRuleType;
|
||||
use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor;
|
||||
use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece;
|
||||
use pocketmine\network\mcpe\protocol\types\SkinAnimation;
|
||||
@ -546,9 +547,9 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
*/
|
||||
public function getVector3() : Vector3{
|
||||
return new Vector3(
|
||||
$this->getRoundedLFloat(4),
|
||||
$this->getRoundedLFloat(4),
|
||||
$this->getRoundedLFloat(4)
|
||||
$this->getLFloat(),
|
||||
$this->getLFloat(),
|
||||
$this->getLFloat()
|
||||
);
|
||||
}
|
||||
|
||||
@ -602,13 +603,13 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$type = $this->getUnsignedVarInt();
|
||||
$value = null;
|
||||
switch($type){
|
||||
case 1:
|
||||
case GameRuleType::BOOL:
|
||||
$value = $this->getBool();
|
||||
break;
|
||||
case 2:
|
||||
case GameRuleType::INT:
|
||||
$value = $this->getUnsignedVarInt();
|
||||
break;
|
||||
case 3:
|
||||
case GameRuleType::FLOAT:
|
||||
$value = $this->getLFloat();
|
||||
break;
|
||||
}
|
||||
@ -632,13 +633,13 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$this->putString($name);
|
||||
$this->putUnsignedVarInt($rule[0]);
|
||||
switch($rule[0]){
|
||||
case 1:
|
||||
case GameRuleType::BOOL:
|
||||
$this->putBool($rule[1]);
|
||||
break;
|
||||
case 2:
|
||||
case GameRuleType::INT:
|
||||
$this->putUnsignedVarInt($rule[1]);
|
||||
break;
|
||||
case 3:
|
||||
case GameRuleType::FLOAT:
|
||||
$this->putLFloat($rule[1]);
|
||||
break;
|
||||
}
|
||||
@ -671,7 +672,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$result->requestId = $this->getString();
|
||||
|
||||
if($result->type === CommandOriginData::ORIGIN_DEV_CONSOLE or $result->type === CommandOriginData::ORIGIN_TEST){
|
||||
$result->varlong1 = $this->getVarLong();
|
||||
$result->playerEntityUniqueId = $this->getVarLong();
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -683,7 +684,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$this->putString($data->requestId);
|
||||
|
||||
if($data->type === CommandOriginData::ORIGIN_DEV_CONSOLE or $data->type === CommandOriginData::ORIGIN_TEST){
|
||||
$this->putVarLong($data->varlong1);
|
||||
$this->putVarLong($data->playerEntityUniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ use function json_decode;
|
||||
class LoginPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::LOGIN_PACKET;
|
||||
|
||||
public const EDITION_POCKET = 0;
|
||||
|
||||
/** @var string */
|
||||
public $username;
|
||||
/** @var int */
|
||||
|
@ -33,6 +33,7 @@ class MoveActorAbsolutePacket extends DataPacket{
|
||||
|
||||
public const FLAG_GROUND = 0x01;
|
||||
public const FLAG_TELEPORT = 0x02;
|
||||
public const FLAG_FORCE_MOVE_LOCAL_ENTITY = 0x04;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
|
@ -36,6 +36,9 @@ class MoveActorDeltaPacket extends DataPacket{
|
||||
public const FLAG_HAS_ROT_X = 0x08;
|
||||
public const FLAG_HAS_ROT_Y = 0x10;
|
||||
public const FLAG_HAS_ROT_Z = 0x20;
|
||||
public const FLAG_GROUND = 0x40;
|
||||
public const FLAG_TELEPORT = 0x80;
|
||||
public const FLAG_FORCE_MOVE_LOCAL_ENTITY = 0x100;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
|
@ -30,6 +30,13 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class NpcRequestPacket extends DataPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::NPC_REQUEST_PACKET;
|
||||
|
||||
public const REQUEST_SET_ACTIONS = 0;
|
||||
public const REQUEST_EXECUTE_ACTION = 1;
|
||||
public const REQUEST_EXECUTE_CLOSING_COMMANDS = 2;
|
||||
public const REQUEST_SET_NAME = 3;
|
||||
public const REQUEST_SET_SKIN = 4;
|
||||
public const REQUEST_SET_INTERACTION_TEXT = 5;
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var int */
|
||||
|
@ -49,7 +49,7 @@ class PlayerActionPacket extends DataPacket{
|
||||
public const ACTION_STOP_GLIDE = 16;
|
||||
public const ACTION_BUILD_DENIED = 17;
|
||||
public const ACTION_CONTINUE_BREAK = 18;
|
||||
|
||||
public const ACTION_CHANGE_SKIN = 19;
|
||||
public const ACTION_SET_ENCHANTMENT_SEED = 20;
|
||||
public const ACTION_START_SWIMMING = 21;
|
||||
public const ACTION_STOP_SWIMMING = 22;
|
||||
|
@ -32,6 +32,7 @@ class SimpleEventPacket extends DataPacket{
|
||||
|
||||
public const TYPE_ENABLE_COMMANDS = 1;
|
||||
public const TYPE_DISABLE_COMMANDS = 2;
|
||||
public const TYPE_UNLOCK_WORLD_TEMPLATE_SETTINGS = 3;
|
||||
|
||||
/** @var int */
|
||||
public $eventType;
|
||||
|
@ -30,6 +30,10 @@ use pocketmine\nbt\NetworkLittleEndianNBTStream;
|
||||
use pocketmine\nbt\tag\ListTag;
|
||||
use pocketmine\network\mcpe\NetworkBinaryStream;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\protocol\types\EducationEditionOffer;
|
||||
use pocketmine\network\mcpe\protocol\types\GameRuleType;
|
||||
use pocketmine\network\mcpe\protocol\types\GeneratorType;
|
||||
use pocketmine\network\mcpe\protocol\types\MultiplayerGameVisibility;
|
||||
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
|
||||
use pocketmine\network\mcpe\protocol\types\RuntimeBlockMapping;
|
||||
use function count;
|
||||
@ -65,7 +69,7 @@ class StartGamePacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $dimension;
|
||||
/** @var int */
|
||||
public $generator = 1; //default infinite - 0 old, 1 infinite, 2 flat
|
||||
public $generator = GeneratorType::OVERWORLD;
|
||||
/** @var int */
|
||||
public $worldGamemode;
|
||||
/** @var int */
|
||||
@ -81,7 +85,7 @@ class StartGamePacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $time = -1;
|
||||
/** @var int */
|
||||
public $eduEditionOffer = 0;
|
||||
public $eduEditionOffer = EducationEditionOffer::NONE;
|
||||
/** @var bool */
|
||||
public $hasEduFeaturesEnabled = false;
|
||||
/** @var float */
|
||||
@ -95,9 +99,9 @@ class StartGamePacket extends DataPacket{
|
||||
/** @var bool */
|
||||
public $hasLANBroadcast = true;
|
||||
/** @var int */
|
||||
public $xboxLiveBroadcastMode = 0; //TODO: find values
|
||||
public $xboxLiveBroadcastMode = MultiplayerGameVisibility::PUBLIC;
|
||||
/** @var int */
|
||||
public $platformBroadcastMode = 0;
|
||||
public $platformBroadcastMode = MultiplayerGameVisibility::PUBLIC;
|
||||
/** @var bool */
|
||||
public $commandsEnabled;
|
||||
/** @var bool */
|
||||
@ -107,7 +111,7 @@ class StartGamePacket extends DataPacket{
|
||||
* @phpstan-var array<string, array{0: int, 1: bool|int|float}>
|
||||
*/
|
||||
public $gameRules = [ //TODO: implement this
|
||||
"naturalregeneration" => [1, false] //Hack for client side regeneration
|
||||
"naturalregeneration" => [GameRuleType::BOOL, false] //Hack for client side regeneration
|
||||
];
|
||||
/** @var bool */
|
||||
public $hasBonusChestEnabled = false;
|
||||
|
@ -30,21 +30,25 @@ use pocketmine\network\mcpe\NetworkSession;
|
||||
class UpdateBlockSyncedPacket extends UpdateBlockPacket{
|
||||
public const NETWORK_ID = ProtocolInfo::UPDATE_BLOCK_SYNCED_PACKET;
|
||||
|
||||
public const TYPE_NONE = 0;
|
||||
public const TYPE_CREATE = 1;
|
||||
public const TYPE_DESTROY = 2;
|
||||
|
||||
/** @var int */
|
||||
public $entityUniqueId = 0;
|
||||
public $entityUniqueId;
|
||||
/** @var int */
|
||||
public $uvarint64_2 = 0;
|
||||
public $updateType;
|
||||
|
||||
protected function decodePayload(){
|
||||
parent::decodePayload();
|
||||
$this->entityUniqueId = $this->getUnsignedVarLong();
|
||||
$this->uvarint64_2 = $this->getUnsignedVarLong();
|
||||
$this->updateType = $this->getUnsignedVarLong();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
parent::encodePayload();
|
||||
$this->putUnsignedVarLong($this->entityUniqueId);
|
||||
$this->putUnsignedVarLong($this->uvarint64_2);
|
||||
$this->putUnsignedVarLong($this->updateType);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
@ -48,5 +48,5 @@ class CommandOriginData{
|
||||
public $requestId;
|
||||
|
||||
/** @var int */
|
||||
public $varlong1;
|
||||
public $playerEntityUniqueId;
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
final class EducationEditionOffer{
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const NONE = 0;
|
||||
public const EVERYWHERE_EXCEPT_CHINA = 1;
|
||||
public const CHINA = 2;
|
||||
}
|
38
src/pocketmine/network/mcpe/protocol/types/GameMode.php
Normal file
38
src/pocketmine/network/mcpe/protocol/types/GameMode.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
final class GameMode{
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const SURVIVAL = 0;
|
||||
public const CREATIVE = 1;
|
||||
public const ADVENTURE = 2;
|
||||
public const SURVIVAL_VIEWER = 3;
|
||||
public const CREATIVE_VIEWER = 4;
|
||||
public const DEFAULT = 5;
|
||||
}
|
35
src/pocketmine/network/mcpe/protocol/types/GameRuleType.php
Normal file
35
src/pocketmine/network/mcpe/protocol/types/GameRuleType.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
final class GameRuleType{
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const BOOL = 1;
|
||||
public const INT = 2;
|
||||
public const FLOAT = 3;
|
||||
}
|
37
src/pocketmine/network/mcpe/protocol/types/GeneratorType.php
Normal file
37
src/pocketmine/network/mcpe/protocol/types/GeneratorType.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
final class GeneratorType{
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const FINITE_OVERWORLD = 0;
|
||||
public const OVERWORLD = 1;
|
||||
public const FLAT = 2;
|
||||
public const NETHER = 3;
|
||||
public const THE_END = 4;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
final class MultiplayerGameVisibility{
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const NONE = 0;
|
||||
public const INVITE = 1;
|
||||
public const FRIENDS = 2;
|
||||
public const FRIENDS_OF_FRIENDS = 3;
|
||||
public const PUBLIC = 4;
|
||||
}
|
34
src/pocketmine/network/mcpe/protocol/types/UIProfile.php
Normal file
34
src/pocketmine/network/mcpe/protocol/types/UIProfile.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network\mcpe\protocol\types;
|
||||
|
||||
final class UIProfile{
|
||||
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const CLASSIC = 0;
|
||||
public const POCKET = 1;
|
||||
}
|
@ -78,8 +78,8 @@ abstract class PluginBase implements Plugin{
|
||||
$this->loader = $loader;
|
||||
$this->server = $server;
|
||||
$this->description = $description;
|
||||
$this->dataFolder = rtrim($dataFolder, "\\/") . "/";
|
||||
$this->file = rtrim($file, "\\/") . "/";
|
||||
$this->dataFolder = rtrim($dataFolder, "/" . DIRECTORY_SEPARATOR) . "/";
|
||||
$this->file = rtrim($file, "/" . DIRECTORY_SEPARATOR) . "/";
|
||||
$this->configFile = $this->dataFolder . "config.yml";
|
||||
$this->logger = new PluginLogger($this);
|
||||
$this->scheduler = new TaskScheduler($this->logger, $this->getFullName());
|
||||
@ -169,7 +169,7 @@ abstract class PluginBase implements Plugin{
|
||||
* @return null|resource Resource data, or null
|
||||
*/
|
||||
public function getResource(string $filename){
|
||||
$filename = rtrim(str_replace("\\", "/", $filename), "/");
|
||||
$filename = rtrim(str_replace(DIRECTORY_SEPARATOR, "/", $filename), "/");
|
||||
if(file_exists($this->file . "resources/" . $filename)){
|
||||
return fopen($this->file . "resources/" . $filename, "rb");
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ chunk-ticking:
|
||||
|
||||
chunk-generation:
|
||||
#Max. amount of chunks in the waiting queue to be populated
|
||||
population-queue-size: 8
|
||||
population-queue-size: 32
|
||||
|
||||
ticks-per:
|
||||
autosave: 6000
|
||||
|
@ -94,8 +94,7 @@ class Random{
|
||||
$this->x = $this->y;
|
||||
$this->y = $this->z;
|
||||
$this->z = $this->w;
|
||||
$this->w = ($this->w ^ (($this->w >> 19) & 0x7fffffff)
|
||||
^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;
|
||||
$this->w = ($this->w ^ (($this->w >> 19) & 0x7fffffff) ^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;
|
||||
|
||||
return $this->w;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use function fopen;
|
||||
use function function_exists;
|
||||
use function getenv;
|
||||
use function is_array;
|
||||
use function sapi_windows_vt100_support;
|
||||
use function stream_isatty;
|
||||
|
||||
abstract class Terminal{
|
||||
|
@ -89,6 +89,7 @@ use function substr;
|
||||
use function sys_get_temp_dir;
|
||||
use function trim;
|
||||
use function xdebug_get_function_stack;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use const PHP_EOL;
|
||||
use const PHP_INT_MAX;
|
||||
use const PHP_INT_SIZE;
|
||||
@ -639,7 +640,7 @@ class Utils{
|
||||
* @return string
|
||||
*/
|
||||
public static function cleanPath($path){
|
||||
$result = str_replace(["\\", ".php", "phar://"], ["/", "", ""], $path);
|
||||
$result = str_replace([DIRECTORY_SEPARATOR, ".php", "phar://"], ["/", "", ""], $path);
|
||||
|
||||
//remove relative paths
|
||||
//TODO: make these paths dynamic so they can be unit-tested against
|
||||
@ -648,7 +649,7 @@ class Utils{
|
||||
\pocketmine\PATH => ""
|
||||
];
|
||||
foreach($cleanPaths as $cleanPath => $replacement){
|
||||
$cleanPath = rtrim(str_replace(["\\", "phar://"], ["/", ""], $cleanPath), "/");
|
||||
$cleanPath = rtrim(str_replace([DIRECTORY_SEPARATOR, "phar://"], ["/", ""], $cleanPath), "/");
|
||||
if(strpos($result, $cleanPath) === 0){
|
||||
$result = ltrim(str_replace($cleanPath, $replacement, $result), "/");
|
||||
}
|
||||
|
1582
tests/phpstan/configs/l7-baseline.neon
Normal file
1582
tests/phpstan/configs/l7-baseline.neon
Normal file
File diff suppressed because it is too large
Load Diff
2397
tests/phpstan/configs/l8-baseline.neon
Normal file
2397
tests/phpstan/configs/l8-baseline.neon
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user