Hi im trying to make a villager trade on pmmp. how can i achieve this? Previous Attempts Using https://github.com/many1337/VillagerTradeAPI The trade got closed after i clicked the Paper PHP: //VillagerTradeAPI$tags = new CompoundTag("Offers", [ new ListTag("Recipes", [ new CompoundTag("", [ new ByteTag("rewardExp", 1), new IntTag("maxUses", mt_rand(2, 12)), new IntTag("uses", 0), Item::get(Item::PACKED_ICE, 0, 2)->nbtSerialize(-1, "buyA"), Item::get(Item::PAPER)->nbtSerialize(-1, "sell")]) Using https://github.com/korado531m7/InventoryMenuAPI I got a bug whenever i make a trade i got more item than it should be. example I trade 2 Diamond for 1 Gold I got 2 Gold and the 2 Diamond back[/PHP]
I already did a TradeAPI and realized that there is a bug in the transaction for the menu, you must cancel the Trade transaction via DataPacketReceiveEvent
I did not use TradeAPI pm4 I made a based on TradeUpdatePacket () with the code mirrored in one of the github, it is in the topics but I did not post the transaction part and my pc does not want to connect
I got bug by using that. Ex: when i set recipe diamond => book . And open the trade window and i can put all thing on the ingredients slot and still got the result
I didn't find these bugs when I tested the trade and my code was simple but as I said above, it canceled the DataPacket received from the transaction PHP: $t = new Trade("Teste");$t->addRecipe(Item::get(1), null, Item::get(2));$t->send($player);