-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'pmmp/minor-next' into stable
# Conflicts: # build/php # composer.json # composer.lock # src/block/Cactus.php # src/block/DeadBush.php # src/block/RedstoneComparator.php # src/block/RedstoneRepeater.php # src/block/tile/Banner.php # src/block/tile/Bed.php # src/block/tile/MobHead.php # src/block/tile/Sign.php # src/event/player/PlayerEnchantingOptionsRequestEvent.php # src/item/LiquidBucket.php # src/network/mcpe/NetworkSession.php # src/network/mcpe/cache/CraftingDataCache.php # src/network/mcpe/handler/InGamePacketHandler.php # src/network/mcpe/handler/ItemStackRequestExecutor.php # src/world/World.php
- Loading branch information
Showing
282 changed files
with
4,458 additions
and
4,920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP and tools | ||
uses: shivammathur/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,16 +11,18 @@ jobs: | |
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: [8.1] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: 8.1 | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: Restore Composer package cache | ||
uses: actions/cache@v3 | ||
|
@@ -58,8 +60,21 @@ jobs: | |
echo CHANGELOG_SUFFIX=$(php -r 'require "vendor/autoload.php"; echo \pocketmine\VersionInfo::BUILD_CHANNEL === "stable" ? "" : "-" . \pocketmine\VersionInfo::BUILD_CHANNEL;') >> $GITHUB_OUTPUT | ||
echo PRERELEASE=$(php -r 'require "vendor/autoload.php"; echo \pocketmine\VersionInfo::BUILD_CHANNEL === "stable" ? "false" : "true";') >> $GITHUB_OUTPUT | ||
- name: Generate PHP binary download URL | ||
id: php-binary-url | ||
run: | | ||
echo PHP_BINARY_URL="${{ github.server_url }}/${{ github.repository_owner }}/PHP-Binaries/releases/tag/php-${{ matrix.php-version }}-latest" >> $GITHUB_OUTPUT | ||
- name: Generate build info | ||
run: php build/generate-build-info-json.php ${{ github.sha }} ${{ steps.get-pm-version.outputs.PM_VERSION }} ${{ github.repository }} ${{ steps.build-number.outputs.BUILD_NUMBER }} ${{ github.run_id }} > build_info.json | ||
run: | | ||
php build/generate-build-info-json.php \ | ||
${{ github.sha }} \ | ||
${{ steps.get-pm-version.outputs.PM_VERSION }} \ | ||
${{ github.repository }} \ | ||
${{ steps.build-number.outputs.BUILD_NUMBER }} \ | ||
${{ github.run_id }} \ | ||
${{ steps.php-binary-url.outputs.PHP_BINARY_URL }} \ | ||
> build_info.json | ||
- name: Upload release artifacts | ||
uses: actions/upload-artifact@v3 | ||
|
@@ -71,7 +86,7 @@ jobs: | |
${{ github.workspace }}/build_info.json | ||
- name: Create draft release | ||
uses: ncipollo/release-action@v1.12.0 | ||
uses: ncipollo/release-action@v1.13.0 | ||
with: | ||
artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json | ||
commit: ${{ github.sha }} | ||
|
@@ -84,3 +99,5 @@ jobs: | |
**For Minecraft: Bedrock Edition ${{ steps.get-pm-version.outputs.MCPE_VERSION }}** | ||
Please see the [changelogs](${{ github.server_url }}/${{ github.repository }}/blob/${{ steps.get-pm-version.outputs.PM_VERSION }}/changelogs/${{ steps.get-pm-version.outputs.PM_VERSION_SHORT }}${{ steps.get-pm-version.outputs.CHANGELOG_SUFFIX }}.md#${{ steps.get-pm-version.outputs.PM_VERSION_MD }}) for details. | ||
:information_source: Download the recommended PHP binary [here](${{ steps.php-binary-url.outputs.PHP_BINARY_URL }}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
php: ["8.1", "8.2"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: pmmp/[email protected] | ||
|
@@ -50,7 +50,7 @@ jobs: | |
php: ["8.1", "8.2"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: pmmp/[email protected] | ||
|
@@ -85,7 +85,7 @@ jobs: | |
php: ["8.1", "8.2"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
|
@@ -122,7 +122,7 @@ jobs: | |
php: ["8.1", "8.2"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: pmmp/[email protected] | ||
|
@@ -150,12 +150,12 @@ jobs: | |
- name: Regenerate KnownTranslation APIs | ||
run: php build/generate-known-translation-apis.php | ||
|
||
- name: Regenerate RuntimeEnum(De)serializer | ||
run: php build/generate-runtime-enum-serializers.php | ||
|
||
- name: Regenerate BedrockData available files constants | ||
run: php build/generate-bedrockdata-path-consts.php | ||
|
||
- name: Regenerate YmlServerProperties constants | ||
run: php build/generate-pocketmine-yml-property-consts.php | ||
|
||
- name: Verify code is unchanged | ||
run: | | ||
git diff | ||
|
@@ -168,7 +168,7 @@ jobs: | |
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP and tools | ||
uses: shivammathur/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?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); | ||
|
||
use pocketmine\utils\Filesystem; | ||
use pocketmine\utils\Utils; | ||
|
||
require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
$defaultConfig = yaml_parse(Filesystem::fileGetContents(dirname(__DIR__) . '/resources/pocketmine.yml')); | ||
|
||
if(!is_array($defaultConfig)){ | ||
fwrite(STDERR, "Invalid default pocketmine.yml\n"); | ||
exit(1); | ||
} | ||
|
||
$constants = []; | ||
|
||
/** | ||
* @param mixed[] $properties | ||
* @param string[] $constants | ||
* @phpstan-param array<string, string> $constants | ||
* @phpstan-param-out array<string, string> $constants | ||
*/ | ||
function collectProperties(string $prefix, array $properties, array &$constants) : void{ | ||
foreach($properties as $propertyName => $property){ | ||
$fullPropertyName = ($prefix !== "" ? $prefix . "." : "") . $propertyName; | ||
|
||
$constName = str_replace([".", "-"], "_", strtoupper($fullPropertyName)); | ||
$constants[$constName] = $fullPropertyName; | ||
|
||
if(is_array($property)){ | ||
collectProperties($fullPropertyName, $property, $constants); | ||
} | ||
} | ||
} | ||
|
||
collectProperties("", $defaultConfig, $constants); | ||
ksort($constants, SORT_STRING); | ||
|
||
$file = fopen(dirname(__DIR__) . '/src/YmlServerProperties.php', 'wb'); | ||
if($file === false){ | ||
fwrite(STDERR, "Failed to open output file\n"); | ||
exit(1); | ||
} | ||
fwrite($file, "<?php\n"); | ||
fwrite($file, <<<'HEADER' | ||
/* | ||
* | ||
* ____ _ _ __ __ _ __ __ ____ | ||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ | ||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | | ||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ | ||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| | ||
* | ||
* 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/ | ||
* | ||
* | ||
*/ | ||
|
||
|
||
HEADER | ||
); | ||
fwrite($file, "declare(strict_types=1);\n\n"); | ||
fwrite($file, "namespace pocketmine;\n\n"); | ||
|
||
fwrite($file, <<<'DOC' | ||
/** | ||
* @internal | ||
* Constants for all properties available in pocketmine.yml. | ||
* This is generated by build/generate-pocketmine-yml-property-consts.php. | ||
* Do not edit this file manually. | ||
*/ | ||
|
||
DOC | ||
); | ||
fwrite($file, "final class YmlServerProperties{\n"); | ||
fwrite($file, <<<'CONSTRUCTOR' | ||
private function __construct(){ | ||
//NOOP | ||
} | ||
|
||
|
||
CONSTRUCTOR | ||
); | ||
foreach(Utils::stringifyKeys($constants) as $constName => $propertyName){ | ||
fwrite($file, "\tpublic const $constName = '$propertyName';\n"); | ||
} | ||
fwrite($file, "}\n"); | ||
|
||
fclose($file); | ||
|
||
echo "Done. Don't forget to run CS fixup after generating code.\n"; |
Oops, something went wrong.