mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 08:35:20 +00:00
Use Filesystem::fileGetContents() in more places
This commit is contained in:
@ -28,15 +28,14 @@ use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchema;
|
||||
use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchemaBlockRemap;
|
||||
use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchemaUtils;
|
||||
use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchemaValueRemap;
|
||||
use pocketmine\errorhandler\ErrorToExceptionHandler;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Filesystem;
|
||||
use pocketmine\utils\Utils;
|
||||
use function array_key_first;
|
||||
use function count;
|
||||
use function dirname;
|
||||
use function file_get_contents;
|
||||
use function file_put_contents;
|
||||
use function fwrite;
|
||||
use function json_encode;
|
||||
@ -59,11 +58,7 @@ class BlockStateMapping{
|
||||
* @phpstan-return array<string, list<BlockStateMapping>>
|
||||
*/
|
||||
function loadUpgradeTable(string $file, bool $reverse) : array{
|
||||
try{
|
||||
$contents = ErrorToExceptionHandler::trapAndRemoveFalse(fn() => file_get_contents($file));
|
||||
}catch(\ErrorException $e){
|
||||
throw new \RuntimeException("Failed loading mapping table file $file: " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
$contents = Filesystem::fileGetContents($file);
|
||||
$data = (new NetworkNbtSerializer())->readMultiple($contents);
|
||||
|
||||
$result = [];
|
||||
|
Reference in New Issue
Block a user