Customies icon indicating copy to clipboard operation
Customies copied to clipboard

Null ☠️

Open GabBiswajit opened this issue 1 year ago • 4 comments

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! 🥲

GabBiswajit avatar Feb 23 '24 14:02 GabBiswajit

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 ?

GabBiswajit avatar Feb 23 '24 14:02 GabBiswajit

HI, you can use StringToItemParser::getInstance()->registerAlias()

ShadowMikado avatar Mar 09 '24 22:03 ShadowMikado

@ShadowMikado it's work like this : ?

$name = $item->getVanillaName();
StringToItemParser::getInstance()->registerAlias($name);

GabBiswajit avatar Apr 16 '24 08:04 GabBiswajit

public function registerAlias(string $existing, string $alias) : void{

https://github.com/pmmp/PocketMine-MP/blob/50e2c469a547a16a23b2dc691e70a51d34e29395/src/utils/StringToTParser.php#L64

ShadowMikado avatar Apr 16 '24 09:04 ShadowMikado