Null ☠️
While attempting to register an emerald chestplate item using the CustomiesItemFactory class, the following code snippet is used:
register = CustomiesItemFactory::getInstance()->registerItem(Emerald_Chestplate::class, "armorsapi:emerald_chestplate", "emerald_chestplate");
Subsequently, an attempt is made to parse the string "emerald_chestplate" into an item using the StringToItemParser class. However, this operation is returning null.
Please address this issue. Thank you! 🥲
I use $item->getVanillaName() and i get emerald_chestplate so vanilla name use in StringToItemParser that's why i set emerald_chestplate if I need to use armorsapi:emerald_chestplate than can you tell how i get it ?
HI, you can use StringToItemParser::getInstance()->registerAlias()
@ShadowMikado it's work like this : ?
$name = $item->getVanillaName();
StringToItemParser::getInstance()->registerAlias($name);
public function registerAlias(string $existing, string $alias) : void{
https://github.com/pmmp/PocketMine-MP/blob/50e2c469a547a16a23b2dc691e70a51d34e29395/src/utils/StringToTParser.php#L64