Hello i have some problems with my customs trades.... please help me if you can ! EDIT: (the problem is that the inventory won't open) Here is the code: Code: @EventHandler public void onInteractPlayer(PlayerInteractEntityEvent ev) { Player p = ev.getPlayer(); Entity ent = ev.getRightClicked(); if (ent instanceof Villager) { if (ent.getCustomName().equalsIgnoreCase("§aTest")){ ev.setCancelled(true); Inventory i = Bukkit.createInventory(null, InventoryType.MERCHANT, "Test"); i.clear(); i.addItem(new ItemStack(Material.DIAMOND, 10), new ItemStack(Material.EMERALD, 1)); p.openInventory(i); } } } thank you !
i tried to put a p.sendMessage"§agood" after the lines of inventory and the message was sent so i don't understand, i also tried to put the inventory lines in a try / catch and no error, but nothing happen
first thank's for trying to help me and i only use the main class so i have 800+ lines.. And i really think it's just a bug, cause if i try to open a chest inventory, it works ! but not InventoryType.MERCHANT........ strange
@Xhork https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/MerchantInventory.html Cast to that, get the merchant, set the recipes.