	public StockPanelGUI() {
		logger.info("init StockManagment GUI");

		initGUI();

		btnSave.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {

				ThreadManager.getInstance().execute(new Runnable() {

					@Override
					public void run() {
						for(MagicCardStock ms : model.getList())
							if(ms.isUpdate())
								try {
									lblLoading.setVisible(true);
									MTGControler.getInstance().getEnabledDAO().saveOrUpdateStock(ms);
									ms.setUpdate(false);
									lblLoading.setVisible(false);
								} catch (SQLException e1) {
									JOptionPane.showMessageDialog(null, e1.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR") + " : " + String.valueOf(ms),JOptionPane.ERROR_MESSAGE);
									lblLoading.setVisible(false);
								}

						model.fireTableDataChanged();

					}
				}, "Batch stock save");
			}

		});

		table.getSelectionModel().addListSelectionListener(event->{

	        	if(!multiselection && !event.getValueIsAdjusting())
	        	{
	        			int viewRow = table.getSelectedRow();
			        	if(viewRow>-1)
			        	{
			        		int modelRow = table.convertRowIndexToModel(viewRow);
							MagicCardStock selectedStock = (MagicCardStock)table.getModel().getValueAt(modelRow, 0);
							btnDelete.setEnabled(true);
							magicCardDetailPanel.setMagicCard(selectedStock.getMagicCard());
			        	}
	        	}
	    });

		btnDelete.addActionListener(event-> {
				int res = JOptionPane.showConfirmDialog(null,
											MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_DELETE",table.getSelectedRows().length + " item(s)"),
											MTGControler.getInstance().getLangService().getCapitalize("DELETE") +" ?",
											JOptionPane.YES_NO_OPTION);
				if(res==JOptionPane.YES_OPTION)
					{
					ThreadManager.getInstance().execute(()->{
							try {
								int[] selected  = table.getSelectedRows();
								lblLoading.setVisible(true);
								List<MagicCardStock> stocks = extract(selected);
								model.removeRows(stocks);
								updateCount();
							}
							catch(Exception e)
							{
								JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
								lblLoading.setVisible(false);
							}
							lblLoading.setVisible(false);
							updateCount();

					}, "delete stock");

					}
		});

		btnReload.addActionListener(event-> {
				int res = JOptionPane.showConfirmDialog(null, MTGControler.getInstance().getLangService().getCapitalize("CANCEL_CHANGES"),MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_UNDO"),JOptionPane.YES_NO_OPTION);
				if(res==JOptionPane.YES_OPTION)
				{
					logger.debug("reload collection");
					ThreadManager.getInstance().execute(new Runnable() {

						@Override
						public void run() {
							try {
								lblLoading.setVisible(true);
								model.init();
							} catch (SQLException e1) {
								JOptionPane.showMessageDialog(null, e1.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
							}
							lblLoading.setVisible(false);
							updateCount();
						}
					}, "reload stock");

				}

		});

		btnshowMassPanel.addActionListener(event->rightPanel.setVisible(!rightPanel.isVisible()));

		btnImport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {
				JPopupMenu menu = new JPopupMenu();

				JMenuItem mnuImportSearch = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_FROM",MTGControler.getInstance().getLangService().get("SEARCH_MODULE")));
				mnuImportSearch.setIcon(MTGConstants.ICON_SEARCH);

				mnuImportSearch.addActionListener(new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent ae) {
						CardSearchImportDialog cdSearch = new CardSearchImportDialog();
						cdSearch.setVisible(true);
						if(cdSearch.getSelection()!=null)
						{
							for(MagicCard mc : cdSearch.getSelection())
								addCard(mc);
						}
					}
				});
				menu.add(mnuImportSearch);

				JMenuItem mnuCol = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_FROM",MTGControler.getInstance().getLangService().get("COLLECTION_MODULE")));
				mnuCol.setIcon(MTGConstants.ICON_COLLECTION);
				mnuCol.addActionListener(collEvent->{
						CollectionChooserDialog diag = new CollectionChooserDialog();
						diag.setVisible(true);
						final MagicCollection col = diag.getSelectedCollection();

						if(col!=null)
						{	ThreadManager.getInstance().execute(()->{
									lblLoading.setVisible(true);
									try {
										importFromCollection(col);
									} catch (SQLException e) {
										JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);

									}
									lblLoading.setVisible(false);
									updateCount();
							}, "Import stock from collection");
						}

				});
				menu.add(mnuCol);

				JMenuItem webSite = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_FROM",MTGControler.getInstance().getLangService().get("WEBSITE")));
				webSite.setIcon(MTGConstants.ICON_WEBSITE);
				webSite.addActionListener(siteEvent-> {
						DeckSnifferDialog diag = new DeckSnifferDialog();
						diag.setModal(true);
						diag.setVisible(true);

						if (diag.getSelectedDeck() != null) {
							lblLoading.setVisible(true);
							MagicDeck deck = diag.getSelectedDeck();
							importFromWebSite(deck);
							updateCount();
							lblLoading.setVisible(false);
						}
				});
				menu.add(webSite);

				for (final CardExporter exp : MTGControler.getInstance().getEnabledDeckExports()) {
					JMenuItem it = new JMenuItem();
					it.setIcon(exp.getIcon());
					it.setText(exp.getName());
					it.addActionListener(itemEvent-> {
							JFileChooser jf = new JFileChooser(".");
							jf.setFileFilter(new FileFilter() {

								@Override
								public String getDescription() {
									return exp.getName();
								}

								@Override
								public boolean accept(File f) {
									if (f.isDirectory())
										return true;

									if (f.getName().endsWith(exp.getFileExtension()))
										return true;

									return false;
								}
							});
							int res = jf.showOpenDialog(null);
							final File f = jf.getSelectedFile();

							if (res == JFileChooser.APPROVE_OPTION)
								ThreadManager.getInstance().execute(()->{
										try {
											lblLoading.setVisible(true);
											List<MagicCardStock> list = exp.importStock(f);
											for(MagicCardStock mc : list)
											{
												addStock(mc);
											}
											model.fireTableDataChanged();
											updateCount();
											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().combine("IMPORT","FINISHED"),exp.getName() + " "+MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);

										} catch (Exception e) {
											logger.error(e);
											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
										}

								}, "import " + exp);
					});

					menu.add(it);
				}

				Component b = (Component) ae.getSource();
				Point p = b.getLocationOnScreen();
				menu.show(b, 0, 0);
				menu.setLocation(p.x, p.y + b.getHeight());
			}
		});

		btnExport.addActionListener(event->{
				JPopupMenu menu = new JPopupMenu();

				for (final CardExporter exp : MTGControler.getInstance().getEnabledDeckExports()) {
					JMenuItem it = new JMenuItem();
					it.setIcon(exp.getIcon());
					it.setText(exp.getName());
					it.addActionListener(itEvent-> {
							JFileChooser jf = new JFileChooser(".");
							jf.setFileFilter(new FileFilter() {

								@Override
								public String getDescription() {
									return exp.getName();
								}

								@Override
								public boolean accept(File f) {
									if (f.isDirectory())
										return true;

									if (f.getName().endsWith(exp.getFileExtension()))
										return true;

									return false;
								}
							});
							int res = jf.showSaveDialog(null);
							final File f = jf.getSelectedFile();

							if (res == JFileChooser.APPROVE_OPTION)
								ThreadManager.getInstance().execute(()->{
										try {
											lblLoading.setVisible(true);

											exp.exportStock(model.getList(), f);

											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null,  MTGControler.getInstance().getLangService().combine("EXPORT","FINISHED"), exp.getName() + " " +MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);

										} catch (Exception e) {
											logger.error(e);
											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
										}
								}, "export " + exp);

					});

					menu.add(it);
				}

				Component b = (Component) event.getSource();
				Point p = b.getLocationOnScreen();
				menu.show(b, 0, 0);
				menu.setLocation(p.x, p.y + b.getHeight());

		});

		btnGeneratePrice.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ThreadManager.getInstance().execute(()-> {
						lblLoading.setVisible(true);
						for(int i : table.getSelectedRows())
						{
							MagicCardStock s = (MagicCardStock)table.getModel().getValueAt(table.convertRowIndexToModel(i), 0);
							Collection<Double> prices;
							Double price=0.0;
							try {
								prices = MTGControler.getInstance().getEnabledDashBoard().getPriceVariation(s.getMagicCard(),null).values();
								if(!prices.isEmpty())
									price = (Double)prices.toArray()[prices.size()-1];
								else
									price=0.0;
							} catch (IOException e) {
								price=0.0;
							}
							double old = s.getPrice();
							s.setPrice(price);
							if(old!=s.getPrice())
								s.setUpdate(true);

							model.fireTableDataChanged();
						}
						lblLoading.setVisible(false);

				}, "generate prices for stock");

			}
		});

		cboSelections.addItemListener(ie-> {
				multiselection=true;
				if(String.valueOf(cboSelections.getSelectedItem()).equals(selections[1]))
				{
					table.clearSelection();

					for(int i=0;i<table.getRowCount();i++)
					{

						if(table.getValueAt(i, 0).toString().equals("-1"))
						{
							table.addRowSelectionInterval(i,i);
						}
					}

				}
				else if(String.valueOf(cboSelections.getSelectedItem()).equals(selections[2]))
				{
					table.clearSelection();

					for(int i=0;i<table.getRowCount();i++)
					{
						if(((MagicCardStock)table.getValueAt(i, 0)).isUpdate())
							table.addRowSelectionInterval(i,i);
					}
				}
				multiselection=false;
		});

		btnApplyModification.addActionListener(event-> {
				int res = JOptionPane.showConfirmDialog(null,  MTGControler.getInstance().getLangService().getCapitalize("CHANGE_X_ITEMS",table.getSelectedRowCount()),  MTGControler.getInstance().getLangService().getCapitalize("CONFIRMATION"), JOptionPane.YES_NO_CANCEL_OPTION);
				if(res==JOptionPane.YES_OPTION)
				{
					for(int i : table.getSelectedRows())
					{
						MagicCardStock s = (MagicCardStock)table.getModel().getValueAt(table.convertRowIndexToModel(i), 0);
						s.setUpdate(true);
						if(((Integer)spinner.getValue()).intValue()>0)
							s.setQte((Integer)spinner.getValue());
						if(!textPane.getText().equals(""))
							s.setComment(textPane.getText());
						if(cboAltered.getSelectedItem()!=null)
							s.setAltered((Boolean)cboAltered.getSelectedItem());
						if(cboSigned.getSelectedItem()!=null)
							s.setSigned((Boolean)cboSigned.getSelectedItem());
						if(cboFoil.getSelectedItem()!=null)
							s.setFoil((Boolean)cboFoil.getSelectedItem());
						if(cboLanguages!=null)
							s.setLanguage(String.valueOf(cboLanguages.getSelectedItem()));
						if(cboQuality.getSelectedItem()!=null)
							s.setCondition((EnumCondition)cboQuality.getSelectedItem());
						if(cboCollection.getSelectedItem()!=null)
							s.setMagicCollection((MagicCollection)cboCollection.getSelectedItem());

					}
					model.fireTableDataChanged();
				}
		});

	}

	public StockPanelGUI() {
		logger.info("init StockManagment GUI");

		initGUI();

		btnSave.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {

				ThreadManager.getInstance().execute(new Runnable() {

					@Override
					public void run() {
						for(MagicCardStock ms : model.getList())
							if(ms.isUpdate())
								try {
									lblLoading.setVisible(true);
									MTGControler.getInstance().getEnabledDAO().saveOrUpdateStock(ms);
									ms.setUpdate(false);
									lblLoading.setVisible(false);
								} catch (SQLException e1) {
									JOptionPane.showMessageDialog(null, e1.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR") + " : " + String.valueOf(ms),JOptionPane.ERROR_MESSAGE);
									lblLoading.setVisible(false);
								}

						model.fireTableDataChanged();

					}
				}, "Batch stock save");
			}

		});

		table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
	    	public void valueChanged(ListSelectionEvent event) {

	        	if(!multiselection)
	        	if(!event.getValueIsAdjusting())
	        	{
	        			int viewRow = table.getSelectedRow();
			        	if(viewRow>-1)
			        	{
			        		int modelRow = table.convertRowIndexToModel(viewRow);
							MagicCardStock selectedStock = (MagicCardStock)table.getModel().getValueAt(modelRow, 0);
							btnDelete.setEnabled(true);
							magicCardDetailPanel.setMagicCard(selectedStock.getMagicCard());
			        	}
	        	}
	        }
	    });

		btnDelete.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				int res = JOptionPane.showConfirmDialog(null,
											MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_DELETE",table.getSelectedRows().length + " item(s)"),
											MTGControler.getInstance().getLangService().getCapitalize("DELETE") +" ?",
											JOptionPane.YES_NO_OPTION);
				if(res==JOptionPane.YES_OPTION)
					{
					ThreadManager.getInstance().execute(new Runnable() {

						@Override
						public void run() {
							try {
								int selected [] = table.getSelectedRows();
								lblLoading.setVisible(true);
								List<MagicCardStock> stocks = extract(selected);
								model.removeRows(stocks);
								updateCount();
							}
							catch(Exception e)
							{
								JOptionPane.showMessageDialog(null, e.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
								lblLoading.setVisible(false);
							}
							lblLoading.setVisible(false);
							updateCount();
						}
					}, "delete stock");

					}
				}
		});

		btnReload.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				int res = JOptionPane.showConfirmDialog(null, MTGControler.getInstance().getLangService().getCapitalize("CANCEL_CHANGES"),MTGControler.getInstance().getLangService().getCapitalize("CONFIRM_UNDO"),JOptionPane.YES_NO_OPTION);
				if(res==JOptionPane.YES_OPTION)
				{
					logger.debug("reload collection");
					ThreadManager.getInstance().execute(new Runnable() {

						@Override
						public void run() {
							try {
								lblLoading.setVisible(true);
								model.init();
							} catch (SQLException e1) {
								JOptionPane.showMessageDialog(null, e1.getMessage(),MTGControler.getInstance().getLangService().getCapitalize("ERROR"),JOptionPane.ERROR_MESSAGE);
							}
							lblLoading.setVisible(false);
							updateCount();
						}
					}, "reload stock");

				}
			}
		});

		btnshowMassPanel.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				rightPanel.setVisible(!rightPanel.isVisible());
			}
		});

		btnImport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {
				JPopupMenu menu = new JPopupMenu();

				JMenuItem mnuImportSearch = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_FROM",MTGControler.getInstance().getLangService().get("SEARCH_MODULE")));
				mnuImportSearch.setIcon(MTGConstants.ICON_SEARCH);

				mnuImportSearch.addActionListener(new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent ae) {
						CardSearchImportDialog cdSearch = new CardSearchImportDialog();
						cdSearch.setVisible(true);
						if(cdSearch.getSelection()!=null)
						{
							for(MagicCard mc : cdSearch.getSelection())
								addCard(mc);
						}
					}
				});
				menu.add(mnuImportSearch);

				JMenuItem mnuCol = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_FROM",MTGControler.getInstance().getLangService().get("COLLECTION_MODULE")));
				mnuCol.setIcon(MTGConstants.ICON_COLLECTION);
				mnuCol.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						CollectionChooserDialog diag = new CollectionChooserDialog();
						diag.setVisible(true);
						final MagicCollection col = diag.getSelectedCollection();

						if(col!=null)
						{	ThreadManager.getInstance().execute(new Runnable() {

								@Override
								public void run() {
									lblLoading.setVisible(true);
									try {
										importFromCollection(col);
									} catch (SQLException e) {
										JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);

									}
									lblLoading.setVisible(false);
									updateCount();
								}
							}, "Import stock from collection");
						}

					}
				});
				menu.add(mnuCol);

				JMenuItem webSite = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("IMPORT_FROM",MTGControler.getInstance().getLangService().get("WEBSITE")));
				webSite.setIcon(MTGConstants.ICON_WEBSITE);
				webSite.addActionListener(new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent arg0) {
						DeckSnifferDialog diag = new DeckSnifferDialog();
						diag.setModal(true);
						diag.setVisible(true);

						if (diag.getSelectedDeck() != null) {
							lblLoading.setVisible(true);
							MagicDeck deck = diag.getSelectedDeck();
							importFromWebSite(deck);
							updateCount();
							lblLoading.setVisible(false);
						}
					}
				});
				menu.add(webSite);

				for (final CardExporter exp : MTGControler.getInstance().getEnabledDeckExports()) {
					JMenuItem it = new JMenuItem();
					it.setIcon(exp.getIcon());
					it.setText(exp.getName());
					it.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent arg0) {
							JFileChooser jf = new JFileChooser(".");
							jf.setFileFilter(new FileFilter() {

								@Override
								public String getDescription() {
									return exp.getName();
								}

								@Override
								public boolean accept(File f) {
									if (f.isDirectory())
										return true;

									if (f.getName().endsWith(exp.getFileExtension()))
										return true;

									return false;
								}
							});
							int res = jf.showOpenDialog(null);
							final File f = jf.getSelectedFile();

							if (res == JFileChooser.APPROVE_OPTION)
								ThreadManager.getInstance().execute(new Runnable() {

									@Override
									public void run() {
										try {
											lblLoading.setVisible(true);
											List<MagicCardStock> list = exp.importStock(f);
											for(MagicCardStock mc : list)
											{
												addStock(mc);
											}
											model.fireTableDataChanged();
											updateCount();
											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null, MTGControler.getInstance().getLangService().combine("IMPORT","FINISHED"),exp.getName() + " "+MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);

										} catch (Exception e) {
											logger.error(e);
											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
										}

									}
								}, "import " + exp);
						}
					});

					menu.add(it);
				}

				Component b = (Component) ae.getSource();
				Point p = b.getLocationOnScreen();
				menu.show(b, 0, 0);
				menu.setLocation(p.x, p.y + b.getHeight());
			}
		});

		btnExport.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {
				JPopupMenu menu = new JPopupMenu();

				for (final CardExporter exp : MTGControler.getInstance().getEnabledDeckExports()) {
					JMenuItem it = new JMenuItem();
					it.setIcon(exp.getIcon());
					it.setText(exp.getName());
					it.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent arg0) {
							JFileChooser jf = new JFileChooser(".");
							jf.setFileFilter(new FileFilter() {

								@Override
								public String getDescription() {
									return exp.getName();
								}

								@Override
								public boolean accept(File f) {
									if (f.isDirectory())
										return true;

									if (f.getName().endsWith(exp.getFileExtension()))
										return true;

									return false;
								}
							});
							int res = jf.showSaveDialog(null);
							final File f = jf.getSelectedFile();

							if (res == JFileChooser.APPROVE_OPTION)
								ThreadManager.getInstance().execute(new Runnable() {

									@Override
									public void run() {
										try {
											lblLoading.setVisible(true);

											exp.exportStock(model.getList(), f);

											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null,  MTGControler.getInstance().getLangService().combine("EXPORT","FINISHED"), exp.getName() + " " +MTGControler.getInstance().getLangService().getCapitalize("FINISHED"), JOptionPane.INFORMATION_MESSAGE);

										} catch (Exception e) {
											logger.error(e);
											lblLoading.setVisible(false);
											JOptionPane.showMessageDialog(null, e, MTGControler.getInstance().getLangService().getCapitalize("ERROR"), JOptionPane.ERROR_MESSAGE);
										}

									}
								}, "export " + exp);
						}
					});

					menu.add(it);
				}

				Component b = (Component) ae.getSource();
				Point p = b.getLocationOnScreen();
				menu.show(b, 0, 0);
				menu.setLocation(p.x, p.y + b.getHeight());
			}
		});

		btnGeneratePrice.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ThreadManager.getInstance().execute(new Runnable() {
					@Override
					public void run() {
						lblLoading.setVisible(true);
						for(int i : table.getSelectedRows())
						{
							MagicCardStock s = (MagicCardStock)table.getModel().getValueAt(table.convertRowIndexToModel(i), 0);
							Collection<Double> prices;
							Double price=0.0;
							try {
								prices = MTGControler.getInstance().getEnabledDashBoard().getPriceVariation(s.getMagicCard(),null).values();
								if(prices.size()>0)
									price = (Double)prices.toArray()[prices.size()-1];
								else
									price=0.0;
							} catch (IOException e) {
								price=0.0;
							}
							double old = s.getPrice();
							s.setPrice(price);
							if(old!=s.getPrice())
								s.setUpdate(true);

							model.fireTableDataChanged();
						}
						lblLoading.setVisible(false);
					}
				}, "generate prices for stock");

			}
		});

		cboSelections.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent ie) {
				multiselection=true;
				if(String.valueOf(cboSelections.getSelectedItem()).equals(selections[1]))
				{
					table.clearSelection();

					for(int i=0;i<table.getRowCount();i++)
					{

						if(table.getValueAt(i, 0).toString().equals("-1"))
						{
							table.addRowSelectionInterval(i,i);
						}
					}

				}
				else if(String.valueOf(cboSelections.getSelectedItem()).equals(selections[2]))
				{
					table.clearSelection();

					for(int i=0;i<table.getRowCount();i++)
					{
						if(((MagicCardStock)table.getValueAt(i, 0)).isUpdate())
							table.addRowSelectionInterval(i,i);
					}
				}
				multiselection=false;//do not load magiccarddetailpanel on each selection
			}
		});

		btnApplyModification.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				int res = JOptionPane.showConfirmDialog(null,  MTGControler.getInstance().getLangService().getCapitalize("CHANGE_X_ITEMS",table.getSelectedRowCount()),  MTGControler.getInstance().getLangService().getCapitalize("CONFIRMATION"), JOptionPane.YES_NO_CANCEL_OPTION);
				if(res==JOptionPane.YES_OPTION)
				{
					for(int i : table.getSelectedRows())
					{
						MagicCardStock s = (MagicCardStock)table.getModel().getValueAt(table.convertRowIndexToModel(i), 0);
						s.setUpdate(true);
						if(((Integer)spinner.getValue()).intValue()>0);
							s.setQte((Integer)spinner.getValue());
						if(!textPane.getText().equals(""))
							s.setComment(textPane.getText());
						if(cboAltered.getSelectedItem()!=null)
							s.setAltered((Boolean)cboAltered.getSelectedItem());
						if(cboSigned.getSelectedItem()!=null)
							s.setSigned((Boolean)cboSigned.getSelectedItem());
						if(cboFoil.getSelectedItem()!=null)
							s.setFoil((Boolean)cboFoil.getSelectedItem());
						if(cboLanguages!=null)
							s.setLanguage(String.valueOf(cboLanguages.getSelectedItem()));
						if(cboQuality.getSelectedItem()!=null)
							s.setCondition((EnumCondition)cboQuality.getSelectedItem());
						if(cboCollection.getSelectedItem()!=null)
							s.setMagicCollection((MagicCollection)cboCollection.getSelectedItem());

					}
					model.fireTableDataChanged();
				}

			}
		});

	}

