I want to register fortune enchantment, but there is an error The error : PHP: 2022-03-07 [05:22:50.484] [Server thread/CRITICAL]: ArgumentCountError: "Expected exactly 0 arguments, 2 passed" (EXCEPTION) in "pmsrc/src/utils/RegistryTrait" at line 91--- Stack trace --- #0 plugins/LytraEnchantShop/src/LES/MainPlugin(67): pocketmine\item\enchantment\VanillaEnchantments::__callStatic(string[8] register, array[2]) #1 plugins/LytraEnchantShop/src/LES/MainPlugin(44): LES\MainPlugin->registerTypes() #2 pmsrc/src/plugin/PluginBase(95): LES\MainPlugin->onLoad() #3 pmsrc/src/plugin/PluginManager(214): pocketmine\plugin\PluginBase->__construct(object DevTools\FolderPluginLoader#24899, object pocketmine\Server#10, object pocketmine\plugin\PluginDescription#25014, string[100] /storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugin_d, string[96] /storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugins/, object pocketmine\plugin\DiskResourceProvider#24997) #4 pmsrc/src/plugin/PluginManager(356): pocketmine\plugin\PluginManager->internalLoadPlugin(string[96] /storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugins/, object DevTools\FolderPluginLoader#24899, object pocketmine\plugin\PluginDescription#25014) #5 pmsrc/src/Server(1005): pocketmine\plugin\PluginManager->loadPlugins(string[80] /storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugins/) #6 pmsrc/src/PocketMine(304): pocketmine\Server->__construct(object BaseClassLoader#2, object pocketmine\utils\MainLogger#3, string[72] /storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/, string[80] /storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/plugins/) #7 pmsrc/src/PocketMine(327): pocketmine\server() #8 pmsrc(11): require(string[116] phar:///storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/P)--- End of exception information ---2022-03-07 [05:22:50.484] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump2022-03-07 [05:22:50.489] [Server thread/EMERGENCY]: Please upload the "/storage/emulated/0/Android/data/io.scer.pocketmine/files/PocketMine-MP/crashdumps/Mon_Mar_7-05.22.50-UTC_2022.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.2022-03-07 [05:22:55.501] [Server thread/EMERGENCY]: Failed to communicate with crash archive: Could not resolve host: crash.pmmp.io2022-03-07 [05:22:55.501] [Server thread/EMERGENCY]: Forcing server shutdown The code : PHP: public function onLoad() : void{ $this->registerTypes(); } public function registerTypes() : void{ VanillaEnchantments::register("FORTUNE", new Enchantment(KnownTranslationFactory::enchantment_lootBonusDigger(), Rarity::UNCOMMON, ItemFlags::DIG, ItemFlags::SHEARS, 3)); }
thank you, btw the code that I shown above, I'm just following how the pocketmine/item/enchantment/vanilla enchantments do
I tried and it seems like the enchantment didn't registered, and when I /enchant, the enchantment didn't registered I think there is something wrong in the code PHP: public function onLoad() : void{ EnchantmentIdMap::getInstance()->register(100, new Enchantment('FORTUNE', Rarity::UNCOMMON, ItemFlags::ALL, ItemFlags::NONE, 3)); } The error : PHP: 2022-03-09 [14:18:07.624] [Server thread/CRITICAL]: Error: "No such registry member: pocketmine\item\enchantment\VanillaEnchantments::FORTUNE" (EXCEPTION) in "pmsrc/src/utils/RegistryTrait" at line 96
I've call the event, this is the event that I call PHP: use pocketmine\plugin\PluginBase;use pocketmine\player\Player;use pocketmine\Server;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\item\Item;use pocketmine\item\Tool;use pocketmine\item\Sword;use pocketmine\item\Armor;use pocketmine\item\Bow;use pocketmine\item\Durable;use pocketmine\item\enchantment\Enchantment;use pocketmine\item\enchantment\EnchantmentInstance;use pocketmine\item\enchantment\VanillaEnchantments;use pocketmine\item\enchantment\Rarity;use pocketmine\item\enchantment\ItemFlags;use pocketmine\data\bedrock\EnchantmentIdMap;use pocketmine\lang\KnownTranslationFactory;use pocketmine\network\mcpe\protocol\PlaySoundPacket;use onebone\economyapi\EconomyAPI;use jojoe77777\FormAPI\SimpleForm;use jojoe77777\FormAPI\CustomForm; When I enchant my item with sharpness, efficiency, etc that are already registered in pocketmine, It work