Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
dries-c committed May 11, 2024
2 parents 2398a0e + 5ef2476 commit 19a32c7
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/discord-release-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup PHP and tools
uses: shivammathur/[email protected].2
uses: shivammathur/[email protected].4
with:
php-version: 8.2

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
submodules: true

- name: Setup PHP
uses: shivammathur/[email protected].2
uses: shivammathur/[email protected].4
with:
php-version: ${{ matrix.php-version }}

Expand Down Expand Up @@ -76,6 +76,9 @@ jobs:
${{ steps.php-binary-url.outputs.PHP_BINARY_URL }} \
> build_info.json
- name: Generate core permission doc for doc.pmmp.io
run: php tools/generate-permission-doc.php rst

- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -84,6 +87,7 @@ jobs:
${{ github.workspace }}/PocketMine-MP.phar
${{ github.workspace }}/start.*
${{ github.workspace }}/build_info.json
${{ github.workspace }}/core-permissions.rst
- name: Create draft release
uses: ncipollo/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup PHP and tools
uses: shivammathur/[email protected].2
uses: shivammathur/[email protected].4
with:
php-version: 8.2
tools: php-cs-fixer:3.49
Expand Down
16 changes: 16 additions & 0 deletions changelogs/5.15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 5.15.0
Released 25th April 2024.

**For Minecraft: Bedrock Edition 1.20.80**

This is a support release for Minecraft: Bedrock Edition 1.20.80.

**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace.
Do not update plugin minimum API versions unless you need new features added in this release.

**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.**
Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly.

## General
- Added support for Minecraft: Bedrock Edition 1.20.80.
- Removed support for earlier versions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"symfony/filesystem": "~6.4.0"
},
"require-dev": {
"phpstan/phpstan": "1.10.66",
"phpstan/phpstan": "1.10.67",
"phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0"
Expand Down
104 changes: 81 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1711,9 +1711,11 @@ public function crashDump() : void{
$this->isRunning = false;

//Force minimum uptime to be >= 120 seconds, to reduce the impact of spammy crash loops
$spacing = ((int) $this->startTime) - time() + 120;
$uptime = time() - ((int) $this->startTime);
$minUptime = 120;
$spacing = $minUptime - $uptime;
if($spacing > 0){
echo "--- Waiting $spacing seconds to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL;
echo "--- Uptime {$uptime}s - waiting {$spacing}s to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL;
sleep($spacing);
}
@Process::kill(Process::pid());
Expand Down
2 changes: 1 addition & 1 deletion src/VersionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

final class VersionInfo{
public const NAME = "PocketMine-MP";
public const BASE_VERSION = "5.14.2";
public const BASE_VERSION = "5.15.1";
public const IS_DEVELOPMENT_BUILD = true;
public const BUILD_CHANNEL = "stable";

Expand Down
33 changes: 20 additions & 13 deletions src/entity/Living.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,26 +564,33 @@ public function attack(EntityDamageEvent $source) : void{
return;
}

$this->attackTime = $source->getAttackCooldown();
if($this->attackTime <= 0){
//this logic only applies if the entity was cold attacked

if($source instanceof EntityDamageByChildEntityEvent){
$e = $source->getChild();
if($e !== null){
$motion = $e->getMotion();
$this->knockBack($motion->x, $motion->z, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
$this->attackTime = $source->getAttackCooldown();

if($source instanceof EntityDamageByChildEntityEvent){
$e = $source->getChild();
if($e !== null){
$motion = $e->getMotion();
$this->knockBack($motion->x, $motion->z, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
}
}elseif($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
if($e !== null){
$deltaX = $this->location->x - $e->location->x;
$deltaZ = $this->location->z - $e->location->z;
$this->knockBack($deltaX, $deltaZ, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
}
}
}elseif($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
if($e !== null){
$deltaX = $this->location->x - $e->location->x;
$deltaZ = $this->location->z - $e->location->z;
$this->knockBack($deltaX, $deltaZ, $source->getKnockBack(), $source->getVerticalKnockBackLimit());

if($this->isAlive()){
$this->doHitAnimation();
}
}

if($this->isAlive()){
$this->applyPostDamageEffects($source);
$this->doHitAnimation();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/permission/DefaultPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function registerCorePermissions() : void{
self::registerPermission(new Permission(Names::COMMAND_PLUGINS, l10n::pocketmine_permission_command_plugins()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SAVE_DISABLE, l10n::pocketmine_permission_command_save_disable()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SAVE_ENABLE, l10n::pocketmine_permission_command_save_enable()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SAVE_PERFORM, l10n::pocketmine_permission_command_save_enable()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SAVE_PERFORM, l10n::pocketmine_permission_command_save_perform()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SAY, l10n::pocketmine_permission_command_say()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SEED, l10n::pocketmine_permission_command_seed()), [$operatorRoot]);
self::registerPermission(new Permission(Names::COMMAND_SETWORLDSPAWN, l10n::pocketmine_permission_command_setworldspawn()), [$operatorRoot]);
Expand Down

0 comments on commit 19a32c7

Please sign in to comment.