Replace Anonymous With Lambda org.magic.gui.StockPanelGUI.StockPanelGUI.addActionListener.new ActionListener with event -> {JPopupMenu menu=new JPopupMenu(); in method public StockPanelGUI() from class org.magic.gui.StockPanelGUI


			public void actionPerformed(ActionEvent arg0) {
				ThreadManager.getInstance().execute(()-> {
						lblLoading.setVisible(true);
						for(int i : table.getSelectedRows())
						{
							MagicCardStock s = (MagicCardStock)table.getModel().getValueAt(table.convertRowIndexToModel(i), 0);
							Collection<Double> prices;
							Double price=0.0;
							try {
								prices = MTGControler.getInstance().getEnabledDashBoard().getPriceVariation(s.getMagicCard(),null).values();
								if(!prices.isEmpty())
									price = (Double)prices.toArray()[prices.size()-1];
								else
									price=0.0;
							} catch (IOException e) {
								price=0.0;
							}
							double old = s.getPrice();
							s.setPrice(price);
							if(old!=s.getPrice())
								s.setUpdate(true);

							model.fireTableDataChanged();
						}
						lblLoading.setVisible(false);

				}, "generate prices for stock");

			}

			public void actionPerformed(ActionEvent arg0) {
				ThreadManager.getInstance().execute(new Runnable() {
					@Override
					public void run() {
						lblLoading.setVisible(true);
						for(int i : table.getSelectedRows())
						{
							MagicCardStock s = (MagicCardStock)table.getModel().getValueAt(table.convertRowIndexToModel(i), 0);
							Collection<Double> prices;
							Double price=0.0;
							try {
								prices = MTGControler.getInstance().getEnabledDashBoard().getPriceVariation(s.getMagicCard(),null).values();
								if(prices.size()>0)
									price = (Double)prices.toArray()[prices.size()-1];
								else
									price=0.0;
							} catch (IOException e) {
								price=0.0;
							}
							double old = s.getPrice();
							s.setPrice(price);
							if(old!=s.getPrice())
								s.setUpdate(true);

							model.fireTableDataChanged();
						}
						lblLoading.setVisible(false);
					}
				}, "generate prices for stock");

			}

Replace Anonymous With Lambda org.magic.gui.StockPanelGUI.StockPanelGUI.addActionListener.new ActionListener.actionPerformed.execute.new Runnable with () -> {lblLoading.setVisible(true); in method public actionPerformed(arg0 ActionEvent) : void from class org.magic.gui.StockPanelGUI.StockPanelGUI.addActionListener.new ActionListener


	private List<MagicCardStock> extract(int[] ids)
	{
		List<MagicCardStock> select = new ArrayList<>();

		for(int l : ids)
		{
			select.add(((MagicCardStock)table.getValueAt(l, 0)));
		}
		return select;

	}

	private List<MagicCardStock> extract(int[] ids)
	{
		List<MagicCardStock> select = new ArrayList<MagicCardStock>();

		for(int l : ids)
		{
			select.add(((MagicCardStock)table.getValueAt(l, 0)));
		}
		return select;

	}

Replace Generic With Diamond ArrayList<MagicCardStock> with ArrayList<> in method private extract(ids int[]) : List<MagicCardStock> from class org.magic.gui.StockPanelGUI


	public MemoryCache() {
		super();
		if(!new File(CONFDIR, getName()+".conf").exists()){

		save();
		}
		cache=new HashMap<>();
	}

	public MemoryCache() {
		super();
		if(!new File(CONFDIR, getName()+".conf").exists()){

		save();
		}
		cache=new HashMap<String,BufferedImage>();
	}

Replace Generic With Diamond HashMap<String,BufferedImage> with HashMap<> in method public MemoryCache() from class org.magic.api.cache.impl.MemoryCache


	@Override
	public void removeCard(MagicCard mc, MagicCollection collection) throws SQLException {
		logger.debug("remove " + mc + " from " + collection);

		BasicDBObject andQuery = new BasicDBObject();
		List<BasicDBObject> obj = new ArrayList<>();
							obj.add(new BasicDBObject("db_id",IDGenerator.generate(mc)));
							obj.add(new BasicDBObject("collection.name", collection.getName()));
		andQuery.put("$and", obj);
		DeleteResult dr = db.getCollection("cards",BasicDBObject.class).deleteMany(andQuery);
		logger.debug(dr.toString());

	}

	@Override
	public void removeCard(MagicCard mc, MagicCollection collection) throws SQLException {
		logger.debug("remove " + mc + " from " + collection);

		BasicDBObject andQuery = new BasicDBObject();
		List<BasicDBObject> obj = new ArrayList<BasicDBObject>();
							obj.add(new BasicDBObject("db_id",IDGenerator.generate(mc)));
							obj.add(new BasicDBObject("collection.name", collection.getName()));
		andQuery.put("$and", obj);
		DeleteResult dr = db.getCollection("cards",BasicDBObject.class).deleteMany(andQuery);
		logger.debug(dr.toString());

	}

Replace Generic With Diamond ArrayList<BasicDBObject> with ArrayList<> in method public removeCard(mc MagicCard, collection MagicCollection) : void from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public List<MagicCard> listCards() throws SQLException {
		logger.debug("list all cards");
		List<MagicCard> list = new ArrayList<>();

		db.getCollection("cards",BasicDBObject.class).find().forEach(new Block<BasicDBObject>() {
				        @Override
				        public void apply(final BasicDBObject result) {
				        	list.add(deserialize(result.get("card").toString(),MagicCard.class));
				        	}
				    	}
				  );
		return list;
	}

	@Override
	public List<MagicCard> listCards() throws SQLException {
		logger.debug("list all cards");
		List<MagicCard> list = new ArrayList<MagicCard>();

		db.getCollection("cards",BasicDBObject.class).find().forEach(new Block<BasicDBObject>() {
				        @Override
				        public void apply(final BasicDBObject result) {
				        	list.add(deserialize(result.get("card").toString(),MagicCard.class));
				        	}
				    	}
				  );
		return list;
	}

Replace Generic With Diamond ArrayList<MagicCard> with ArrayList<> in method public listCards() : List<MagicCard> from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public Map<String, Integer> getCardsCountGlobal(MagicCollection c) throws SQLException {
		Map<String, Integer> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
		 List<Bson> aggr = Arrays.asList(
	              Aggregates.match(Filters.eq("collection.name", c.getName())),
	              Aggregates.group("$edition", Accumulators.sum("count", 1))
	      );

		 logger.trace(aggr.toString());

		db.getCollection("cards",BasicDBObject.class)
		  .aggregate(aggr)
		  .forEach( new Block<BasicDBObject>() {
				        @Override
				        public void apply(final BasicDBObject document) {
				            map.put(document.getString("_id"), document.getInt("count"));
				        	}
				    	}
				  );
		return map;
	}

	@Override
	public Map<String, Integer> getCardsCountGlobal(MagicCollection c) throws SQLException {
		Map<String, Integer> map = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
		 List<Bson> aggr = Arrays.asList(
	              Aggregates.match(Filters.eq("collection.name", c.getName())),
	              Aggregates.group("$edition", Accumulators.sum("count", 1))
	      );

		 logger.trace(aggr.toString());

		db.getCollection("cards",BasicDBObject.class)
		  .aggregate(aggr)
		  .forEach( new Block<BasicDBObject>() {
				        @Override
				        public void apply(final BasicDBObject document) {
				            map.put(document.getString("_id"), document.getInt("count"));
				        	}
				    	}
				  );
		return map;
	}

Replace Generic With Diamond TreeMap<String,Integer> with TreeMap<> in method public getCardsCountGlobal(c MagicCollection) : Map<String,Integer> from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public int getCardsCount(MagicCollection cols,MagicEdition me) throws SQLException {

		logger.debug("getCardsCount " + cols + " me:"+me);
		if(me!=null)
		{
			BasicDBObject andQuery = new BasicDBObject();
			List<BasicDBObject> obj = new ArrayList<>();
								obj.add(new BasicDBObject("collection.name", cols.getName()));
								obj.add(new BasicDBObject("edition",me.getId().toUpperCase()));
			andQuery.put("$and", obj);
			return (int) db.getCollection("cards",BasicDBObject.class).count(andQuery);
		}
		else
		{
			return (int) db.getCollection("cards",BasicDBObject.class).count(new BasicDBObject("collection.name", cols.getName()));
		}

	}

	@Override
	public int getCardsCount(MagicCollection cols,MagicEdition me) throws SQLException {

		logger.debug("getCardsCount " + cols + " me:"+me);
		if(me!=null)
		{
			BasicDBObject andQuery = new BasicDBObject();
			List<BasicDBObject> obj = new ArrayList<BasicDBObject>();
								obj.add(new BasicDBObject("collection.name", cols.getName()));
								obj.add(new BasicDBObject("edition",me.getId().toUpperCase()));
			andQuery.put("$and", obj);
			return (int) db.getCollection("cards",BasicDBObject.class).count(andQuery);
		}
		else
		{
			return (int) db.getCollection("cards",BasicDBObject.class).count(new BasicDBObject("collection.name", cols.getName()));
		}

	}

Replace Generic With Diamond ArrayList<BasicDBObject> with ArrayList<> in method public getCardsCount(cols MagicCollection, me MagicEdition) : int from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public List<String> getEditionsIDFromCollection(MagicCollection collection) throws SQLException {
		List<String> ret = new ArrayList<>();
		BasicDBObject query = new BasicDBObject();
		query.put("collection.name", collection.getName());
		db.getCollection("cards", BasicDBObject.class).distinct("edition",query,String.class).into(ret);
		return ret;
	}

	@Override
	public List<String> getEditionsIDFromCollection(MagicCollection collection) throws SQLException {
		List<String> ret = new ArrayList<String>();
		BasicDBObject query = new BasicDBObject();
		query.put("collection.name", collection.getName());
		db.getCollection("cards", BasicDBObject.class).distinct("edition",query,String.class).into(ret);
		return ret;
	}

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getEditionsIDFromCollection(collection MagicCollection) : List<String> from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public List<MagicCollection> getCollections() throws SQLException {
		MongoCollection<MagicCollection> collection = db.getCollection("collects", MagicCollection.class);
		List<MagicCollection> cols = new ArrayList<>();
		collection.find().into(cols);
		return cols;
	}

	@Override
	public List<MagicCollection> getCollections() throws SQLException {
		MongoCollection<MagicCollection> collection = db.getCollection("collects", MagicCollection.class);
		List<MagicCollection> cols = new ArrayList<MagicCollection>();
		collection.find().into(cols);
		return cols;
	}

Replace Generic With Diamond ArrayList<MagicCollection> with ArrayList<> in method public getCollections() : List<MagicCollection> from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public List<MagicCardStock> getStocks(MagicCard mc, MagicCollection col) throws SQLException {
		return new ArrayList<>();
	}

	@Override
	public List<MagicCardStock> getStocks(MagicCard mc, MagicCollection col) throws SQLException {
		return new ArrayList<MagicCardStock>();
	}

Replace Generic With Diamond ArrayList<MagicCardStock> with ArrayList<> in method public getStocks(mc MagicCard, col MagicCollection) : List<MagicCardStock> from class org.magic.api.dao.impl.MongoDbDAO


	public List<MagicCardStock> getStocks() throws SQLException {
		List<MagicCardStock> stocks= new ArrayList<>();
		db.getCollection("stocks",BasicDBObject.class).find().forEach(new Block<BasicDBObject>() {
	        @Override
	        public void apply(final BasicDBObject result) {
	        	stocks.add(deserialize(result.get("stockItem").toString(),MagicCardStock.class));
	        	}
	    	}
	  );

		return stocks;
	}

	public List<MagicCardStock> getStocks() throws SQLException {
		List<MagicCardStock> stocks= new ArrayList<MagicCardStock>();
		db.getCollection("stocks",BasicDBObject.class).find().forEach(new Block<BasicDBObject>() {
	        @Override
	        public void apply(final BasicDBObject result) {
	        	stocks.add(deserialize(result.get("stockItem").toString(),MagicCardStock.class));
	        	}
	    	}
	  );

		return stocks;
	}

Replace Generic With Diamond ArrayList<MagicCardStock> with ArrayList<> in method public getStocks() : List<MagicCardStock> from class org.magic.api.dao.impl.MongoDbDAO


	@Override
	public List<MagicCardAlert> getAlerts() {
		ArrayList<MagicCardAlert> ret= new ArrayList<>();
		db.getCollection("alerts",BasicDBObject.class).find().forEach(new Block<BasicDBObject>() {
	        @Override
	        public void apply(final BasicDBObject result) {
	        	ret.add(deserialize(result.get("alertItem").toString(),MagicCardAlert.class));
	        	}
	    	}
	  );
      return ret;
	}

	@Override
	public List<MagicCardAlert> getAlerts() {
		ArrayList<MagicCardAlert> ret= new ArrayList<MagicCardAlert>();
		db.getCollection("alerts",BasicDBObject.class).find().forEach(new Block<BasicDBObject>() {
	        @Override
	        public void apply(final BasicDBObject result) {
	        	ret.add(deserialize(result.get("alertItem").toString(),MagicCardAlert.class));
	        	}
	    	}
	  );
      return ret;
	}

Replace Generic With Diamond ArrayList<MagicCardAlert> with ArrayList<> in method public getAlerts() : List<MagicCardAlert> from class org.magic.api.dao.impl.MongoDbDAO


	public Map<Date,Double> getPriceVariation(MagicCard mc,MagicEdition me) throws IOException {

		stop = false;
		String url ="";
		Map<Date,Double> historyPrice = new TreeMap<>();
		int index=0;

		if(me==null)
			 me=mc.getEditions().get(0);

		 if(mc==null)
		 {
			 url = props.getProperty("URL_EDITIONS")+replace(me.getId(),false)+"#"+props.getProperty("FORMAT");
			 index=6;
		 }
		 else
		 {
			 String cardName=mc.getName().replaceAll(" ", "+").replaceAll("'", "").replaceAll(",", "");
			 String editionName=me.toString().replaceAll(" ", "+").replaceAll("'", "").replaceAll(",", "").replaceAll(":","");
			 url =props.getProperty("WEBSITE")+"/price/"+convert(editionName)+"/"+cardName+"#"+props.getProperty("FORMAT");
			 index=8;

		 }

		try{

		 logger.debug("get shakes from " + url);

		 Document d = Jsoup.connect(url)
	    		 	.userAgent(props.getProperty("USER_AGENT"))
					.timeout(Integer.parseInt(props.get("TIMEOUT").toString()))
					.get();

		 Element js = d.getElementsByTag("script").get(index);

	     AstNode node = new Parser().parse(js.html(), "", 1);
	     		 node.visit( n->
	 	             {

	    	        		 if(!stop && node.toSource().startsWith("d"))
	    	        		 {
		    	        			 String val = node.toSource();
		    	        			 val=val.replaceAll("d \\+\\= ", "");
		    	        			 val=val.replaceAll("\\\\n", "");
		    	        			 val=val.replaceAll(";", "");
		    	        			 val=val.replaceAll("\"", "");
		    	        			 String[] res = val.split(",");
		    	        			try {
		    	        				Date date = new SimpleDateFormat("yyyy-MM-dd hh:mm").parse(res[0]+ " 00:00");
		    							if(historyPrice.get(date)==null)
		    								historyPrice.put(date, Double.parseDouble(res[1]));
		    						}
		    	        			catch (Exception e) {
		    							logger.error(e);
		    						}
	    	        		 }

	    	        		 if(node.toSource().startsWith("g ="))
	    	        		 {
	    	        			 stop=true;
	    	        		 }

	    	        	return true;
	    	         });

	    return historyPrice;

		}catch(Exception e)
		{
			logger.error(e);
			return historyPrice;
		}
	}

	public Map<Date,Double> getPriceVariation(MagicCard mc,MagicEdition me) throws IOException {

		stop = false;
		String url ="";
		historyPrice = new TreeMap<>();
		int index=0;

		if(me==null)
			 me=mc.getEditions().get(0);

		 if(mc==null)
		 {
			 url = props.getProperty("URL_EDITIONS")+replace(me.getId(),false)+"#"+props.getProperty("FORMAT");
			 index=6;
		 }
		 else
		 {
			 String cardName=mc.getName().replaceAll(" ", "+").replaceAll("'", "").replaceAll(",", "");
			 String editionName=me.toString().replaceAll(" ", "+").replaceAll("'", "").replaceAll(",", "").replaceAll(":","");
			 url =props.getProperty("WEBSITE")+"/price/"+convert(editionName)+"/"+cardName+"#"+props.getProperty("FORMAT");
			 index=8;

		 }

		try{

		 logger.debug("get shakes from " + url);

		 Document d = Jsoup.connect(url)
	    		 	.userAgent(props.getProperty("USER_AGENT"))
					.timeout(Integer.parseInt(props.get("TIMEOUT").toString()))
					.get();

		 Element js = d.getElementsByTag("script").get(index);

	     AstNode node = new Parser().parse(js.html(), "", 1);
	     		 node.visit( new NodeVisitor() {
	 	             public boolean visit(AstNode node)
	 	             {

	    	        		 if(stop==false)
	    	        		 {
	    	        			 if(node.toSource().startsWith("d"))
		    	        		 {
		    	        			 String val = node.toSource();
		    	        			 val=val.replaceAll("d \\+\\= ", "");
		    	        			 val=val.replaceAll("\\\\n", "");
		    	        			 val=val.replaceAll(";", "");
		    	        			 val=val.replaceAll("\"", "");
		    	        			 String[] res = val.split(",");
		    	        			try {
		    	        				Date d = new SimpleDateFormat("yyyy-MM-dd hh:mm").parse(res[0]+ " 00:00");
		    							if(historyPrice.get(d)==null)
		    								historyPrice.put(d, Double.parseDouble(res[1]));
		    						}
		    	        			catch (Exception e) {
		    							logger.error(e);
		    						}
		    	        		 }
	    	        		 }

	    	        		 if(node.toSource().startsWith("g ="))
	    	        		 {
	    	        			 stop=true;
	    	        		 }

	    	        	return true;
	    	         }});

	    return historyPrice;

		}catch(Exception e)
		{
			logger.error(e);
			return historyPrice;
		}
	}

Replace Anonymous With Lambda org.magic.api.dashboard.impl.MTGoldFishDashBoard.getPriceVariation.visit.new NodeVisitor with n -> {if(!stop && node.toSource().startsWith("d")){String val=node.toSource(); in method public getPriceVariation(mc MagicCard, me MagicEdition) : Map<Date,Double> from class org.magic.api.dashboard.impl.MTGoldFishDashBoard


	public DeckstatsDeckSniffer() {
		super();
		if(!new File(confdir, getName()+".conf").exists()){
			props.put("USER_AGENT", "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13");
			props.put("URL", "https://deckstats.net/decks/f/");
			props.put("TIMEOUT", "0");
			props.put("FORMAT", "standard");
			props.put("MAX_PAGE", "2");
			save();
		}
		cacheColor = new HashMap<>();
		initcache();
	}

	public DeckstatsDeckSniffer() {
		super();
		if(!new File(confdir, getName()+".conf").exists()){
			props.put("USER_AGENT", "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13");
			props.put("URL", "https://deckstats.net/decks/f/");
			props.put("TIMEOUT", "0");
			props.put("FORMAT", "standard");
			props.put("MAX_PAGE", "2");
			save();
		}
		cacheColor = new HashMap<Integer,String>();
		initcache();
	}

Replace Generic With Diamond HashMap<Integer,String> with HashMap<> in method public DeckstatsDeckSniffer() from class org.magic.api.decksniffer.impl.DeckstatsDeckSniffer


	public List<RetrievableDeck> getDeckList() throws Exception {

		String url=props.getProperty("URL")+"/decks?filter-format="+getFormatCode(props.getProperty("FORMAT"))+"&filter-deck-time-frame="+props.getProperty("FILTER");

		List<RetrievableDeck> list = new ArrayList<>();

		int nbPage=1;
		int maxPage = Integer.parseInt(props.getProperty("MAX_PAGE"));

		for(int i=1;i<=maxPage;i++)
		{
			url=url+"&page="+nbPage;
			logger.debug("sniff url : " + url);

		Document d = Jsoup.connect(url)
    		 	.userAgent(props.getProperty("USER_AGENT"))
				.get();

		Elements e = null;

		e = d.select("tr.deck-row" );

		for(Element cont : e)
		{
			RetrievableDeck deck = new RetrievableDeck();
							deck.setName(cont.select("a.deck-name").html());
							deck.setAuthor(cont.select("small.deck-credit a").text());
							deck.setUrl(new URL(props.getProperty("URL")+"/"+cont.select("a.deck-name").attr("href")).toURI());
							deck.setDescription(cont.select("span.deck-type").html());
							deck.setColor(parseColor(cont.select("script").html()));
			list.add(deck);
		}
		nbPage++;
		}
		return list;
	}

	public List<RetrievableDeck> getDeckList() throws Exception {

		String url=props.getProperty("URL")+"/decks?filter-format="+getFormatCode(props.getProperty("FORMAT"))+"&filter-deck-time-frame="+props.getProperty("FILTER");

		List<RetrievableDeck> list = new ArrayList<RetrievableDeck>();

		int nbPage=1;
		int maxPage = Integer.parseInt(props.getProperty("MAX_PAGE"));

		for(int i=1;i<=maxPage;i++)
		{
			url=url+"&page="+nbPage;
			logger.debug("sniff url : " + url);

		Document d = Jsoup.connect(url)
    		 	.userAgent(props.getProperty("USER_AGENT"))
				.get();

		Elements e = null;

		e = d.select("tr.deck-row" );

		for(Element cont : e)
		{
			RetrievableDeck deck = new RetrievableDeck();
							deck.setName(cont.select("a.deck-name").html());
							deck.setAuthor(cont.select("small.deck-credit a").text());
							deck.setUrl(new URL(props.getProperty("URL")+"/"+cont.select("a.deck-name").attr("href")).toURI());
							deck.setDescription(cont.select("span.deck-type").html());
							deck.setColor(parseColor(cont.select("script").html()));
			list.add(deck);
		}
		nbPage++;
		}
		return list;
	}

Replace Generic With Diamond ArrayList<RetrievableDeck> with ArrayList<> in method public getDeckList() : List<RetrievableDeck> from class org.magic.api.decksniffer.impl.MTGSalvationDeckSniffer


	private String parseColor(String string) {
		AstNode node = new Parser().parse(string, "", 1);
		 node.visit( n-> {
				manajson=n.toSource();
				return false;
		});

		manajson=manajson.substring(manajson.indexOf("series")+"series: ".length(),manajson.length()-8);

		JsonArray arr = new JsonParser().parse(manajson).getAsJsonArray();
		manajson="";
		boolean hascolor=false;
		for(int i=0;i<arr.size();i++)
		{
			JsonObject obj = arr.get(i).getAsJsonObject();
			String c = ColorParser.parse(obj.get("name").getAsString());
			JsonArray tab = obj.get("data").getAsJsonArray();
			hascolor=false;
			for(int j=0;j<tab.size();j++)
			{
				if(tab.get(j).getAsInt()>0)
					hascolor=true;
			}

			if(hascolor&& !c.equals("{C}"))
			{
				manajson+=c;
			}
		}

		return manajson;
	}

	private String parseColor(String string) {
		AstNode node = new Parser().parse(string, "", 1);
		 node.visit( new NodeVisitor() {
			@Override
			public boolean visit(AstNode n) {
				manajson=n.toSource();
				return false;
			}
		});
		manajson=manajson.substring(manajson.indexOf("series")+"series: ".length(),manajson.length()-8);

		JsonArray arr = new JsonParser().parse(manajson).getAsJsonArray();
		manajson="";
		boolean hascolor=false;
		for(int i=0;i<arr.size();i++)
		{
			JsonObject obj = arr.get(i).getAsJsonObject();
			String c = ColorParser.parse(obj.get("name").getAsString());
			JsonArray tab = obj.get("data").getAsJsonArray();
			hascolor=false;
			for(int j=0;j<tab.size();j++)
			{
				if(tab.get(j).getAsInt()>0)
					hascolor=true;
			}

			if(hascolor)
			{
				if(!c.equals("{C}"))
					manajson+=c;
			}
		}

		return manajson;
	}

Replace Anonymous With Lambda org.magic.api.decksniffer.impl.MTGSalvationDeckSniffer.parseColor.visit.new NodeVisitor with n -> {manajson=n.toSource(); in method private parseColor(string String) : String from class org.magic.api.decksniffer.impl.MTGSalvationDeckSniffer


	private void initFormats() {
		formats=new HashMap<>();
		formats.put("Standard", "ST");
		formats.put("Modern", "MO");
		formats.put("Legacy", "LE");
		formats.put("Vintage", "VI");
		formats.put("Duel Commander", "EDH");
		formats.put("MTGO Commander", "EDHM");
		formats.put("Block", "BL");
		formats.put("Extended", "EX");
		formats.put("Pauper", "PAU");
		formats.put("Highlander", "HIGH");
		formats.put("Canadian Highlander", "CHL");
		formats.put("Limited", "LI");

	}

	private void initFormats() {
		formats=new HashMap<String,String>();
		formats.put("Standard", "ST");
		formats.put("Modern", "MO");
		formats.put("Legacy", "LE");
		formats.put("Vintage", "VI");
		formats.put("Duel Commander", "EDH");
		formats.put("MTGO Commander", "EDHM");
		formats.put("Block", "BL");
		formats.put("Extended", "EX");
		formats.put("Pauper", "PAU");
		formats.put("Highlander", "HIGH");
		formats.put("Canadian Highlander", "CHL");
		formats.put("Limited", "LI");

	}

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private initFormats() : void from class org.magic.api.decksniffer.impl.MTGTop8DeckSniffer


	@Override
	public List<RetrievableDeck> getDeckList() throws Exception {
		Document d = Jsoup.connect(props.getProperty("URL")+"/mc.php?rub=decks&limit=0")
    		 	.userAgent(props.getProperty("USER_AGENT"))
				.get();

		Elements e = d.select("table.html_table > tbody" );

		List<RetrievableDeck> list = new ArrayList<>();
		for(Element cont : e.get(0).getElementsByTag("tr"))
		{
			String name = cont.getElementsByTag("td").get(1).text();
			String url = cont.getElementsByTag("td").get(1).getElementsByTag("a").attr("href");
			String auteur = cont.getElementsByTag("td").get(5).text();

			StringBuilder temp = new StringBuilder();

			for(Element color : cont.getElementsByTag("td").get(2).select("img"))
			{
				if(color.attr("src").contains("white"))
					temp.append("{W}");
				if(color.attr("src").contains("blue"))
					temp.append("{U}");
				if(color.attr("src").contains("black"))
					temp.append("{B}");
				if(color.attr("src").contains("red"))
					temp.append("{R}");
				if(color.attr("src").contains("green"))
					temp.append("{G}");
			}

			RetrievableDeck deck = new RetrievableDeck();

			deck.setName(name);
			deck.setUrl(new URI(url));
			deck.setAuthor(auteur);
			deck.setColor(temp.toString());
			list.add(deck);
		}

		return list;
	}

	@Override
	public List<RetrievableDeck> getDeckList() throws Exception {
		Document d = Jsoup.connect(props.getProperty("URL")+"/mc.php?rub=decks&limit=0")
    		 	.userAgent(props.getProperty("USER_AGENT"))
				.get();

		Elements e = d.select("table.html_table > tbody" );

		List<RetrievableDeck> list = new ArrayList<RetrievableDeck>();
		for(Element cont : e.get(0).getElementsByTag("tr"))
		{
			String name = cont.getElementsByTag("td").get(1).text();
			String url = cont.getElementsByTag("td").get(1).getElementsByTag("a").attr("href");
			String auteur = cont.getElementsByTag("td").get(5).text();

			StringBuilder temp = new StringBuilder();

			for(Element color : cont.getElementsByTag("td").get(2).select("img"))
			{
				if(color.attr("src").contains("white"))
					temp.append("{W}");
				if(color.attr("src").contains("blue"))
					temp.append("{U}");
				if(color.attr("src").contains("black"))
					temp.append("{B}");
				if(color.attr("src").contains("red"))
					temp.append("{R}");
				if(color.attr("src").contains("green"))
					temp.append("{G}");
			}

			RetrievableDeck deck = new RetrievableDeck();

			deck.setName(name);
			deck.setUrl(new URI(url));
			deck.setAuthor(auteur);
			deck.setColor(temp.toString());
			list.add(deck);
		}

		return list;
	}

Replace Generic With Diamond ArrayList<RetrievableDeck> with ArrayList<> in method public getDeckList() : List<RetrievableDeck> from class org.magic.api.decksniffer.impl.MagicCorporationDecks


	@Override
	public List<RetrievableDeck> getDeckList() throws Exception {
		String url =props.getProperty("URL")+"/magic/deck/search?format="+props.getProperty("FORMAT")+"&page=1";
		logger.debug("get List deck at " + url);
		List<RetrievableDeck> list = new ArrayList<>();
		int nbPage=1;
		int maxPage = Integer.parseInt(props.getProperty("MAX_PAGE"));

		for(int i=1;i<=maxPage;i++)
		{

			 url =props.getProperty("URL")+"/magic/deck/search?format="+props.getProperty("FORMAT")+"&page="+nbPage;
			 Document d = Jsoup.connect(url)
		    		 	.userAgent(props.getProperty("USER_AGENT"))
						.get();

			Elements table = d.getElementsByClass("dataTable");

			table.get(0).getElementsByTag("tr").remove(0);
			for(Element tr : table.get(0).getElementsByClass("gradeA"))
			{
				RetrievableDeck deck = new RetrievableDeck();

				String mana="";

				Element manaEl = tr.getElementsByTag("td").get(0);
				if(manaEl.toString().contains("white-mana"))
					mana+="{W}";
				if(manaEl.toString().contains("blue-mana"))
					mana+="{U}";
				if(manaEl.toString().contains("black-mana"))
					mana+="{B}";
				if(manaEl.toString().contains("red-mana"))
					mana+="{R}";
				if(manaEl.toString().contains("green-mana"))
					mana+="{G}";

				String deckName= tr.getElementsByTag("td").get(1).text();
				String link = props.getProperty("URL")+ tr.getElementsByTag("td").get(1).getElementsByTag("a").attr("href");
				String deckPlayer= tr.getElementsByTag("td").get(2).text();

				deck.setColor(mana);
				deck.setAuthor(deckPlayer);
				deck.setName(deckName);
				deck.setUrl(new URI(link));

				list.add(deck);

			}
			nbPage++;

		}

		return list;

	}

	@Override
	public List<RetrievableDeck> getDeckList() throws Exception {
		String url =props.getProperty("URL")+"/magic/deck/search?format="+props.getProperty("FORMAT")+"&page=1";
		logger.debug("get List deck at " + url);
		List<RetrievableDeck> list = new ArrayList<RetrievableDeck>();
		int nbPage=1;
		int maxPage = Integer.parseInt(props.getProperty("MAX_PAGE"));

		for(int i=1;i<=maxPage;i++)
		{

			 url =props.getProperty("URL")+"/magic/deck/search?format="+props.getProperty("FORMAT")+"&page="+nbPage;
			 Document d = Jsoup.connect(url)
		    		 	.userAgent(props.getProperty("USER_AGENT"))
						.get();

			Elements table = d.getElementsByClass("dataTable");

			table.get(0).getElementsByTag("tr").remove(0);
			for(Element tr : table.get(0).getElementsByClass("gradeA"))
			{
				RetrievableDeck deck = new RetrievableDeck();

				String mana="";

				Element manaEl = tr.getElementsByTag("td").get(0);
				if(manaEl.toString().contains("white-mana"))
					mana+="{W}";
				if(manaEl.toString().contains("blue-mana"))
					mana+="{U}";
				if(manaEl.toString().contains("black-mana"))
					mana+="{B}";
				if(manaEl.toString().contains("red-mana"))
					mana+="{R}";
				if(manaEl.toString().contains("green-mana"))
					mana+="{G}";

				String deckName= tr.getElementsByTag("td").get(1).text();
				String link = props.getProperty("URL")+ tr.getElementsByTag("td").get(1).getElementsByTag("a").attr("href");
				String deckPlayer= tr.getElementsByTag("td").get(2).text();

				deck.setColor(mana);
				deck.setAuthor(deckPlayer);
				deck.setName(deckName);
				deck.setUrl(new URI(link));

				list.add(deck);

			}
			nbPage++;

		}

		return list;

	}

Replace Generic With Diamond ArrayList<RetrievableDeck> with ArrayList<> in method public getDeckList() : List<RetrievableDeck> from class org.magic.api.decksniffer.impl.TCGPlayerDeckSniffer


	public List<RetrievableDeck> getDeckList() throws Exception {

		String tappedJson = props.getProperty("URL_JSON").replaceAll("%FORMAT%", props.getProperty("FORMAT"));

		logger.debug("sniff url : " + tappedJson);
		String responseBody = EntityUtils.toString(httpclient.execute(new HttpGet(tappedJson), httpContext).getEntity());

        JsonElement root = new JsonParser().parse(responseBody);
		List<RetrievableDeck> list = new ArrayList<>();

        for(int i=0;i<root.getAsJsonArray().size();i++)
		{
			JsonObject obj = root.getAsJsonArray().get(i).getAsJsonObject();
			RetrievableDeck deck = new RetrievableDeck();
			deck.setName(obj.get("name").getAsString());
			deck.setUrl(new URI(obj.get("resource_uri").getAsString()));
			deck.setAuthor(obj.get("user").getAsString());
			deck.setColor("");
			list.add(deck);
		}

        return list;
	}

	public List<RetrievableDeck> getDeckList() throws Exception {

		String tappedJson = props.getProperty("URL_JSON").replaceAll("%FORMAT%", props.getProperty("FORMAT"));

		logger.debug("sniff url : " + tappedJson);
		String responseBody = EntityUtils.toString(httpclient.execute(new HttpGet(tappedJson), httpContext).getEntity());

        JsonElement root = new JsonParser().parse(responseBody);
		List<RetrievableDeck> list = new ArrayList<RetrievableDeck>();

        for(int i=0;i<root.getAsJsonArray().size();i++)
		{
			JsonObject obj = root.getAsJsonArray().get(i).getAsJsonObject();
			RetrievableDeck deck = new RetrievableDeck();
			deck.setName(obj.get("name").getAsString());
			deck.setUrl(new URI(obj.get("resource_uri").getAsString()));
			deck.setAuthor(obj.get("user").getAsString());
			deck.setColor("");
			list.add(deck);
		}

        return list;
	}

Replace Generic With Diamond ArrayList<RetrievableDeck> with ArrayList<> in method public getDeckList() : List<RetrievableDeck> from class org.magic.api.decksniffer.impl.TappedOutDeckSniffer


	public RssGUI() {
		logger.info("init RSS GUI");
		setLayout(new BorderLayout(0, 0));

		JScrollPane scrollTable = new JScrollPane();
		model = new RssContentTableModel();
		table = new JTable(model);

		scrollTable.setViewportView(table);

		JScrollPane scrollTree = new JScrollPane();

		JTree tree = new JTree();

		DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Magic RSS");
		/*{
				{
					Set<String> catg = new HashSet<String>();
					for(RSSBean r : MTGControler.getInstance().getRss())
					{
							catg.add(r.getCategorie());
					}

					for(String cat : catg)
					{
						DefaultMutableTreeNode node_1 = new DefaultMutableTreeNode(cat);
						for(RSSBean r : MTGControler.getInstance().getRss())
						{
							if(r.getCategorie().equals(cat))
								node_1.add(new DefaultMutableTreeNode(r));
						}
						add(node_1);
					}

				}
		};*/

		tree.setModel(new DefaultTreeModel(rootNode));

		scrollTree.setViewportView(tree);
		JSplitPane splitPane = new JSplitPane();
		splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);

		JScrollPane scrollEditor = new JScrollPane();
		editorPane = new JEditorPane();
		editorPane.setEditable(false);
		editorPane.setContentType("text/html");

		scrollEditor.setViewportView(editorPane);

		splitPane.setLeftComponent(scrollTable);
		splitPane.setRightComponent(scrollEditor);

		JSplitPane splitPane1 = new JSplitPane();
		add(splitPane1, BorderLayout.CENTER);
		splitPane1.setLeftComponent(scrollTree);
		splitPane1.setRightComponent(splitPane);

		JPanel panelHaut = new JPanel();
		add(panelHaut, BorderLayout.NORTH);

		JButton btnNewButton = new JButton("");

		btnNewButton.setIcon(MTGConstants.ICON_NEW);
		panelHaut.add(btnNewButton);

		tree.addTreeSelectionListener(tse->{
				TreePath path = tse.getPath();
				curr = (DefaultMutableTreeNode) path.getLastPathComponent();

				if(curr.getUserObject() instanceof RSSBean)
					ThreadManager.getInstance().execute(()->{
							try {
								model.init((RSSBean)curr.getUserObject());
							} catch (Exception e) {
								MTGLogger.printStackTrace(e);
							}
							model.fireTableDataChanged();
					}, "load RSS " + curr.getUserObject());
		});

		table.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent me) {
				SyndEntry sel = model.getEntryAt(table.getSelectedRow());
				if(sel.getDescription()!=null)
					editorPane.setText(sel.getDescription().getValue());

			}
		});

	}

	public RssGUI() {
		logger.info("init RSS GUI");
		setLayout(new BorderLayout(0, 0));

		JScrollPane scrollTable = new JScrollPane();
		model = new RssContentTableModel();
		table = new JTable(model);

		scrollTable.setViewportView(table);

		JScrollPane scrollTree = new JScrollPane();

		JTree tree = new JTree();
		/*tree.setModel(new DefaultTreeModel(
			new DefaultMutableTreeNode("Magic RSS") {
				{
					Set<String> catg = new HashSet<String>();
					for(RSSBean r : MTGControler.getInstance().getRss())
					{
							catg.add(r.getCategorie());
					}

					for(String cat : catg)
					{
						DefaultMutableTreeNode node_1 = new DefaultMutableTreeNode(cat);
						for(RSSBean r : MTGControler.getInstance().getRss())
						{
							if(r.getCategorie().equals(cat))
								node_1.add(new DefaultMutableTreeNode(r));
						}
						add(node_1);
					}

				}
			}
		));*/
		scrollTree.setViewportView(tree);
		JSplitPane splitPane = new JSplitPane();
		splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);

		JScrollPane scrollEditor = new JScrollPane();
		editorPane = new JEditorPane();
		editorPane.setEditable(false);
		editorPane.setContentType("text/html");

		scrollEditor.setViewportView(editorPane);

		splitPane.setLeftComponent(scrollTable);
		splitPane.setRightComponent(scrollEditor);

		JSplitPane splitPane_1 = new JSplitPane();
		add(splitPane_1, BorderLayout.CENTER);
		splitPane_1.setLeftComponent(scrollTree);
		splitPane_1.setRightComponent(splitPane);

		JPanel panelHaut = new JPanel();
		add(panelHaut, BorderLayout.NORTH);

		JButton btnNewButton = new JButton("");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {

			}
		});
		btnNewButton.setIcon(MTGConstants.ICON_NEW);
		panelHaut.add(btnNewButton);

		tree.addTreeSelectionListener(new TreeSelectionListener() {
			public void valueChanged(TreeSelectionEvent tse) {
				TreePath path = tse.getPath();
				curr = (DefaultMutableTreeNode) path.getLastPathComponent();

				if(curr.getUserObject() instanceof RSSBean)
					ThreadManager.getInstance().execute(new Runnable() {
						public void run() {
							try {
								model.init((RSSBean)curr.getUserObject());
							} catch (Exception e) {
								MTGLogger.printStackTrace(e);
							}
							model.fireTableDataChanged();

						}
					}, "load RSS " + curr.getUserObject());

			}
		});

		table.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent me) {
				SyndEntry sel = model.getEntryAt(table.getSelectedRow());
				if(sel.getDescription()!=null)
					editorPane.setText(sel.getDescription().getValue());

			}
		});

	}

