Merge commit '62ea7c93a9ba1e71bef868efefdd9cc6dcc84a08'

# Conflicts:
#	resources/vanilla
#	src/entity/Skin.php
#	src/item/InvalidSkinException.php
This commit is contained in:
Dylan K. Taylor 2020-06-17 20:34:19 +01:00
commit 14d3e5ce27
2 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,28 @@
<?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\entity;
final class InvalidSkinException extends \InvalidArgumentException{
}

View File

@ -50,20 +50,20 @@ final class Skin{
public function __construct(string $skinId, string $skinData, string $capeData = "", string $geometryName = "", string $geometryData = ""){
if($skinId === ""){
throw new \InvalidArgumentException("Skin ID must not be empty");
throw new InvalidSkinException("Skin ID must not be empty");
}
$len = strlen($skinData);
if(!in_array($len, self::ACCEPTED_SKIN_SIZES, true)){
throw new \InvalidArgumentException("Invalid skin data size $len bytes (allowed sizes: " . implode(", ", self::ACCEPTED_SKIN_SIZES) . ")");
throw new InvalidSkinException("Invalid skin data size $len bytes (allowed sizes: " . implode(", ", self::ACCEPTED_SKIN_SIZES) . ")");
}
if($capeData !== "" and strlen($capeData) !== 8192){
throw new \InvalidArgumentException("Invalid cape data size " . strlen($capeData) . " bytes (must be exactly 8192 bytes)");
throw new InvalidSkinException("Invalid cape data size " . strlen($capeData) . " bytes (must be exactly 8192 bytes)");
}
if($geometryData !== ""){
$decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData);
if($decodedGeometry === false){
throw new \InvalidArgumentException("Invalid geometry data (" . json_last_error_msg() . ")");
throw new InvalidSkinException("Invalid geometry data (" . json_last_error_msg() . ")");
}
/*