mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
ItemFactory::fromString(): throw an exception on failure to parse meta value
This commit is contained in:
parent
7dd834bca0
commit
3b632c2870
@ -347,8 +347,10 @@ class ItemFactory{
|
|||||||
$b = explode(":", str_replace([" ", "minecraft:"], ["_", ""], trim($str)));
|
$b = explode(":", str_replace([" ", "minecraft:"], ["_", ""], trim($str)));
|
||||||
if(!isset($b[1])){
|
if(!isset($b[1])){
|
||||||
$meta = 0;
|
$meta = 0;
|
||||||
}else{
|
}elseif(is_numeric($b[1])){
|
||||||
$meta = $b[1] & 0xFFFF;
|
$meta = $b[1] & 0xFFFF;
|
||||||
|
}else{
|
||||||
|
throw new \InvalidArgumentException("Unable to parse \"" . $b[1] . "\" from \"" . $str . "\" as a valid meta value");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_numeric($b[0])){
|
if(is_numeric($b[0])){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user