Replace Anonymous With Lambda org.magic.gui.RssGUI.RssGUI.addTreeSelectionListener.new TreeSelectionListener with tse -> {TreePath path=tse.getPath(); in method public RssGUI() from class org.magic.gui.RssGUI


	public KeyWordManager() {

			Gson s = new Gson();
			Type listType = new TypeToken<ArrayList<MTGKeyWord>>(){}.getType();
			list = s.fromJson(new InputStreamReader(this.getClass().getResourceAsStream("/data/keywords.json")), listType);
			if(list==null)
				list=new ArrayList<>();

	}

	public KeyWordManager() {

			Gson s = new Gson();
			Type listType = new TypeToken<ArrayList<MTGKeyWord>>(){}.getType();
			list = s.fromJson(new InputStreamReader(this.getClass().getResourceAsStream("/data/keywords.json")), listType);
			if(list==null)
				list=new ArrayList<MTGKeyWord>();

	}

Replace Generic With Diamond ArrayList<MTGKeyWord> with ArrayList<> in method public KeyWordManager() from class org.magic.services.KeyWordManager


	public Set<MTGKeyWord> getKeywordsFrom(MagicCard magicCard, EVENT... t) {
		Set<MTGKeyWord> s = getKeywordsFrom(magicCard);
		Set<MTGKeyWord> ret = new HashSet<>();

		for(MTGKeyWord k : s)
			for(EVENT ev : t)
				if(k.getEvent().equals(ev))
						ret.add(k);

		return ret;
	}

	public Set<MTGKeyWord> getKeywordsFrom(MagicCard magicCard, EVENT... t) {
		Set<MTGKeyWord> s = getKeywordsFrom(magicCard);
		Set<MTGKeyWord> ret = new HashSet<MTGKeyWord>();

		for(MTGKeyWord k : s)
			for(EVENT ev : t)
				if(k.getEvent().equals(ev))
						ret.add(k);

		return ret;
	}

Replace Generic With Diamond HashSet<MTGKeyWord> with HashSet<> in method public getKeywordsFrom(magicCard MagicCard, t EVENT...) : Set<MTGKeyWord> from class org.magic.services.KeyWordManager


	public MTGAppender() {
		events=new ArrayList<>();
		obs=new MyObservable();
	}

	public MTGAppender() {
		events=new ArrayList<LoggingEvent>();
		obs=new MyObservable();
	}

Replace Generic With Diamond ArrayList<LoggingEvent> with ArrayList<> in method public MTGAppender() from class org.magic.services.MTGAppender


	private void initGUI() {
		renderer = new ReflectionRenderer();
		setBackgroundPainter(new MattePainter(PaintUtils.NIGHT_GRAY,true));

	    GestionnaireEvenements interactionManager = new GestionnaireEvenements(this);
		    this.addMouseListener(interactionManager);
		    this.addMouseMotionListener(interactionManager);
		    this.addMouseWheelListener(interactionManager);

		    timer = new Timer(30, e->{
                	repaint();

                	xScale += xDelta;

                    if(xScale > 1 || xScale < -1)
                    {
                        xDelta *= -1;

                    }

                    if(loop>0)
                    if((int)xScale==1 || (int)xScale==-1 )
                    {
                       timer.stop();
                 	   launched=false;

                    }
                    loop++;
            });
	}

	private void initGUI() {
		renderer = new ReflectionRenderer();
		setBackgroundPainter(new MattePainter(PaintUtils.NIGHT_GRAY,true));

	    GestionnaireEvenements interactionManager = new GestionnaireEvenements(this);
		    this.addMouseListener(interactionManager);
		    this.addMouseMotionListener(interactionManager);
		    this.addMouseWheelListener(interactionManager);

		    timer = new Timer(30, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                	repaint();

                	xScale += xDelta;
                    if (xScale > 1) {
                        xDelta *= -1;
                    } else if (xScale < -1) {
                        xDelta *= -1;
                    }

                    if(loop>0)
                    if((int)xScale==1 || (int)xScale==-1 )
                    {
                       timer.stop();
                 	   launched=false;

                    }
                    loop++;
                }
            });
	}

