Skip to content

Commit a75eeea

Browse files
authored
Merge branch 'pmmp:stable' into feature/weather-system
2 parents 1e22dbf + e9a3bc6 commit a75eeea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+639
-265
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<!-- Summarize your PR here. Keep it short and simple. -->
22
<!-- Explain existing problems or why this pull request is necessary -->
33

4+
<!-- DO NOT submit AI generated code or use AI to generate PR descriptions. -->
5+
<!-- These are a waste of our team's time and your PR will be closed immediately. -->
6+
47
### Related issues & PRs
58
<!--
69
* Fixes #1

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php: ["8.1", "8.2", "8.3", "8.4"]
14+
php: ["8.1", "8.2", "8.3", "8.4", "8.5"]
1515

1616
uses: ./.github/workflows/main-php-matrix.yml
1717
with:

.github/workflows/verify-translations.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ function verify_translations(array $baseLanguageDef, string $altLanguageName, ar
8787
return $ok;
8888
}
8989

90+
function language_file_path(string $path, string $code) : string{
91+
return $path . "/" . "$code.ini";
92+
}
93+
9094
/**
9195
* @return string[]|null
9296
* @phpstan-return array<string, string>|null
9397
*/
94-
function parse_language_file(string $path, string $code) : ?array{
95-
$lang = parse_ini_file($path . "/" . "$code.ini", false, INI_SCANNER_RAW);
96-
if($lang === false){
98+
function parse_language_file(string $contents) : ?array{
99+
$lang = parse_ini_string($contents, false, INI_SCANNER_RAW);
100+
if($lang === false || count($lang) === 0){
97101
return null;
98102
}
99103
return $lang;
@@ -151,7 +155,12 @@ function verify_keys(array $pocketmine, array $mojang, array $knownBadKeys) : ar
151155
fwrite(STDERR, "Required arguments: path\n");
152156
exit(1);
153157
}
154-
$eng = parse_language_file($argv[1], "eng");
158+
$rawEng = file_get_contents(language_file_path($argv[1], "eng"));
159+
if($rawEng === false){
160+
fwrite(STDERR, "Failed to read eng.ini\n");
161+
exit(1);
162+
}
163+
$eng = parse_language_file($rawEng);
155164
if($eng === null){
156165
fwrite(STDERR, "Failed to parse eng.ini\n");
157166
exit(1);
@@ -196,10 +205,19 @@ function verify_keys(array $pocketmine, array $mojang, array $knownBadKeys) : ar
196205
*/
197206
foreach(new \RegexIterator(new \FilesystemIterator($argv[1], \FilesystemIterator::CURRENT_AS_PATHNAME), "/([a-z]+)\.ini$/", \RegexIterator::GET_MATCH) as $match){
198207
$code = $match[1];
199-
if($code === "eng"){
208+
$path = language_file_path($argv[1], $code);
209+
$raw = file_get_contents($path);
210+
if($raw === false){
211+
fwrite(STDERR, "Unable to read contents of $path\n");
212+
$exit = 1;
200213
continue;
201214
}
202-
$otherLang = parse_language_file($argv[1], $code);
215+
if(str_starts_with($raw, "\xef\xbb\xbf")){
216+
fwrite(STDERR, "Unexpected byte-order mark at the start of $code.ini\n");
217+
$exit = 1;
218+
//we can still try to parse the file - this is more of a cosmetic check than a functional one
219+
}
220+
$otherLang = parse_language_file($raw);
203221
if($otherLang === null){
204222
fwrite(STDERR, "Error parsing $code.ini\n");
205223
$exit = 1;

build/dump-version-info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
return true;
7272
}
7373
];
74-
if(count($argv) !== 2 || !isset($options[$argv[1]])){
74+
if(!isset($argv) || count($argv) !== 2 || !isset($options[$argv[1]])){
7575
fwrite(STDERR, "Please provide an option (one of: " . implode(", ", array_keys($options)) . PHP_EOL);
7676
exit(1);
7777
}

build/generate-block-serializer-consts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function generateBlockStringValues(BlockPaletteReport $data) : void{
195195
fclose($output);
196196
}
197197

198-
if(count($argv) !== 2){
198+
if(!isset($argv) || count($argv) !== 2){
199199
fwrite(STDERR, "This script regenerates BlockTypeNames, BlockStateNames and BlockStateStringValues from a given palette file\n");
200200
fwrite(STDERR, "Required arguments: path to block palette file\n");
201201
exit(1);

build/generate-build-info-json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
require dirname(__DIR__) . '/vendor/autoload.php';
2828

29-
if(count($argv) !== 7){
29+
if(!isset($argv) || count($argv) !== 7){
3030
fwrite(STDERR, "required args: <git hash> <tag name> <github repo (owner/name)> <build number> <github actions run ID> <PHP binary download URL>\n");
3131
exit(1);
3232
}

build/generate-item-type-names.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ final class ItemTypeNames{
9999
fclose($file);
100100
}
101101

102-
if(count($argv) !== 2){
102+
if(!isset($argv) || count($argv) !== 2){
103103
fwrite(STDERR, "This script regenerates ItemTypeNames from a given item dictionary file\n");
104104
fwrite(STDERR, "Required argument: path to item type dictionary file\n");
105105
exit(1);

build/generate-registry-annotations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
use const SORT_STRING;
4646
use const STDERR;
4747

48-
if(count($argv) !== 2){
48+
if(!isset($argv) || count($argv) !== 2){
4949
fwrite(STDERR, "Provide a path to process\n");
5050
exit(1);
5151
}

build/php

Submodule php updated from b0784f7 to 3296ff3

build/remove-dead-translations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function parse_language_file(string $path, string $file) : ?array{
6060
return $lang;
6161
}
6262

63-
if(count($argv) !== 2){
63+
if(!isset($argv) || count($argv) !== 2){
6464
fwrite(STDERR, "Usage: php remove-dead-translations.php <translations folder>\n");
6565
exit(1);
6666
}

0 commit comments

Comments
 (0)