ItemFactory::fromString(): throw an exception on failure to parse meta value

This commit is contained in:
Dylan K. Taylor 2018-02-16 09:45:14 +00:00
parent 7dd834bca0
commit 3b632c2870

View File

@ -347,8 +347,10 @@ class ItemFactory{
$b = explode(":", str_replace([" ", "minecraft:"], ["_", ""], trim($str)));
if(!isset($b[1])){
$meta = 0;
}else{
}elseif(is_numeric($b[1])){
$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])){