Replace Anonymous With Lambda org.magic.gui.components.CardsPicPanel.initGUI.new Timer.new ActionListener with e -> {repaint(); in method private initGUI() : void from class org.magic.gui.components.CardsPicPanel


	@Override
	public void alertDetected(final List<MagicPrice> p) {

		ThreadManager.getInstance().execute(()->{
				if(!p.isEmpty() && getProperty("AUTOMATIC_ADD_CARD_ALERT").equals("true"))
				{
					CartServices cart = new CartServices();
						try {
							List<Article> list = new ArrayList<>();

							for(MagicPrice mp : p)
							{
								Article a = (Article)mp.getShopItem();
								a.setCount(1);
								list.add(a);
							}
							boolean res = cart.addArticles(list);
							logger.info("add " + list + " to card :"  + res);
						} catch (Exception e) {
							logger.error("Could not add " + p +" to cart",e);
						}
				}
		}, "addCart");

	}

	@Override
	public void alertDetected(final List<MagicPrice> p) {

		ThreadManager.getInstance().execute(new Runnable() {

			@Override
			public void run() {
				if(!p.isEmpty())
				{
					if(getProperty("AUTOMATIC_ADD_CARD_ALERT").equals("true"))
					{
						CartServices cart = new CartServices();
						try {
							List<Article> list = new ArrayList<>();

							for(MagicPrice mp : p)
							{
								Article a = (Article)mp.getShopItem();
								a.setCount(1);
								list.add(a);
							}
							boolean res = cart.addArticles(list);
							logger.info("add " + list + " to card :"  + res);
						} catch (Exception e) {
							logger.error("Could not add " + p +" to cart",e);
						}
					}
				}

			}
		}, "addCart");

	}

Replace Anonymous With Lambda org.magic.api.pricers.impl.MagicCardMarketPricer2.alertDetected.execute.new Runnable with () -> {if(!p.isEmpty() && getProperty("AUTOMATIC_ADD_CARD_ALERT").equals("true")){CartServices cart=new CartServices(); in method public alertDetected(p List<MagicPrice>) : void from class org.magic.api.pricers.impl.MagicCardMarketPricer2


	public List<ShopItem> search(String search)
	{
		List<ShopItem> prices = new ArrayList<>();

	try{
		String url = props.getProperty("URL");
		   url = url.replaceAll("%API_KEY%", props.get("API_KEY").toString());
		   url = url.replaceAll("%COUNTRY%", props.get("COUNTRY").toString());
		   url = url.replaceAll("%MAX%", props.get("MAX").toString());

	String keyword=URLEncoder.encode(search,props.getProperty("ENCODING"));

	String link=url.replaceAll("%KEYWORD%", keyword);

	logger.info(getName() + " looking for " + link);

	try(JsonReader reader = new JsonReader(new InputStreamReader(new URL(link).openStream(), "UTF-8")))
	{
		JsonElement root = new JsonParser().parse(reader);
		JsonElement articles=root.getAsJsonObject().entrySet().iterator().next().getValue().getAsJsonArray().get(0).getAsJsonObject().get("searchResult");
		logger.debug(articles);
		if(articles.getAsJsonArray().get(0).getAsJsonObject().get("item")==null)
			return prices;

		JsonArray items = articles.getAsJsonArray().get(0).getAsJsonObject().get("item").getAsJsonArray();
			for(JsonElement el : items)
			{
			 		ShopItem mp = new ShopItem();

			 		String title = el.getAsJsonObject().get("title").getAsString();
			 		String type = el.getAsJsonObject().get("primaryCategory").getAsJsonArray().get(0).getAsJsonObject().get("categoryName").getAsString();
			 		String consultURL = el.getAsJsonObject().get("viewItemURL").getAsString();
			 		double price = el.getAsJsonObject().get("sellingStatus").getAsJsonArray().get(0).getAsJsonObject().get("currentPrice").getAsJsonArray().get(0).getAsJsonObject().get("__value__").getAsDouble();
			 		URL image =new URL(el.getAsJsonObject().get("galleryURL").getAsJsonArray().get(0).getAsString());
			 		Date d = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(el.getAsJsonObject().get("listingInfo").getAsJsonArray().get(0).getAsJsonObject().get("startTime").getAsString());
			 		String id =  el.getAsJsonObject().get("itemId").getAsString();
			 		mp.setName(title);
			 		mp.setUrl(new URL(consultURL));
			 		mp.setPrice(price);
			 		mp.setType(type);
			 		mp.setShopName(getName());
			 		mp.setImage(image);
			 		mp.setDate(d);
			 		mp.setId(id);
			 		prices.add(mp);
			 }
		}
	}
	catch(Exception e)
	{
		logger.error(e);
	}
	return prices;
}

	public List<ShopItem> search(String search) {
		List<ShopItem> prices = new ArrayList<ShopItem>();

	try{
		String url = props.getProperty("URL");
		   url = url.replaceAll("%API_KEY%", props.get("API_KEY").toString());
		   url = url.replaceAll("%COUNTRY%", props.get("COUNTRY").toString());
		   url = url.replaceAll("%MAX%", props.get("MAX").toString());

	String KEYWORD=URLEncoder.encode(search,props.getProperty("ENCODING"));

	String link=url.replaceAll("%KEYWORD%", KEYWORD);

	logger.info(getName() + " looking for " + link);

	JsonReader reader = new JsonReader(new InputStreamReader(new URL(link).openStream(), "UTF-8"));
	JsonElement root = new JsonParser().parse(reader);

	JsonElement articles=root.getAsJsonObject().entrySet().iterator().next().getValue().getAsJsonArray().get(0).getAsJsonObject().get("searchResult");

	logger.debug(articles);

	if(articles.getAsJsonArray().get(0).getAsJsonObject().get("item")==null)
		return prices;

	 	JsonArray items = articles.getAsJsonArray().get(0).getAsJsonObject().get("item").getAsJsonArray();

	 	for(JsonElement el : items)
	 	{
	 		ShopItem mp = new ShopItem();

	 		String title = el.getAsJsonObject().get("title").getAsString();
	 		String type = el.getAsJsonObject().get("primaryCategory").getAsJsonArray().get(0).getAsJsonObject().get("categoryName").getAsString();
	 		String consultURL = el.getAsJsonObject().get("viewItemURL").getAsString();
	 		double price = el.getAsJsonObject().get("sellingStatus").getAsJsonArray().get(0).getAsJsonObject().get("currentPrice").getAsJsonArray().get(0).getAsJsonObject().get("__value__").getAsDouble();
	 		URL image =new URL(el.getAsJsonObject().get("galleryURL").getAsJsonArray().get(0).getAsString());
	 		Date d = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(el.getAsJsonObject().get("listingInfo").getAsJsonArray().get(0).getAsJsonObject().get("startTime").getAsString());
	 		String id =  el.getAsJsonObject().get("itemId").getAsString();
	 		mp.setName(title);
	 		mp.setUrl(new URL(consultURL));
	 		mp.setPrice(price);
	 		mp.setType(type);
	 		mp.setShopName(getName());
	 		mp.setImage(image);
	 		mp.setDate(d);
	 		mp.setId(id);
	 		prices.add(mp);
	 	}

	}
	catch(Exception e)
	{
		logger.error(e);
	}
	return prices;
	}

Try With Resources try(JsonReader reader=new JsonReader(new InputStreamReader(new URL(link).openStream(),"UTF-8"))) in method public search(search String) : List<ShopItem> from class org.magic.api.shopping.impl.EbayShopper


	public MTGConsoleHandler() {
		history = new ArrayList<>();
	}

	public MTGConsoleHandler() {
		history = new ArrayList<String>();
	}

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public MTGConsoleHandler() from class org.magic.console.MTGConsoleHandler


	public DashBoardGUI2() {
		setBackground(SystemColor.activeCaption);

		logger.info("init Dashboard GUI");

		JMenuBar menuBar = new JMenuBar();
		menuBar.setBounds(0, 0, 84, 21);

		JMenu mnNewMenu = new JMenu(MTGControler.getInstance().getLangService().getCapitalize("ADD"));
		menuBar.add(mnNewMenu);

		JMenu mnWindow = new JMenu(MTGControler.getInstance().getLangService().getCapitalize("WINDOW"));
		menuBar.add(mnWindow);

		JMenuItem mntmSaveDisplay = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("SAVE_DISPLAY"));
		mntmSaveDisplay.addActionListener(ae-> {
				int i=0;

				try {
					FileUtils.cleanDirectory(AbstractJDashlet.confdir);
				} catch (IOException e1) {
					logger.error(e1);
				}

				for(JInternalFrame jif : getAllFrames())
				{
					i++;
					AbstractJDashlet dash = (AbstractJDashlet)jif;
									dash.save("x", String.valueOf(dash.getBounds().getX()));
									dash.save("y", String.valueOf(dash.getBounds().getY()));
									dash.save("w", String.valueOf(dash.getBounds().getWidth()));
									dash.save("h", String.valueOf(dash.getBounds().getHeight()));
									dash.save("class", dash.getClass().getName());
									dash.save("id", String.valueOf(i));
										File f = new File(AbstractJDashlet.confdir, i+".conf");

										try(FileOutputStream fos = new FileOutputStream(f))
										{
											dash.getProperties().store(fos,"");
										} catch (IOException e) {
											MTGLogger.printStackTrace(e);
										}
				}
		});

		mnWindow.add(mntmSaveDisplay);
		add(menuBar);

		try {
			for(AbstractJDashlet dash : MTGControler.getInstance().getDashlets())
			{
						JMenuItem mntmNewMenuItem = new JMenuItem(dash.getName());
						mntmNewMenuItem.addActionListener(e->{
								try {
									addDash(dash);
								}
								catch(Exception ex)
								{
									logger.error("Error Loading " + dash,ex);
								}
						});
						mnNewMenu.add(mntmNewMenuItem);
			}

		} catch (Exception e) {
			logger.error("Error",e);
		}

		if(!AbstractJDashlet.confdir.exists())
			AbstractJDashlet.confdir.mkdir();

		for(File f : AbstractJDashlet.confdir.listFiles())
		{
			try {
				Properties p = new Properties();
				FileInputStream fis = new FileInputStream(f);
				p.load(fis);
				AbstractJDashlet dash = (AbstractJDashlet)classLoader.loadClass(p.get("class").toString()).newInstance();
				dash.setProperties(p);
				fis.close();
				addDash(dash);

			} catch (Exception e) {
				logger.error("Could not add " + f,e);
			}
		}

	}

	public DashBoardGUI2() {
		setBackground(SystemColor.activeCaption);

		logger.info("init Dashboard GUI");

		JMenuBar menuBar = new JMenuBar();
		menuBar.setBounds(0, 0, 84, 21);

		JMenu mnNewMenu = new JMenu(MTGControler.getInstance().getLangService().getCapitalize("ADD"));
		menuBar.add(mnNewMenu);

		JMenu mnWindow = new JMenu(MTGControler.getInstance().getLangService().getCapitalize("WINDOW"));
		menuBar.add(mnWindow);

		JMenuItem mntmSaveDisplay = new JMenuItem(MTGControler.getInstance().getLangService().getCapitalize("SAVE_DISPLAY"));
		mntmSaveDisplay.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				int i=0;

				try {
					FileUtils.cleanDirectory(AbstractJDashlet.confdir);
				} catch (IOException e1) {
					logger.error(e1);
				}

				for(JInternalFrame jif : getAllFrames())
				{
					i++;
					AbstractJDashlet dash = (AbstractJDashlet)jif;
									dash.save("x", String.valueOf(dash.getBounds().getX()));
									dash.save("y", String.valueOf(dash.getBounds().getY()));
									dash.save("w", String.valueOf(dash.getBounds().getWidth()));
									dash.save("h", String.valueOf(dash.getBounds().getHeight()));
									dash.save("class", dash.getClass().getName());
									dash.save("id", String.valueOf(i));
									try {
										File f = new File(AbstractJDashlet.confdir, i+".conf");
										FileOutputStream fos = new FileOutputStream(f);
										dash.getProperties().store(fos,"");
										fos.close();
									} catch (Exception e) {
										MTGLogger.printStackTrace(e);
									}

				}

			}
		});

		mnWindow.add(mntmSaveDisplay);
		add(menuBar);

		try {
			for(AbstractJDashlet dash : MTGControler.getInstance().getDashlets())
			{
						JMenuItem mntmNewMenuItem = new JMenuItem(dash.getName());
						mntmNewMenuItem.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent e) {
								try {
									//dash = (AbstractJDashlet)classLoader.loadClass(c.getName()).newInstance();
									addDash(dash);
								}
								catch(Exception ex)
								{
									logger.error("Error Loading " + dash,ex);
								}
							}
						});
						mnNewMenu.add(mntmNewMenuItem);
			}

		} catch (Exception e) {
			logger.error("Error",e);
		}

		if(!AbstractJDashlet.confdir.exists())
			AbstractJDashlet.confdir.mkdir();

		for(File f : AbstractJDashlet.confdir.listFiles())
		{
			try {
				Properties p = new Properties();
				FileInputStream fis = new FileInputStream(f);
				p.load(fis);
				AbstractJDashlet dash = (AbstractJDashlet)classLoader.loadClass(p.get("class").toString()).newInstance();
				dash.setProperties(p);
				fis.close();
				addDash(dash);

			} catch (Exception e) {
				logger.error("Could not add " + f,e);
			}
		}

	}

