mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 02:46:37 +00:00
GiveCommand: don't crash on bogus item NBT
This commit is contained in:
parent
dbeaf27cb7
commit
fef8297907
@ -32,6 +32,7 @@ use pocketmine\item\StringToItemParser;
|
|||||||
use pocketmine\lang\KnownTranslationFactory;
|
use pocketmine\lang\KnownTranslationFactory;
|
||||||
use pocketmine\nbt\JsonNbtParser;
|
use pocketmine\nbt\JsonNbtParser;
|
||||||
use pocketmine\nbt\NbtDataException;
|
use pocketmine\nbt\NbtDataException;
|
||||||
|
use pocketmine\nbt\NbtException;
|
||||||
use pocketmine\permission\DefaultPermissionNames;
|
use pocketmine\permission\DefaultPermissionNames;
|
||||||
use pocketmine\utils\TextFormat;
|
use pocketmine\utils\TextFormat;
|
||||||
use function array_slice;
|
use function array_slice;
|
||||||
@ -86,7 +87,12 @@ class GiveCommand extends VanillaCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->setNamedTag($tags);
|
try{
|
||||||
|
$item->setNamedTag($tags);
|
||||||
|
}catch(NbtException $e){
|
||||||
|
$sender->sendMessage(KnownTranslationFactory::commands_give_tagError($e->getMessage()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: overflow
|
//TODO: overflow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user