mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +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)));
|
||||
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])){
|
||||
|
Loading…
x
Reference in New Issue
Block a user