Replace Anonymous With Lambda org.magic.gui.DashBoardGUI2.DashBoardGUI2.addActionListener.new ActionListener with ae -> {int i=0; in method public DashBoardGUI2() from class org.magic.gui.DashBoardGUI2


private Response searchcard(IHTTPSession session)
	{
	  try {
		  String att=session.getParameters().keySet().toArray()[0].toString();
		  String name=session.getParameters().get(session.getParameters().keySet().toArray()[0].toString()).get(0);

		  List<MagicCard> list = MTGControler.getInstance().getEnabledProviders().searchCardByCriteria(att, name, null,false);
		  try(Response resp = NanoHTTPD.newFixedLengthResponse(new Gson().toJson(list)))
		  {
			  resp.addHeader(contentHeader, contentType);
			  resp.addHeader("Item-count", String.valueOf(list.size()));
			  return resp;

		  }
	  }
	  catch (Exception e)
	  {
		  logger.error("ERROR",e);
		  return NanoHTTPD.newFixedLengthResponse("Usage : /search?att=value");
	  }
	}

private Response searchcard(IHTTPSession session)
	{
	  try {
		  String att=session.getParameters().keySet().toArray()[0].toString();
		  String name=session.getParameters().get(session.getParameters().keySet().toArray()[0].toString()).get(0);

		  List<MagicCard> list = MTGControler.getInstance().getEnabledProviders().searchCardByCriteria(att, name, null,false);
		  Response resp = NanoHTTPD.newFixedLengthResponse(new Gson().toJson(list));
		  resp.addHeader("Content-Type", "application/json");
		  resp.addHeader("Item-count", String.valueOf(list.size()));
		  return resp;
	  }
	  catch (Exception e)
	  {
		  logger.error("ERROR",e);
		  return NanoHTTPD.newFixedLengthResponse("Usage : /search?att=value");
	  }
	}

Try With Resources try(Response resp=NanoHTTPD.newFixedLengthResponse(new Gson().toJson(list))) in method private searchcard(session IHTTPSession) : Response from class org.magic.servers.impl.JSONHttpServer


private Response listCards(IHTTPSession session) {
   	 try {

   		 	String name=session.getParameters().get(session.getParameters().keySet().toArray()[0].toString()).get(0);
			String idset=session.getParameters().get(session.getParameters().keySet().toArray()[1].toString()).get(0);

			MagicCollection col = new MagicCollection(name);
			MagicEdition ed = new MagicEdition();
			ed.setId(idset);
			ed.setSet(idset);

			List<MagicCard> cards = MTGControler.getInstance().getEnabledDAO().getCardsFromCollection(col, ed);
			Collections.sort(cards,new MagicCardComparator());
			try(Response resp = NanoHTTPD.newFixedLengthResponse(new Gson().toJson(cards)))
			{
				resp.addHeader(contentHeader, contentType);
				resp.addHeader("Item-count", String.valueOf(cards.size()));
				return resp;

			}
	  }
	  catch (Exception e)
	  {
		  logger.error("ERROR",e);
		  return NanoHTTPD.newFixedLengthResponse("Usage : /cards?col=value&set=id");
	  }
	}

private Response listCards(IHTTPSession session) {
   	 try {
		 List<MagicCard> cards = new ArrayList<MagicCard>();

			 String att=session.getParameters().keySet().toArray()[0].toString();
			 String name=session.getParameters().get(session.getParameters().keySet().toArray()[0].toString()).get(0);

			 String att2=session.getParameters().keySet().toArray()[1].toString();
			 String idset=session.getParameters().get(session.getParameters().keySet().toArray()[1].toString()).get(0);

			 MagicCollection col = new MagicCollection(name);
			 MagicEdition ed = new MagicEdition();
			 ed.setId(idset);
			 ed.setSet(idset);

			 cards = MTGControler.getInstance().getEnabledDAO().getCardsFromCollection(col, ed);
			 Collections.sort(cards,new MagicCardComparator());
			 Response resp = NanoHTTPD.newFixedLengthResponse(new Gson().toJson(cards));
			 resp.addHeader("Content-Type", "application/json");
			 resp.addHeader("Item-count", String.valueOf(cards.size()));
		  return resp;
	  }
	  catch (Exception e)
	  {
		  logger.error("ERROR",e);
		  return NanoHTTPD.newFixedLengthResponse("Usage : /cards?col=value&set=id");
	  }
	}

Try With Resources try(Response resp=NanoHTTPD.newFixedLengthResponse(new Gson().toJson(cards))) in method private listCards(session IHTTPSession) : Response from class org.magic.servers.impl.JSONHttpServer


	public List<MagicPrice> getPrice(MagicEdition me,MagicCard card) throws IOException {

		list.clear();
		String html = props.getProperty("URL");

		if(me==null)
			me = card.getEditions().get(0);

		String url = html+format(findGoodEds(me.getSet()))+"/"+format(card.getName());
		Elements prices =null;
		Elements qualities = null;

		logger.info(getName() +" looking for prices " + url );
		try{
			doc = Jsoup.connect(url).userAgent(props.getProperty("USER_AGENT")).timeout(0).get();
			qualities = doc.select(".cardTypeList li");
			prices = doc.select(".stylePrice");

		}
		catch(Exception e)
		{
			logger.info(getName() +" no item : "+ e.getMessage());
			return list;
		}

		List<MagicPrice> list = new ArrayList<>();
		for(int i=0;i<qualities.size();i++)
		{
			 MagicPrice mp =new MagicPrice();

			 String price = prices.get(i).html().replaceAll("\\$", "");
			 mp.setValue(Double.parseDouble(price));
			 mp.setCurrency("$");
			 mp.setSeller("Card Kingdom");
			 mp.setSite(getName());
			 mp.setUrl(url);
			 mp.setQuality(qualities.get(i).html());
			 mp.setLanguage("English");

			 if(!qualities.get(i).hasClass("disabled"))
			 list.add(mp);
		}
		logger.info(getName() +" found " + list.size() +" item(s)" );
		return list;
	}

	public List<MagicPrice> getPrice(MagicEdition me,MagicCard card) throws IOException {

		list.clear();
		String html = props.getProperty("URL");

		if(me==null)
			me = card.getEditions().get(0);

		String url = html+format(findGoodEds(me.getSet()))+"/"+format(card.getName());
		Elements prices =null;
		Elements qualities = null;

		logger.info(getName() +" looking for prices " + url );
		try{
			doc = Jsoup.connect(url).userAgent(props.getProperty("USER_AGENT")).timeout(0).get();
			qualities = doc.select(".cardTypeList li");
			prices = doc.select(".stylePrice");

		}
		catch(Exception e)
		{
			logger.info(getName() +" no item : "+ e.getMessage());
			return list;
		}

		List<MagicPrice> list = new ArrayList<MagicPrice>();
		for(int i=0;i<qualities.size();i++)
		{
			 MagicPrice mp =new MagicPrice();

			 String price = prices.get(i).html().replaceAll("\\$", "");
			 mp.setValue(Double.parseDouble(price));
			 mp.setCurrency("$");
			 mp.setSeller("Card Kingdom");
			 mp.setSite(getName());
			 mp.setUrl(url);
			 mp.setQuality(qualities.get(i).html());
			 mp.setLanguage("English");

			 if(!qualities.get(i).hasClass("disabled"))
			 list.add(mp);
		}
		logger.info(getName() +" found " + list.size() +" item(s)" );
		return list;
	}

Replace Generic With Diamond ArrayList<MagicPrice> with ArrayList<> in method public getPrice(me MagicEdition, card MagicCard) : List<MagicPrice> from class org.magic.api.pricers.impl.CardKingdomPricer


	private MagicCard generateCard(JsonObject obj) throws Exception
	{
		MagicCard mc = new MagicCard();

			if(obj.get("name")!=null)
				mc.setName(obj.get("name").getAsString());

			if(obj.get("manaCost")!=null)
				mc.setCost(obj.get("manaCost").getAsString());

			if(obj.get("text")!=null)
				mc.setText(obj.get("text").getAsString());

			if(obj.get("originalText")!=null)
				mc.setOriginalText(obj.get("originalText").getAsString());

			if(obj.get("id")!=null)
				mc.setId(obj.get("id").getAsString());

			if(obj.get("artist")!=null)
				mc.setArtist(obj.get("artist").getAsString());

			if(obj.get("cmc")!=null)
				mc.setCmc(obj.get("cmc").getAsInt());

			if(obj.get("layout")!=null)
				mc.setLayout(obj.get("layout").getAsString());

//			if(obj.get("rarity")!=null)
//				mc.setRarity(obj.get("rarity").getAsString());

			if(obj.get("number")!=null)
				mc.setNumber(obj.get("number").getAsString());

			if(obj.get("power")!=null)
				mc.setPower(obj.get("power").getAsString());

			if(obj.get("toughness")!=null)
				mc.setToughness(obj.get("toughness").getAsString());

			if(obj.get("loyalty")!=null)
				mc.setLoyalty(obj.get("loyalty").getAsInt());

			if(obj.get("mciNumber")!=null)
		 		 mc.setMciNumber(String.valueOf(obj.get("mciNumber")));

			if(obj.get("colors")!=null){
				Iterator<JsonElement> it = obj.get("colors").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getColors().add(it.next().getAsString());
			}

			if(obj.get("types")!=null){
				Iterator<JsonElement> it = obj.get("types").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getTypes().add(it.next().getAsString());
			}

			if(obj.get("supertypes")!=null){
				Iterator<JsonElement> it = obj.get("supertypes").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getSupertypes().add(it.next().getAsString());
			}

			if(obj.get("subtypes")!=null){
				Iterator<JsonElement> it = obj.get("subtypes").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getSubtypes().add(it.next().getAsString());
			}

			if(obj.get("legalities")!=null){
				JsonArray arr = obj.get("legalities").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
					JsonObject k = arr.get(i).getAsJsonObject();
						MagicFormat format = new MagicFormat();
						format.setFormat(k.get("format").getAsString());
						format.setLegality(k.get("legality").getAsString());
						mc.getLegalities().add(format);
				}
			}

			if(obj.get("rulings")!=null){
				JsonArray arr = obj.get("rulings").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
					JsonObject k = arr.get(i).getAsJsonObject();
						MagicRuling rule = new MagicRuling();
						rule.setDate(k.get("date").getAsString());
						rule.setText(k.get("text").getAsString());
						mc.getRulings().add(rule);
				}
			}

			if(obj.get("names")!=null)
			{
				 JsonArray arr = obj.get("names").getAsJsonArray();

				 List<String> list = new ArrayList<>();
				 for (int i = 0; i < arr.size();list.add(arr.get(i++).getAsString()));

				 list.remove(mc.getName());

				 String rotateName=(list.get(list.size()-1)) ;
	 			 mc.setRotatedCardName(rotateName);

	 			 if(mc.getLayout().equals("flip"))
	 				 mc.setFlippable(true);
	 			 if(mc.getLayout().equals("double-faced") || mc.getLayout().equals("meld") )
	 				 mc.setTranformable(true);
			}

			String currentSet = obj.get("set").getAsString();
			MagicEdition currentEd = getSetById(currentSet);

			if(obj.get("multiverseid")!=null)
				currentEd.setMultiverse_id(obj.get("multiverseid").getAsString());

			if(obj.get("rarity")!=null)
				currentEd.setRarity(obj.get("rarity").getAsString());
				//currentEd.setRarity(mc.getRarity());

			currentEd.setNumber(mc.getNumber());

			mc.getEditions().add(0,currentEd);

			//TODO remove reprint information for basic lands
			 /*get other sets*/

			if(obj.get("printings")!=null){
				JsonArray arr = obj.get("printings").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
						String k = arr.get(i).getAsString();
						if(!k.equals(currentSet))
						{
							MagicEdition ed = getSetById(k);
							initOtherEdVariable(mc,ed);
							mc.getEditions().add(ed);
						}
				}
			}

				MagicCardNames defaultMcn = new MagicCardNames();
				defaultMcn.setName(mc.getName());
				defaultMcn.setLanguage("English");
				try{
					defaultMcn.setGathererId(Integer.parseInt(currentEd.getMultiverse_id()));
				}
				catch(Exception e)
				{
					defaultMcn.setGathererId(0);
				}

			mc.getForeignNames().add(defaultMcn);

			if(obj.get("foreignNames")!=null){
				JsonArray arr = obj.get("foreignNames").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
					JsonObject lang = arr.get(i).getAsJsonObject();
					MagicCardNames mcn = new MagicCardNames();
								mcn.setName(lang.get("name").getAsString());
								mcn.setLanguage(lang.get("language").getAsString());

								if(lang.get("multiverseid")!=null)
									mcn.setGathererId(lang.get("multiverseid").getAsInt());

								mc.getForeignNames().add(mcn);
				}
			}
		return mc;
	}

	private MagicCard generateCard(JsonObject obj) throws Exception
	{
		MagicCard mc = new MagicCard();

			if(obj.get("name")!=null)
				mc.setName(obj.get("name").getAsString());

			if(obj.get("manaCost")!=null)
				mc.setCost(obj.get("manaCost").getAsString());

			if(obj.get("text")!=null)
				mc.setText(obj.get("text").getAsString());

			if(obj.get("originalText")!=null)
				mc.setOriginalText(obj.get("originalText").getAsString());

			if(obj.get("id")!=null)
				mc.setId(obj.get("id").getAsString());

			if(obj.get("artist")!=null)
				mc.setArtist(obj.get("artist").getAsString());

			if(obj.get("cmc")!=null)
				mc.setCmc(obj.get("cmc").getAsInt());

			if(obj.get("layout")!=null)
				mc.setLayout(obj.get("layout").getAsString());

//			if(obj.get("rarity")!=null)
//				mc.setRarity(obj.get("rarity").getAsString());

			if(obj.get("number")!=null)
				mc.setNumber(obj.get("number").getAsString());

			if(obj.get("power")!=null)
				mc.setPower(obj.get("power").getAsString());

			if(obj.get("toughness")!=null)
				mc.setToughness(obj.get("toughness").getAsString());

			if(obj.get("loyalty")!=null)
				mc.setLoyalty(obj.get("loyalty").getAsInt());

			if(obj.get("mciNumber")!=null)
		 		 mc.setMciNumber(String.valueOf(obj.get("mciNumber")));

			if(obj.get("colors")!=null){
				Iterator<JsonElement> it = obj.get("colors").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getColors().add(it.next().getAsString());
			}

			if(obj.get("types")!=null){
				Iterator<JsonElement> it = obj.get("types").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getTypes().add(it.next().getAsString());
			}

			if(obj.get("supertypes")!=null){
				Iterator<JsonElement> it = obj.get("supertypes").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getSupertypes().add(it.next().getAsString());
			}

			if(obj.get("subtypes")!=null){
				Iterator<JsonElement> it = obj.get("subtypes").getAsJsonArray().iterator();
				while(it.hasNext())
					mc.getSubtypes().add(it.next().getAsString());
			}

			if(obj.get("legalities")!=null){
				JsonArray arr = obj.get("legalities").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
					JsonObject k = arr.get(i).getAsJsonObject();
						MagicFormat format = new MagicFormat();
						format.setFormat(k.get("format").getAsString());
						format.setLegality(k.get("legality").getAsString());
						mc.getLegalities().add(format);
				}
			}

			if(obj.get("rulings")!=null){
				JsonArray arr = obj.get("rulings").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
					JsonObject k = arr.get(i).getAsJsonObject();
						MagicRuling rule = new MagicRuling();
						rule.setDate(k.get("date").getAsString());
						rule.setText(k.get("text").getAsString());
						mc.getRulings().add(rule);
				}
			}

			if(obj.get("names")!=null)
			{
				 JsonArray arr = obj.get("names").getAsJsonArray();

				 List<String> list = new ArrayList<String>();
				 for (int i = 0; i < arr.size();list.add(arr.get(i++).getAsString()));

				 list.remove(mc.getName());

				 String rotateName=(list.get(list.size()-1)) ;
	 			 mc.setRotatedCardName(rotateName);

	 			 if(mc.getLayout().equals("flip"))
	 				 mc.setFlippable(true);
	 			 if(mc.getLayout().equals("double-faced") || mc.getLayout().equals("meld") )
	 				 mc.setTranformable(true);
			}

			String currentSet = obj.get("set").getAsString();
			MagicEdition currentEd = getSetById(currentSet);

			if(obj.get("multiverseid")!=null)
				currentEd.setMultiverse_id(obj.get("multiverseid").getAsString());

			if(obj.get("rarity")!=null)
				currentEd.setRarity(obj.get("rarity").getAsString());
				//currentEd.setRarity(mc.getRarity());

			currentEd.setNumber(mc.getNumber());

			mc.getEditions().add(0,currentEd);

			//TODO remove reprint information for basic lands
			 /*get other sets*/

			if(obj.get("printings")!=null){
				JsonArray arr = obj.get("printings").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
						String k = arr.get(i).getAsString();
						if(!k.equals(currentSet))
						{
							MagicEdition ed = getSetById(k);
							initOtherEdVariable(mc,ed);
							mc.getEditions().add(ed);
						}
				}
			}

				MagicCardNames defaultMcn = new MagicCardNames();
				defaultMcn.setName(mc.getName());
				defaultMcn.setLanguage("English");
				try{
					defaultMcn.setGathererId(Integer.parseInt(currentEd.getMultiverse_id()));
				}
				catch(Exception e)
				{
					defaultMcn.setGathererId(0);
				}

			mc.getForeignNames().add(defaultMcn);

			if(obj.get("foreignNames")!=null){
				JsonArray arr = obj.get("foreignNames").getAsJsonArray();
				for(int i=0;i<arr.size();i++)
				{
					JsonObject lang = arr.get(i).getAsJsonObject();
					MagicCardNames mcn = new MagicCardNames();
								mcn.setName(lang.get("name").getAsString());
								mcn.setLanguage(lang.get("language").getAsString());

								if(lang.get("multiverseid")!=null)
									mcn.setGathererId(lang.get("multiverseid").getAsInt());

								mc.getForeignNames().add(mcn);
				}
			}
		return mc;
	}

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private generateCard(obj JsonObject) : MagicCard from class org.magic.api.providers.impl.MagicTheGatheringIOProvider


	@Override
	public List<MagicEdition> loadEditions() throws Exception {
		if(cache.size()==0)
		{
			String url = jsonUrl+"/sets";
			String rootKey="sets";

				url = jsonUrl+"/sets";
				rootKey="sets";

				logger.info("connect to " + url);

			URLConnection con = getConnection(url);

			JsonReader reader= new JsonReader(new InputStreamReader(con.getInputStream(),"UTF-8"));
			JsonObject root = new JsonParser().parse(reader).getAsJsonObject();
			for(int i = 0;i<root.get(rootKey).getAsJsonArray().size();i++)
			{
				JsonObject e = root.get(rootKey).getAsJsonArray().get(i).getAsJsonObject();
				MagicEdition ed = generateEdition(e.getAsJsonObject());
				cache.put(ed.getId(), ed);
			}
		}
		return new ArrayList<>(cache.values());
	}

	@Override
	public List<MagicEdition> loadEditions() throws Exception {
		if(cache.size()==0)
		{
			String url = jsonUrl+"/sets";
			String rootKey="sets";

				url = jsonUrl+"/sets";
				rootKey="sets";

				logger.info("connect to " + url);

			URLConnection con = getConnection(url);

			JsonReader reader= new JsonReader(new InputStreamReader(con.getInputStream(),"UTF-8"));
			JsonObject root = new JsonParser().parse(reader).getAsJsonObject();
			for(int i = 0;i<root.get(rootKey).getAsJsonArray().size();i++)
			{
				JsonObject e = root.get(rootKey).getAsJsonArray().get(i).getAsJsonObject();
				MagicEdition ed = generateEdition(e.getAsJsonObject());
				cache.put(ed.getId(), ed);
			}
		}
		return new ArrayList<MagicEdition>(cache.values());
	}

Replace Generic With Diamond ArrayList<MagicEdition> with ArrayList<> in method public loadEditions() : List<MagicEdition> from class org.magic.api.providers.impl.MagicTheGatheringIOProvider