Hello, i'm interested in knowing how to make it so i can edit an item that will spawn once they right click a Piston via config. this is what i have as a rough idea.. as you'll see is, i have the "items" which they will be able to list as many items as they can with an amount that they put in the config.
Code:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (!(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_AIR)) return;
if (!(e.getItem().getType() == Material.PISTON_BASE)) return;
Inventory inv = p.getInventory();
p.sendMessage(prefix + ChatColor.GOLD + "You have recieved your rewards");
Material material = Material.getMaterial(getConfig().getString("items"));
inv.addItem(new ItemStack(Material..getConfig().getString("items")));
inv.removeItem(new ItemStack(Material.PISTON_BASE, 1));
}
}
