			@Override
			public boolean onInteract(final Player p, MultiBlock mb, final Block b) {

				SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("MAGIC_WORKBENCH");

				if (mb.isMultiBlock(machine)) {
					if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
						if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
							Dispenser disp = null;

							if (b.getRelative(1, 0, 0).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(1, 0, 0).getState();
							else if (b.getRelative(0, 0, 1).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(0, 0, 1).getState();
							else if (b.getRelative(-1, 0, 0).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(-1, 0, 0).getState();
							else if (b.getRelative(0, 0, -1).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(0, 0, -1).getState();

							final Inventory inv = disp.getInventory();
							List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);

							for (int i = 0; i < inputs.size(); i++) {
								boolean craft = true;
								for (int j = 0; j < inv.getContents().length; j++) {
									if (!SlimefunManager.isItemSimiliar(inv.getContents()[j], inputs.get(i)[j], true)) {
										if (SlimefunItem.getByItem(inputs.get(i)[j]) instanceof SlimefunBackpack) {
											if (!SlimefunManager.isItemSimiliar(inv.getContents()[j], inputs.get(i)[j], false)) {
												craft = false;
												break;
											}
										}
										else {
											craft = false;
											break;
										}
									}
								}

								if (craft) {
									final ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i)).clone();
									if (Slimefun.hasUnlocked(p, adding, true)) {
										Inventory inv2 = Bukkit.createInventory(null, 9, "test");
										for (int j = 0; j < inv.getContents().length; j++) {
											inv2.setItem(j, inv.getContents()[j] != null ? (inv.getContents()[j].getAmount() > 1 ? new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1): null): null);
										}
										if (InvUtils.fits(inv2, adding)) {
											SlimefunItem sfItem = SlimefunItem.getByItem(adding);

											if (sfItem instanceof SlimefunBackpack) {
												ItemStack backpack = null;

												for (int j = 0; j < 9; j++) {
													if (inv.getContents()[j] != null) {
														if (inv.getContents()[j].getType() != Material.AIR) {
															if (SlimefunItem.getByItem(inv.getContents()[j]) instanceof SlimefunBackpack) {
																backpack = inv.getContents()[j];
																break;
															}
														}
													}
												}
												String id = "";
												int size = ((SlimefunBackpack) sfItem).size;

												if (backpack != null) {
													for (String line: backpack.getItemMeta().getLore()) {
														if (line.startsWith(ChatColor.translateAlternateColorCodes('&', "&7ID: ")) && line.contains("#")) {
															id = line.replace(ChatColor.translateAlternateColorCodes('&', "&7ID: "), "");
															Config cfg = new Config(new File("data-storage/Slimefun/Players/" + id.split("#")[0] + ".yml"));
															cfg.setValue("backpacks." + id.split("#")[1] + ".size", size);
															cfg.save();
															break;
														}
													}
												}

												if (id.equals("")) {
													for (int line = 0; line < adding.getItemMeta().getLore().size(); line++) {
														if (adding.getItemMeta().getLore().get(line).equals(ChatColor.translateAlternateColorCodes('&', "&7ID: <ID>"))) {
															ItemMeta im = adding.getItemMeta();
															List<String> lore = im.getLore();
															lore.set(line, lore.get(line).replace("<ID>", Backpacks.createBackpack(p, size)));
															im.setLore(lore);
															adding.setItemMeta(im);
															break;
														}
													}
												}
												else {
													for (int line = 0; line < adding.getItemMeta().getLore().size(); line++) {
														if (adding.getItemMeta().getLore().get(line).equals(ChatColor.translateAlternateColorCodes('&', "&7ID: <ID>"))) {
															ItemMeta im = adding.getItemMeta();
															List<String> lore = im.getLore();
															lore.set(line, lore.get(line).replace("<ID>", id));
															im.setLore(lore);
															adding.setItemMeta(im);
															break;
														}
													}
												}
											}

											for (int j = 0; j < 9; j++) {
												if (inv.getContents()[j] != null) {
													if (inv.getContents()[j].getType() != Material.AIR) {
														if (inv.getContents()[j].getAmount() > 1) inv.setItem(j, new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1));
														else inv.setItem(j, null);
													}
												}
											}
											for (int j = 0; j < 4; j++) {
												int current = j;
												Bukkit.getScheduler().runTaskLater(SlimefunStartup.instance, () -> {
													p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
													p.getWorld().playEffect(b.getLocation(), Effect.ENDER_SIGNAL, 1);
													if (current < 3) {
														p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1F, 1F);
													} else {
														p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
														inv.addItem(adding);
													}
												}, j*20L);
											}
										}
										else Messages.local.sendTranslation(p, "machines.full-inventory", true);
									}
									return true;
								}
							}
							Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
						}
					}
					return true;
				}
				else return false;
			}

			@Override
			public boolean onInteract(final Player p, MultiBlock mb, final Block b) {

				SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("MAGIC_WORKBENCH");

				if (mb.isMultiBlock(machine)) {
					if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
						if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
							Dispenser disp = null;

							if (b.getRelative(1, 0, 0).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(1, 0, 0).getState();
							else if (b.getRelative(0, 0, 1).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(0, 0, 1).getState();
							else if (b.getRelative(-1, 0, 0).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(-1, 0, 0).getState();
							else if (b.getRelative(0, 0, -1).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(0, 0, -1).getState();

							final Inventory inv = disp.getInventory();
							List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);

							for (int i = 0; i < inputs.size(); i++) {
								boolean craft = true;
								for (int j = 0; j < inv.getContents().length; j++) {
									if (!SlimefunManager.isItemSimiliar(inv.getContents()[j], inputs.get(i)[j], true)) {
										if (SlimefunItem.getByItem(inputs.get(i)[j]) instanceof SlimefunBackpack) {
											if (!SlimefunManager.isItemSimiliar(inv.getContents()[j], inputs.get(i)[j], false)) {
												craft = false;
												break;
											}
										}
										else {
											craft = false;
											break;
										}
									}
								}

								if (craft) {
									final ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i)).clone();
									if (Slimefun.hasUnlocked(p, adding, true)) {
										Inventory inv2 = Bukkit.createInventory(null, 9, "test");
										for (int j = 0; j < inv.getContents().length; j++) {
											inv2.setItem(j, inv.getContents()[j] != null ? (inv.getContents()[j].getAmount() > 1 ? new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1): null): null);
										}
										if (InvUtils.fits(inv2, adding)) {
											SlimefunItem sfItem = SlimefunItem.getByItem(adding);

											if (sfItem instanceof SlimefunBackpack) {
												ItemStack backpack = null;

												for (int j = 0; j < 9; j++) {
													if (inv.getContents()[j] != null) {
														if (inv.getContents()[j].getType() != Material.AIR) {
															if (SlimefunItem.getByItem(inv.getContents()[j]) instanceof SlimefunBackpack) {
																backpack = inv.getContents()[j];
																break;
															}
														}
													}
												}
												String id = "";
												int size = ((SlimefunBackpack) sfItem).size;

												if (backpack != null) {
													for (String line: backpack.getItemMeta().getLore()) {
														if (line.startsWith(ChatColor.translateAlternateColorCodes('&', "&7ID: ")) && line.contains("#")) {
															id = line.replace(ChatColor.translateAlternateColorCodes('&', "&7ID: "), "");
															Config cfg = new Config(new File("data-storage/Slimefun/Players/" + id.split("#")[0] + ".yml"));
															cfg.setValue("backpacks." + id.split("#")[1] + ".size", size);
															cfg.save();
															break;
														}
													}
												}

												if (id.equals("")) {
													for (int line = 0; line < adding.getItemMeta().getLore().size(); line++) {
														if (adding.getItemMeta().getLore().get(line).equals(ChatColor.translateAlternateColorCodes('&', "&7ID: <ID>"))) {
															ItemMeta im = adding.getItemMeta();
															List<String> lore = im.getLore();
															lore.set(line, lore.get(line).replace("<ID>", Backpacks.createBackpack(p, size)));
															im.setLore(lore);
															adding.setItemMeta(im);
															break;
														}
													}
												}
												else {
													for (int line = 0; line < adding.getItemMeta().getLore().size(); line++) {
														if (adding.getItemMeta().getLore().get(line).equals(ChatColor.translateAlternateColorCodes('&', "&7ID: <ID>"))) {
															ItemMeta im = adding.getItemMeta();
															List<String> lore = im.getLore();
															lore.set(line, lore.get(line).replace("<ID>", id));
															im.setLore(lore);
															adding.setItemMeta(im);
															break;
														}
													}
												}
											}

											for (int j = 0; j < 9; j++) {
												if (inv.getContents()[j] != null) {
													if (inv.getContents()[j].getType() != Material.AIR) {
														if (inv.getContents()[j].getAmount() > 1) inv.setItem(j, new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1));
														else inv.setItem(j, null);
													}
												}
											}
											p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
											p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
											p.getWorld().playEffect(b.getLocation(), Effect.ENDER_SIGNAL, 1);
											new BukkitRunnable() {
												@Override
												public void run() {
													p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
													p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
													p.getWorld().playEffect(b.getLocation(), Effect.ENDER_SIGNAL, 1);
													new BukkitRunnable() {
														@Override
														public void run() {
															p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
															p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
															p.getWorld().playEffect(b.getLocation(), Effect.ENDER_SIGNAL, 1);
															new BukkitRunnable() {
																@Override
																public void run() {
																	p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
																	p.getWorld().playEffect(b.getLocation(), Effect.ENDER_SIGNAL, 1);
																	p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
																	inv.addItem(adding);
																}
															}.runTaskLater(SlimefunStartup.instance, 20L);
														}
													}.runTaskLater(SlimefunStartup.instance, 20L);
												}
											}.runTaskLater(SlimefunStartup.instance, 20L);
										}
										else Messages.local.sendTranslation(p, "machines.full-inventory", true);
									}
									return true;
								}
							}
							Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
						}
					}
					return true;
				}
				else return false;
			}

Replace Anonymous With Lambda me.mrCookieSlime.Slimefun.Setup.SlimefunSetup.setupItems.register.new MultiBlockInteractionHandler.onInteract.runTaskLater.new BukkitRunnable with () -> {p.getWorld().playEffect(b.getLocation(),Effect.MOBSPAWNER_FLAMES,1); in method public onInteract(p Player, mb MultiBlock, b Block) : boolean from class me.mrCookieSlime.Slimefun.Setup.SlimefunSetup.setupItems.register.new MultiBlockInteractionHandler


			@Override
			public boolean onRightClick(ItemUseEvent e, final Player p, ItemStack item) {
				if (e.getClickedBlock() != null) {
					SlimefunItem machine = BlockStorage.check(e.getClickedBlock());
					if (machine != null && machine.getID().equals("CRUCIBLE")) {
						if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
							final ItemStack input = p.getInventory().getItemInMainHand();
							final Block block = e.getClickedBlock().getRelative(BlockFace.UP);
							for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
								if (input != null && SlimefunManager.isItemSimiliar(input, convert, true)) {
									e.setCancelled(true);
									ItemStack removing = input.clone();
									removing.setAmount(convert.getAmount());
									p.getInventory().removeItem(removing);

									for (int i = 1; i < 9; i++) {
										int j = 8 - i;
										Bukkit.getScheduler().runTaskLater(SlimefunStartup.instance, () -> {
											if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
												block.setType(Material.LAVA);
												Levelled le = (Levelled) block.getBlockData();
												le.setLevel(j);
												block.setBlockData(le, false);
												block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
											} else if (MaterialHelper.isLeavesBlock(input.getType())) {
												block.setType(Material.WATER);
												Levelled le = (Levelled) block.getBlockData();
												le.setLevel(j);
												block.setBlockData(le, false);
												block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
											}
										}, i*50L);
									}

									return true;
								}
							}
							Messages.local.sendTranslation(p, "machines.wrong-item", true);
							return true;
						}
						return true;
					}
				}
				return false;
			}

			@Override
			public boolean onRightClick(ItemUseEvent e, final Player p, ItemStack item) {
				if (e.getClickedBlock() != null) {
					SlimefunItem machine = BlockStorage.check(e.getClickedBlock());
					if (machine != null && machine.getID().equals("CRUCIBLE")) {
						if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
							final ItemStack input = p.getInventory().getItemInMainHand();
							final Block block = e.getClickedBlock().getRelative(BlockFace.UP);
							for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
								if (input != null) {
									if (SlimefunManager.isItemSimiliar(input, convert, true)) {
										e.setCancelled(true);
										ItemStack removing = input.clone();
										removing.setAmount(convert.getAmount());
										p.getInventory().removeItem(removing);

										new BukkitRunnable() {

											@Override
											public void run() {
												if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
													block.setType(Material.LAVA);
													Levelled le = (Levelled) block.getBlockData();
													le.setLevel(7);
													block.setBlockData(le, false);
													block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
												}
												else if (MaterialHelper.isLeavesBlock(input.getType())) {
													block.setType(Material.WATER);
													Levelled le = (Levelled) block.getBlockData();
													le.setLevel(7);
													block.setBlockData(le, false);
													block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
												}
												new BukkitRunnable() {

													@Override
													public void run() {
														if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
															block.setType(Material.LAVA);
															Levelled le = (Levelled) block.getBlockData();
															le.setLevel(6);
															block.setBlockData(le, false);
															block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
														}
														else if (MaterialHelper.isLeavesBlock(input.getType())) {
															block.setType(Material.WATER);
															Levelled le = (Levelled) block.getBlockData();
															le.setLevel(6);
															block.setBlockData(le, false);
															block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
														}
														new BukkitRunnable() {

															@Override
															public void run() {
																if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
																	block.setType(Material.LAVA);
																	Levelled le = (Levelled) block.getBlockData();
																	le.setLevel(5);
																	block.setBlockData(le, false);
																	block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
																}
																else if (MaterialHelper.isLeavesBlock(input.getType())) {
																	block.setType(Material.WATER);
																	Levelled le = (Levelled) block.getBlockData();
																	le.setLevel(5);
																	block.setBlockData(le, false);
																	block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
																}
																new BukkitRunnable() {

																	@Override
																	public void run() {
																		if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
																			block.setType(Material.LAVA);
																			Levelled le = (Levelled) block.getBlockData();
																			le.setLevel(4);
																			block.setBlockData(le, false);
																			block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
																		}
																		else if (MaterialHelper.isLeavesBlock(input.getType())) {
																			block.setType(Material.WATER);
																			Levelled le = (Levelled) block.getBlockData();
																			le.setLevel(4);
																			block.setBlockData(le, false);
																			block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
																		}
																		new BukkitRunnable() {

																			@Override
																			public void run() {
																				if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
																					block.setType(Material.LAVA);
																					Levelled le = (Levelled) block.getBlockData();
																					le.setLevel(3);
																					block.setBlockData(le, false);
																					block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
																				}
																				else if (MaterialHelper.isLeavesBlock(input.getType())) {
																					block.setType(Material.WATER);
																					Levelled le = (Levelled) block.getBlockData();
																					le.setLevel(3);
																					block.setBlockData(le, false);
																					block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
																				}
																				new BukkitRunnable() {

																					@Override
																					public void run() {
																						if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
																							block.setType(Material.LAVA);
																							Levelled le = (Levelled) block.getBlockData();
																							le.setLevel(2);
																							block.setBlockData(le, false);
																							block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
																						}
																						else if (MaterialHelper.isLeavesBlock(input.getType())) {
																							block.setType(Material.WATER);
																							Levelled le = (Levelled) block.getBlockData();
																							le.setLevel(2);
																							block.setBlockData(le, false);
																							block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
																						}
																						new BukkitRunnable() {

																							@Override
																							public void run() {
																								if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
																									block.setType(Material.LAVA);
																									Levelled le = (Levelled) block.getBlockData();
																									le.setLevel(1);
																									block.setBlockData(le, false);
																									block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
																								}
																								else if (MaterialHelper.isLeavesBlock(input.getType())) {
																									block.setType(Material.WATER);
																									Levelled le = (Levelled) block.getBlockData();
																									le.setLevel(1);
																									block.setBlockData(le, false);
																									block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
																								}
																								new BukkitRunnable() {

																									@Override
																									public void run() {
																										if (input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())) {
																											block.setType(Material.LAVA);
																											Levelled le = (Levelled) block.getBlockData();
																											le.setLevel(0);
																											block.setBlockData(le);
																											block.getWorld().playSound(block.getLocation(), Sound.BLOCK_LAVA_POP, 1F, 1F);
																										}
																										else if (MaterialHelper.isLeavesBlock(input.getType())) {
																											block.setType(Material.WATER);
																											Levelled le = (Levelled) block.getBlockData();
																											le.setLevel(0);
																											block.setBlockData(le, false);
																											block.getWorld().playSound(block.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
																										}
																									}
																								}.runTaskLater(SlimefunStartup.instance, 50L);
																							}
																						}.runTaskLater(SlimefunStartup.instance, 50L);
																					}
																				}.runTaskLater(SlimefunStartup.instance, 50L);
																			}
																		}.runTaskLater(SlimefunStartup.instance, 50L);
																	}
																}.runTaskLater(SlimefunStartup.instance, 50L);
															}
														}.runTaskLater(SlimefunStartup.instance, 50L);
													}
												}.runTaskLater(SlimefunStartup.instance, 50L);
											}
										}.runTaskLater(SlimefunStartup.instance, 50L);
										return true;
									}
								}
							}
							Messages.local.sendTranslation(p, "machines.wrong-item", true);
							return true;
						}
						return true;
					}
				}
				return false;
			}

Replace Anonymous With Lambda me.mrCookieSlime.Slimefun.Setup.SlimefunSetup.setupItems.register.new ItemInteractionHandler.onRightClick.runTaskLater.new BukkitRunnable with () -> {if(input.getType() == Material.COBBLESTONE || input.getType() == Material.TERRACOTTA || MaterialHelper.isTerracotta(input.getType())){block.setType(Material.LAVA); in method public onRightClick(e ItemUseEvent, p Player, item ItemStack) : boolean from class me.mrCookieSlime.Slimefun.Setup.SlimefunSetup.setupItems.register.new ItemInteractionHandler


			@Override
			public void extraTick(final Location l) {
				Bukkit.getScheduler().runTaskLater(SlimefunStartup.instance, () -> {
					for (Entity entity : ReactorHologram.getArmorStand(l).getNearbyEntities(5, 5, 5)) {
						if (entity instanceof LivingEntity) {
							((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
						}
					}
				}, 0L);
			}

			@Override
			public void extraTick(final Location l) {
				new BukkitRunnable() {
					@Override
					public void run() {
						for (Entity entity : ReactorHologram.getArmorStand(l).getNearbyEntities(5, 5, 5)) {
							if (entity instanceof LivingEntity) {
								((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
							}
						}
					}
				}.runTaskLater(SlimefunStartup.instance, 0L);
			}

Replace Anonymous With Lambda me.mrCookieSlime.Slimefun.Setup.SlimefunSetup.setupItems.registerChargeableBlock.new AReactor.extraTick.runTaskLater.new BukkitRunnable with () -> {for(Entity entity: ReactorHologram.getArmorStand(l).getNearbyEntities(5,5,5)){if(entity instanceof LivingEntity){((LivingEntity)entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER,60,1)); in method public extraTick(l Location) : void from class me.mrCookieSlime.Slimefun.Setup.SlimefunSetup.setupItems.registerChargeableBlock.new AReactor


	@SuppressWarnings("deprecation")
	@Override
	public void onEnable() {
		CSCoreLibLoader loader = new CSCoreLibLoader(this);
		if (loader.load()) {

			String currentVersion = ReflectionUtils.getVersion();

			if (currentVersion.startsWith("v")) {
				boolean compatibleVersion = false;
				StringBuilder versions = new StringBuilder();

				int i = 0;
				for (String version: supported) {
					if (currentVersion.startsWith(version)) {
						compatibleVersion = true;
					}

					if (i == 0) versions.append(version.substring(1).replaceFirst("_", ".").replace("_", ".X"));
					else if (i == supported.length - 1) versions.append(" or " + version.substring(1).replaceFirst("_", ".").replace("_", ".X"));
					else versions.append(", " + version.substring(1).replaceFirst("_", ".").replace("_", ".X"));

					i++;
				}

				// Looks like you are using an unsupported Minecraft Version
				if (!compatibleVersion) {
					System.err.println("### Slimefun failed to load!");
					System.err.println("###");
					System.err.println("### You are using the wrong Version of Minecraft!!!");
					System.err.println("###");
					System.err.println("### You are using Minecraft " + ReflectionUtils.getVersion());
					System.err.println("### but Slimefun v" + getDescription().getVersion() + " requires you to be using");
					System.err.println("### Minecraft " + versions.toString());
					System.err.println("###");
					System.err.println("### Please use an older Version of Slimefun and disable auto-updating");
					System.err.println("### or consider updating your Server Software.");
					getServer().getPluginManager().disablePlugin(this);
					return;
				}
			}

			instance = this;
			System.out.println("[Slimefun] Loading Files...");
			Files.cleanup();

			System.out.println("[Slimefun] Loading Config...");

			utils = new PluginUtils(this);
			utils.setupConfig();

			// Loading all extra configs
			researches = new Config(Files.RESEARCHES);
			items = new Config(Files.ITEMS);
			whitelist = new Config(Files.WHITELIST);

			// Init Config, Updater, Metrics and messages.yml
			utils.setupUpdater(53485, getFile());
			utils.setupMetrics();
			utils.setupLocalization();
			config = utils.getConfig();
			Messages.local = utils.getLocalization();
			Messages.setup();

			// Creating all necessary Folders
			// TODO: Make a shortcut method such as createDir(path)
			if (!new File("data-storage/Slimefun/blocks").exists()) new File("data-storage/Slimefun/blocks").mkdirs();
			if (!new File("data-storage/Slimefun/stored-blocks").exists()) new File("data-storage/Slimefun/stored-blocks").mkdirs();
			if (!new File("data-storage/Slimefun/stored-inventories").exists()) new File("data-storage/Slimefun/stored-inventories").mkdirs();
			if (!new File("data-storage/Slimefun/stored-chunks").exists()) new File("data-storage/Slimefun/stored-chunks").mkdirs();
			if (!new File("data-storage/Slimefun/universal-inventories").exists()) new File("data-storage/Slimefun/universal-inventories").mkdirs();
			if (!new File("data-storage/Slimefun/waypoints").exists()) new File("data-storage/Slimefun/waypoints").mkdirs();
			if (!new File("data-storage/Slimefun/block-backups").exists()) new File("data-storage/Slimefun/block-backups").mkdirs();
			if (!new File("plugins/Slimefun/scripts").exists()) new File("plugins/Slimefun/scripts").mkdirs();
			if (!new File("plugins/Slimefun/generators").exists()) new File("plugins/Slimefun/generators").mkdirs();
			if (!new File("plugins/Slimefun/error-reports").exists()) new File("plugins/Slimefun/error-reports").mkdirs();
			if (!new File("plugins/Slimefun/cache/github").exists()) new File("plugins/Slimefun/cache/github").mkdirs();

			SlimefunManager.plugin = this;

			System.out.println("[Slimefun] Loading Items...");
			MiscSetup.setupItemSettings();
			try {
				SlimefunSetup.setupItems();
			} catch (Exception e1) {
				e1.printStackTrace();
			}
			MiscSetup.loadDescriptions();

			System.out.println("[Slimefun] Loading Researches...");
			Research.enabled = getResearchCfg().getBoolean("enable-researching");
			ResearchSetup.setupResearches();

			MiscSetup.setupMisc();

			BlockStorage.info_delay = config.getInt("URID.info-delay");

			System.out.println("[Slimefun] Loading World Generators...");

			// Generating Oil as an OreGenResource (its a cool API)
			OreGenSystem.registerResource(new OilResource());
			OreGenSystem.registerResource(new NetherIceResource());

			// Setting up GitHub Connectors...

			GitHubSetup.setup();

			// All Slimefun Listeners
			new ArmorListener(this);
			new ItemListener(this);
			new BlockListener(this);
			new GearListener(this);
			new AutonomousToolsListener(this);
			new DamageListener(this);
			new BowListener(this);
			new ToolListener(this);
			new FurnaceListener(this);
			new TeleporterListener(this);
			new AndroidKillingListener(this);
			new NetworkListener(this);
			if (currentVersion.startsWith("v1_12_")) new ItemPickupListener_1_12(this);
			else new ItemPickupListener(this);

			// Toggleable Listeners for performance
			if (config.getBoolean("items.talismans")) new TalismanListener(this);
			if (config.getBoolean("items.backpacks")) new BackpackListener(this);
			if (config.getBoolean("items.coolers")) new CoolerListener(this);

			// Handle Slimefun Guide being given on Join
			// TODO: Move it to its own class, was too lazy
			if (config.getBoolean("options.give-guide-on-first-join")) {
				getServer().getPluginManager().registerEvents(new Listener() {

					@EventHandler
					public void onJoin(PlayerJoinEvent e) {
						if (!e.getPlayer().hasPlayedBefore()) {
							Player p = e.getPlayer();
							if (!getWhitelist().getBoolean(p.getWorld().getName() + ".enabled")) return;
							if (!getWhitelist().getBoolean(p.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE")) return;

							if (config.getBoolean("guide.default-view-book")) p.getInventory().addItem(SlimefunGuide.getItem(BookDesign.BOOK));
							else p.getInventory().addItem(SlimefunGuide.getItem(BookDesign.CHEST));
						}
					}

				}, this);
			}

			// Load/Unload Worlds in Slimefun
			// TODO: Move it to its own class, was too lazy
			getServer().getPluginManager().registerEvents(new Listener() {

				@EventHandler
				public void onWorldLoad(WorldLoadEvent e) {
					BlockStorage.getForcedStorage(e.getWorld());

					SlimefunStartup.getWhitelist().setDefaultValue(e.getWorld().getName() + ".enabled", true);
					SlimefunStartup.getWhitelist().setDefaultValue(e.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE", true);
					SlimefunStartup.getWhitelist().save();
				}

				@EventHandler
				public void onWorldUnload(WorldUnloadEvent e) {
					BlockStorage storage = BlockStorage.getStorage(e.getWorld());
					if (storage != null) storage.save(true);
					else System.err.println("[Slimefun] Could not save Slimefun Blocks for World \"" + e.getWorld().getName() + "\"");
				}

			}, this);

			// Clear the Slimefun Guide History upon Player Leaving
			// TODO: Move it to its own class, was too lazy
			getServer().getPluginManager().registerEvents(new Listener() {

				@EventHandler
				public void onDisconnect(PlayerQuitEvent e) {
					SlimefunGuide.history.remove(e.getPlayer().getUniqueId());
				}

			}, this);

			// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
			getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
				Slimefun.emeraldenchants = getServer().getPluginManager().isPluginEnabled("EmeraldEnchants");
				SlimefunGuide.all_recipes = config.getBoolean("options.show-vanilla-recipes-in-guide");
				MiscSetup.loadItems();

				for (World world: Bukkit.getWorlds()) {
					new BlockStorage(world);
				}

				if (SlimefunItem.getByID("ANCIENT_ALTAR") != null) new AncientAltarListener((SlimefunStartup) instance);
			}, 0);

			// WorldEdit Hook to clear Slimefun Data upon //set 0 //cut or any other equivalent
			if (getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
				try {
					Class.forName("com.sk89q.worldedit.extent.Extent");
					new WESlimefunManager();
					System.out.println("[Slimefun] Successfully hooked into WorldEdit!");
				} catch (Exception x) {
					System.err.println("[Slimefun] Failed to hook into WorldEdit!");
					System.err.println("[Slimefun] Maybe consider updating WorldEdit or Slimefun?");
				}
			}

			getCommand("slimefun").setExecutor(new SlimefunCommand(this));
			getCommand("slimefun").setTabCompleter(new SlimefunTabCompleter());

			// Armor Update Task
			if (config.getBoolean("options.enable-armor-effects")) {
				getServer().getScheduler().runTaskTimer(this, () -> {
					for (Player p: Bukkit.getOnlinePlayers()) {
						for (ItemStack armor: p.getInventory().getArmorContents()) {
							if (armor != null) {
								if (Slimefun.hasUnlocked(p, armor, true)) {
									if (SlimefunItem.getByItem(armor) instanceof SlimefunArmorPiece) {
										for (PotionEffect effect: ((SlimefunArmorPiece) SlimefunItem.getByItem(armor)).getEffects()) {
											p.removePotionEffect(effect.getType());
											p.addPotionEffect(effect);
										}
									}
									if (SlimefunManager.isItemSimiliar(armor, SlimefunItem.getItem("SOLAR_HELMET"), false)) {
										if (p.getWorld().getTime() < 12300 || p.getWorld().getTime() > 23850) {
											if (p.getEyeLocation().getBlock().getLightFromSky() == 15) {
												ItemEnergy.chargeInventory(p, Float.valueOf(String.valueOf(Slimefun.getItemValue("SOLAR_HELMET", "charge-amount"))));
											}
										}
									}
								}
							}
						}

						for (ItemStack radioactive: SlimefunItem.radioactive) {
							if (p.getInventory().containsAtLeast(radioactive, 1) || SlimefunManager.isItemSimiliar(p.getInventory().getItemInOffHand(), radioactive, true)) {
								// Check if player is wearing the hazmat suit
								// If so, break the loop
								if (SlimefunManager.isItemSimiliar(SlimefunItems.SCUBA_HELMET, p.getInventory().getHelmet(), true) &&
									SlimefunManager.isItemSimiliar(SlimefunItems.HAZMATSUIT_CHESTPLATE, p.getInventory().getChestplate(), true) &&
									SlimefunManager.isItemSimiliar(SlimefunItems.HAZMATSUIT_LEGGINGS, p.getInventory().getLeggings(), true) &&
									SlimefunManager.isItemSimiliar(SlimefunItems.RUBBER_BOOTS, p.getInventory().getBoots(), true)) {
									break;
								}

								// If the item is enabled in the world, then make radioactivity do its job
								if (Slimefun.isEnabled(p, radioactive, false)) {
									p.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 400, 3));
									p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 400, 3));
									p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 3));
									p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 400, 3));
									p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 400, 1));
									p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 400, 1));
									p.setFireTicks(400);
									break; // Break the loop to save some calculations
								}
							}
						}
					}
				}, 0L, config.getInt("options.armor-update-interval") * 20L);
			}

			ticker = new TickerTask();

			// Starting all ASYNC Tasks
			getServer().getScheduler().scheduleAsyncRepeatingTask(this, new AutoSavingTask(), 1200L, config.getInt("options.auto-save-delay-in-minutes") * 60L * 20L);
			getServer().getScheduler().scheduleAsyncRepeatingTask(this, ticker, 100L, config.getInt("URID.custom-ticker-delay"));

			getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {

				@Override
				public void run() {
					for (GitHubConnector connector: GitHubConnector.connectors) {
						connector.pullFile();
					}
				}
			}, 80L, 60 * 60 * 20L);

			// Hooray!
			System.out.println("[Slimefun] Finished!");

			clearlag = getServer().getPluginManager().isPluginEnabled("ClearLag");

			coreProtect = getServer().getPluginManager().isPluginEnabled("CoreProtect");

            Bukkit.getScheduler().scheduleSyncDelayedTask(this, new BukkitRunnable() {
                @Override
                public void run() {
                    exoticGarden = getServer().getPluginManager().isPluginEnabled("ExoticGarden"); // Had to do it this way, otherwise it seems disabled.
                }
            }, 0);

			if (clearlag) new ClearLaggIntegration(this);

			if (coreProtect) coreProtectAPI = ((CoreProtect)getServer().getPluginManager().getPlugin("CoreProtect")).getAPI();

			Research.creative_research = config.getBoolean("options.allow-free-creative-research");

			AutoEnchanter.max_emerald_enchantments = config.getInt("options.emerald-enchantment-limit");

			SlimefunSetup.legacy_ore_washer = config.getBoolean("options.legacy-ore-washer");
			ElectricDustWasher.legacy_dust_washer = config.getBoolean("options.legacy-dust-washer");

			// Do not show /sf elevator command in our Log, it could get quite spammy
			CSCoreLib.getLib().filterLog("([A-Za-z0-9_]{3,16}) issued server command: /sf elevator (.{0,})");
		}
	}

	@SuppressWarnings("deprecation")
	@Override
	public void onEnable() {
		CSCoreLibLoader loader = new CSCoreLibLoader(this);
		if (loader.load()) {

			String currentVersion = ReflectionUtils.getVersion();

			if (currentVersion.startsWith("v")) {
				boolean compatibleVersion = false;
				StringBuilder versions = new StringBuilder();

				int i = 0;
				for (String version: supported) {
					if (currentVersion.startsWith(version)) {
						compatibleVersion = true;
					}

					if (i == 0) versions.append(version.substring(1).replaceFirst("_", ".").replace("_", ".X"));
					else if (i == supported.length - 1) versions.append(" or " + version.substring(1).replaceFirst("_", ".").replace("_", ".X"));
					else versions.append(", " + version.substring(1).replaceFirst("_", ".").replace("_", ".X"));

					i++;
				}

				// Looks like you are using an unsupported Minecraft Version
				if (!compatibleVersion) {
					System.err.println("### Slimefun failed to load!");
					System.err.println("###");
					System.err.println("### You are using the wrong Version of Minecraft!!!");
					System.err.println("###");
					System.err.println("### You are using Minecraft " + ReflectionUtils.getVersion());
					System.err.println("### but Slimefun v" + getDescription().getVersion() + " requires you to be using");
					System.err.println("### Minecraft " + versions.toString());
					System.err.println("###");
					System.err.println("### Please use an older Version of Slimefun and disable auto-updating");
					System.err.println("### or consider updating your Server Software.");
					getServer().getPluginManager().disablePlugin(this);
					return;
				}
			}

			instance = this;
			System.out.println("[Slimefun] Loading Files...");
			Files.cleanup();

			System.out.println("[Slimefun] Loading Config...");

			utils = new PluginUtils(this);
			utils.setupConfig();

			// Loading all extra configs
			researches = new Config(Files.RESEARCHES);
			items = new Config(Files.ITEMS);
			whitelist = new Config(Files.WHITELIST);

			// Init Config, Updater, Metrics and messages.yml
			utils.setupUpdater(53485, getFile());
			utils.setupMetrics();
			utils.setupLocalization();
			config = utils.getConfig();
			Messages.local = utils.getLocalization();
			Messages.setup();

			// Creating all necessary Folders
			// TODO: Make a shortcut method such as createDir(path)
			if (!new File("data-storage/Slimefun/blocks").exists()) new File("data-storage/Slimefun/blocks").mkdirs();
			if (!new File("data-storage/Slimefun/stored-blocks").exists()) new File("data-storage/Slimefun/stored-blocks").mkdirs();
			if (!new File("data-storage/Slimefun/stored-inventories").exists()) new File("data-storage/Slimefun/stored-inventories").mkdirs();
			if (!new File("data-storage/Slimefun/stored-chunks").exists()) new File("data-storage/Slimefun/stored-chunks").mkdirs();
			if (!new File("data-storage/Slimefun/universal-inventories").exists()) new File("data-storage/Slimefun/universal-inventories").mkdirs();
			if (!new File("data-storage/Slimefun/waypoints").exists()) new File("data-storage/Slimefun/waypoints").mkdirs();
			if (!new File("data-storage/Slimefun/block-backups").exists()) new File("data-storage/Slimefun/block-backups").mkdirs();
			if (!new File("plugins/Slimefun/scripts").exists()) new File("plugins/Slimefun/scripts").mkdirs();
			if (!new File("plugins/Slimefun/generators").exists()) new File("plugins/Slimefun/generators").mkdirs();
			if (!new File("plugins/Slimefun/error-reports").exists()) new File("plugins/Slimefun/error-reports").mkdirs();
			if (!new File("plugins/Slimefun/cache/github").exists()) new File("plugins/Slimefun/cache/github").mkdirs();

			SlimefunManager.plugin = this;

			System.out.println("[Slimefun] Loading Items...");
			MiscSetup.setupItemSettings();
			try {
				SlimefunSetup.setupItems();
			} catch (Exception e1) {
				e1.printStackTrace();
			}
			MiscSetup.loadDescriptions();

			System.out.println("[Slimefun] Loading Researches...");
			Research.enabled = getResearchCfg().getBoolean("enable-researching");
			ResearchSetup.setupResearches();

			MiscSetup.setupMisc();

			BlockStorage.info_delay = config.getInt("URID.info-delay");

			System.out.println("[Slimefun] Loading World Generators...");

			// Generating Oil as an OreGenResource (its a cool API)
			OreGenSystem.registerResource(new OilResource());
			OreGenSystem.registerResource(new NetherIceResource());

			// Setting up GitHub Connectors...

			GitHubSetup.setup();

			// All Slimefun Listeners
			new ArmorListener(this);
			new ItemListener(this);
			new BlockListener(this);
			new GearListener(this);
			new AutonomousToolsListener(this);
			new DamageListener(this);
			new BowListener(this);
			new ToolListener(this);
			new FurnaceListener(this);
			new TeleporterListener(this);
			new AndroidKillingListener(this);
			new NetworkListener(this);
			if (currentVersion.startsWith("v1_12_")) new ItemPickupListener_1_12(this);
			else new ItemPickupListener(this);

			// Toggleable Listeners for performance
			if (config.getBoolean("items.talismans")) new TalismanListener(this);
			if (config.getBoolean("items.backpacks")) new BackpackListener(this);
			if (config.getBoolean("items.coolers")) new CoolerListener(this);

			// Handle Slimefun Guide being given on Join
			// TODO: Move it to its own class, was too lazy
			if (config.getBoolean("options.give-guide-on-first-join")) {
				getServer().getPluginManager().registerEvents(new Listener() {

					@EventHandler
					public void onJoin(PlayerJoinEvent e) {
						if (!e.getPlayer().hasPlayedBefore()) {
							Player p = e.getPlayer();
							if (!getWhitelist().getBoolean(p.getWorld().getName() + ".enabled")) return;
							if (!getWhitelist().getBoolean(p.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE")) return;

							if (config.getBoolean("guide.default-view-book")) p.getInventory().addItem(SlimefunGuide.getItem(BookDesign.BOOK));
							else p.getInventory().addItem(SlimefunGuide.getItem(BookDesign.CHEST));
						}
					}

				}, this);
			}

			// Load/Unload Worlds in Slimefun
			// TODO: Move it to its own class, was too lazy
			getServer().getPluginManager().registerEvents(new Listener() {

				@EventHandler
				public void onWorldLoad(WorldLoadEvent e) {
					BlockStorage.getForcedStorage(e.getWorld());

					SlimefunStartup.getWhitelist().setDefaultValue(e.getWorld().getName() + ".enabled", true);
					SlimefunStartup.getWhitelist().setDefaultValue(e.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE", true);
					SlimefunStartup.getWhitelist().save();
				}

				@EventHandler
				public void onWorldUnload(WorldUnloadEvent e) {
					BlockStorage storage = BlockStorage.getStorage(e.getWorld());
					if (storage != null) storage.save(true);
					else System.err.println("[Slimefun] Could not save Slimefun Blocks for World \"" + e.getWorld().getName() + "\"");
				}

			}, this);

			// Clear the Slimefun Guide History upon Player Leaving
			// TODO: Move it to its own class, was too lazy
			getServer().getPluginManager().registerEvents(new Listener() {

				@EventHandler
				public void onDisconnect(PlayerQuitEvent e) {
					if (SlimefunGuide.history.containsKey(e.getPlayer().getUniqueId())) SlimefunGuide.history.remove(e.getPlayer().getUniqueId());
				}

			}, this);

			// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
			getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
				@Override
				public void run() {
					Slimefun.emeraldenchants = getServer().getPluginManager().isPluginEnabled("EmeraldEnchants");
					SlimefunGuide.all_recipes = config.getBoolean("options.show-vanilla-recipes-in-guide");
					MiscSetup.loadItems();

					for (World world: Bukkit.getWorlds()) {
						new BlockStorage(world);
					}

					if (SlimefunItem.getByID("ANCIENT_ALTAR") != null) new AncientAltarListener((SlimefunStartup) instance);
				}
			}, 0);

			// WorldEdit Hook to clear Slimefun Data upon //set 0 //cut or any other equivalent
			if (getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
				try {
					Class.forName("com.sk89q.worldedit.extent.Extent");
					new WESlimefunManager();
					System.out.println("[Slimefun] Successfully hooked into WorldEdit!");
				} catch (Exception x) {
					System.err.println("[Slimefun] Failed to hook into WorldEdit!");
					System.err.println("[Slimefun] Maybe consider updating WorldEdit or Slimefun?");
				}
			}

			getCommand("slimefun").setExecutor(new SlimefunCommand(this));
			getCommand("slimefun").setTabCompleter(new SlimefunTabCompleter());

			// Armor Update Task
			if (config.getBoolean("options.enable-armor-effects")) {
				getServer().getScheduler().runTaskTimer(this, new Runnable() {

					@Override
					public void run() {
						for (Player p: Bukkit.getOnlinePlayers()) {
							for (ItemStack armor: p.getInventory().getArmorContents()) {
								if (armor != null) {
									if (Slimefun.hasUnlocked(p, armor, true)) {
										if (SlimefunItem.getByItem(armor) instanceof SlimefunArmorPiece) {
											for (PotionEffect effect: ((SlimefunArmorPiece) SlimefunItem.getByItem(armor)).getEffects()) {
												p.removePotionEffect(effect.getType());
												p.addPotionEffect(effect);
											}
										}
										if (SlimefunManager.isItemSimiliar(armor, SlimefunItem.getItem("SOLAR_HELMET"), false)) {
											if (p.getWorld().getTime() < 12300 || p.getWorld().getTime() > 23850) {
												if (p.getEyeLocation().getBlock().getLightFromSky() == 15) {
													ItemEnergy.chargeInventory(p, Float.valueOf(String.valueOf(Slimefun.getItemValue("SOLAR_HELMET", "charge-amount"))));
												}
											}
										}
									}
								}
							}

							for (ItemStack radioactive: SlimefunItem.radioactive) {
								if (p.getInventory().containsAtLeast(radioactive, 1) || SlimefunManager.isItemSimiliar(p.getInventory().getItemInOffHand(), radioactive, true)) {
									// Check if player is wearing the hazmat suit
									// If so, break the loop
									if (SlimefunManager.isItemSimiliar(SlimefunItems.SCUBA_HELMET, p.getInventory().getHelmet(), true) &&
										SlimefunManager.isItemSimiliar(SlimefunItems.HAZMATSUIT_CHESTPLATE, p.getInventory().getChestplate(), true) &&
										SlimefunManager.isItemSimiliar(SlimefunItems.HAZMATSUIT_LEGGINGS, p.getInventory().getLeggings(), true) &&
										SlimefunManager.isItemSimiliar(SlimefunItems.RUBBER_BOOTS, p.getInventory().getBoots(), true)) {
										break;
									}

									// If the item is enabled in the world, then make radioactivity do its job
									if (Slimefun.isEnabled(p, radioactive, false)) {
										p.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 400, 3));
										p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 400, 3));
										p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 3));
										p.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 400, 3));
										p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 400, 1));
										p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 400, 1));
										p.setFireTicks(400);
										break; // Break the loop to save some calculations
									}
								}
							}
						}
					}
				}, 0L, config.getInt("options.armor-update-interval") * 20L);
			}

			ticker = new TickerTask();

			// Starting all ASYNC Tasks
			getServer().getScheduler().scheduleAsyncRepeatingTask(this, new AutoSavingTask(), 1200L, config.getInt("options.auto-save-delay-in-minutes") * 60L * 20L);
			getServer().getScheduler().scheduleAsyncRepeatingTask(this, ticker, 100L, config.getInt("URID.custom-ticker-delay"));

			getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {

				@Override
				public void run() {
					for (GitHubConnector connector: GitHubConnector.connectors) {
						connector.pullFile();
					}
				}
			}, 80L, 60 * 60 * 20L);

			// Hooray!
			System.out.println("[Slimefun] Finished!");

			clearlag = getServer().getPluginManager().isPluginEnabled("ClearLag");

			coreProtect = getServer().getPluginManager().isPluginEnabled("CoreProtect");

            Bukkit.getScheduler().scheduleSyncDelayedTask(this, new BukkitRunnable() {
                @Override
                public void run() {
                    exoticGarden = getServer().getPluginManager().isPluginEnabled("ExoticGarden"); // Had to do it this way, otherwise it seems disabled.
                }
            }, 0);

			if (clearlag) new ClearLaggIntegration(this);

			if (coreProtect) coreProtectAPI = ((CoreProtect)getServer().getPluginManager().getPlugin("CoreProtect")).getAPI();

			Research.creative_research = config.getBoolean("options.allow-free-creative-research");

			AutoEnchanter.max_emerald_enchantments = config.getInt("options.emerald-enchantment-limit");

			SlimefunSetup.legacy_ore_washer = config.getBoolean("options.legacy-ore-washer");
			ElectricDustWasher.legacy_dust_washer = config.getBoolean("options.legacy-dust-washer");

			// Do not show /sf elevator command in our Log, it could get quite spammy
			CSCoreLib.getLib().filterLog("([A-Za-z0-9_]{3,16}) issued server command: /sf elevator (.{0,})");
		}
	}

Replace Anonymous With Lambda me.mrCookieSlime.Slimefun.SlimefunStartup.onEnable.scheduleSyncDelayedTask.new Runnable with () -> {Slimefun.emeraldenchants=getServer().getPluginManager().isPluginEnabled("EmeraldEnchants"); in method public onEnable() : void from class me.mrCookieSlime.Slimefun.SlimefunStartup


	@EventHandler
	public void onArrowHit(final ProjectileHitEvent e) {
		Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
			if (!e.getEntity().isValid()) return;
			if (Variables.arrows.containsKey(e.getEntity().getUniqueId())) Variables.arrows.remove(e.getEntity().getUniqueId());
			if (e.getEntity() instanceof Arrow) handleGrapplingHook((Arrow) e.getEntity());
		}, 4L);
	}

	@EventHandler
	public void onArrowHit(final ProjectileHitEvent e) {
		Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

			@Override
			public void run() {
				if (!e.getEntity().isValid()) return;
				if (Variables.arrows.containsKey(e.getEntity().getUniqueId())) Variables.arrows.remove(e.getEntity().getUniqueId());
				if (e.getEntity() instanceof Arrow) handleGrapplingHook((Arrow) e.getEntity());
			}
		}, 4L);
	}

Replace Anonymous With Lambda me.mrCookieSlime.Slimefun.listeners.BowListener.onArrowHit.scheduleSyncDelayedTask.new Runnable with () -> {if(!e.getEntity().isValid())return; in method public onArrowHit(e ProjectileHitEvent) : void from class me.mrCookieSlime.Slimefun.listeners.BowListener


	private void handleGrapplingHook(Arrow arrow) {
		if (arrow != null) {
			if (arrow.getShooter() instanceof Player && Variables.jump.containsKey(((Player) arrow.getShooter()).getUniqueId())) {
				final Player p = (Player) arrow.getShooter();
				if (p.getGameMode() != GameMode.CREATIVE && Variables.jump.get(p.getUniqueId())) arrow.getWorld().dropItem(arrow.getLocation(), SlimefunItem.getItem("GRAPPLING_HOOK"));
				if (p.getLocation().distance(arrow.getLocation()) < 3.0D) {
					if (arrow.getLocation().getY() > p.getLocation().getY()) {
						p.setVelocity(new Vector(0.0D, 0.25D, 0.0D));
					}
					else p.setVelocity(arrow.getLocation().toVector().subtract(p.getLocation().toVector()));
					for (Entity n: Variables.remove.get(p.getUniqueId())) {
		    	    	n.remove();
		    	    }

		    	    Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
						Variables.jump.remove(p.getUniqueId());
						Variables.remove.remove(p.getUniqueId());
					}, 20L);
				}
				else {
					Location l = p.getLocation();
					l.setY(l.getY() + 0.5D);
					p.teleport(l);

					double g = -0.08D;
		    	    double d = arrow.getLocation().distance(l);
		    	    double t = d;
		    	    double v_x = (1.0D + 0.08000000000000001D * t) * (arrow.getLocation().getX() - l.getX()) / t;
		    	    double v_y = (1.0D + 0.04D * t) * (arrow.getLocation().getY() - l.getY()) / t - 0.5D * g * t;
		    	    double v_z = (1.0D + 0.08000000000000001D * t) * (arrow.getLocation().getZ() - l.getZ()) / t;

		    	    Vector v = p.getVelocity();

		    	    v.setX(v_x);
		    	    v.setY(v_y);
		    	    v.setZ(v_z);

		    	    p.setVelocity(v);

		    	    for (Entity n: Variables.remove.get(p.getUniqueId())) {
		    	    	n.remove();
		    	    }

		    	    Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

						@Override
						public void run() {
							Variables.jump.remove(p.getUniqueId());
							Variables.remove.remove(p.getUniqueId());
						}
					}, 20L);
				}
			}
		}
	}

	private void handleGrapplingHook(Arrow arrow) {
		if (arrow instanceof Arrow) {
			if (arrow.getShooter() instanceof Player && Variables.jump.containsKey(((Player) arrow.getShooter()).getUniqueId())) {
				final Player p = (Player) arrow.getShooter();
				if (p.getGameMode() != GameMode.CREATIVE && Variables.jump.get(p.getUniqueId())) arrow.getWorld().dropItem(arrow.getLocation(), SlimefunItem.getItem("GRAPPLING_HOOK"));
				if (p.getLocation().distance(arrow.getLocation()) < 3.0D) {
					if (arrow.getLocation().getY() > p.getLocation().getY()) {
						p.setVelocity(new Vector(0.0D, 0.25D, 0.0D));
					}
					else p.setVelocity(arrow.getLocation().toVector().subtract(p.getLocation().toVector()));
					for (Entity n: Variables.remove.get(p.getUniqueId())) {
		    	    	n.remove();
		    	    }

		    	    Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

						@Override
						public void run() {
							Variables.jump.remove(p.getUniqueId());
							Variables.remove.remove(p.getUniqueId());
						}
					}, 20L);
				}
				else {
					Location l = p.getLocation();
					l.setY(l.getY() + 0.5D);
					p.teleport(l);

					double g = -0.08D;
		    	    double d = arrow.getLocation().distance(l);
		    	    double t = d;
		    	    double v_x = (1.0D + 0.08000000000000001D * t) * (arrow.getLocation().getX() - l.getX()) / t;
		    	    double v_y = (1.0D + 0.04D * t) * (arrow.getLocation().getY() - l.getY()) / t - 0.5D * g * t;
		    	    double v_z = (1.0D + 0.08000000000000001D * t) * (arrow.getLocation().getZ() - l.getZ()) / t;

		    	    Vector v = p.getVelocity();

		    	    v.setX(v_x);
		    	    v.setY(v_y);
		    	    v.setZ(v_z);

		    	    p.setVelocity(v);

		    	    for (Entity n: Variables.remove.get(p.getUniqueId())) {
		    	    	n.remove();
		    	    }

		    	    Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

						@Override
						public void run() {
							Variables.jump.remove(p.getUniqueId());
							Variables.remove.remove(p.getUniqueId());
						}
					}, 20L);
				}
			}
		}
	}

Replace Anonymous With Lambda me.mrCookieSlime.Slimefun.listeners.BowListener.handleGrapplingHook.scheduleSyncDelayedTask.new Runnable with () -> {Variables.jump.remove(p.getUniqueId()); in method private handleGrapplingHook(arrow Arrow) : void from class me.mrCookieSlime.Slimefun.listeners.BowListener


    public void addEvent(CalendarView view) {
        view.getBtnEnter().addActionListener(evt -> {
            int month = Integer.valueOf((String) view.getCbxMonth().getSelectedItem());
            int year = Integer.parseInt(view.getTxtYear().getText());
            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.MONTH, month - 1);
            cal.set(Calendar.YEAR, year);
            RenderCalendar(view, cal);
//                RenderStatistical(month, year);
            RenderStatistical(view, cal);
        });
    }

    public void addEvent() {
        view.getBtnEnter().addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                month = Integer.valueOf((String) view.getCbxMonth().getSelectedItem());
                year = Integer.parseInt(view.getTxtYear().getText());
                Calendar cal = Calendar.getInstance();
                cal.set(Calendar.MONTH, month - 1);
                cal.set(Calendar.YEAR, year);
                RenderCalendar(view, cal);
                RenderStatistical(month, year);
                RenderStatistical(view, cal);
                //System.out.println("ok");

            }
        });
    }

Replace Anonymous With Lambda controllers.employee.CalendarController.addEvent.addActionListener.new java.awt.event.ActionListener with evt -> {int month=Integer.valueOf((String)view.getCbxMonth().getSelectedItem()); in method public addEvent(view CalendarView) : void from class controllers.employee.CalendarController


    public void addEvent() {
        view.getBtnLogout().addActionListener(evt -> {
            view.dispose();
            Runner.setSession(null);
            new LoginController(new LoginView());
        });
    }

    public void addEvent() {
        view.getBtnLogout().addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent evt) {
                view.dispose();
                Runner.setSession(null);
                new LoginController(new LoginView());
            }
        });
    }

Replace Anonymous With Lambda controllers.EmployeeDashboardController.addEvent.addActionListener.new ActionListener with evt -> {view.dispose(); in method public addEvent() : void from class controllers.EmployeeDashboardController


    /**
     * constructor
     */
    public PlayerList() {
        players = new ArrayList<>();
    }

    /**
     * constructor
     */
    public PlayerList() {
        players = new ArrayList<Player>();
    }

Replace Generic With Diamond ArrayList<Player> with ArrayList<> in method public PlayerList() from class Server.Model.PlayerList


    /**
     * Read the 2 or 3, based on how many players has the game, chosen divinities
     * @return arraylist with the chosen divinities
     */
    public ArrayList<String> readDivinitiesChoice(){
        Scanner input = new Scanner(System.in);
        Divinity[] divinities = Divinity.values();
        chosenDivinities = new ArrayList<>();
        int val;
        int players;
        if(!twoOrThree) {
            players = 2;
        }else{
            players = 3;
        }
        System.out.println("\n(indicare i numeri corrispondenti alle divinità scelte)\nDivinità scelte: ");
        for(int i = 0; i < players; i++) {
            val = input.nextInt();
            chosenDivinities.add(divinities[val - 1].toString());
        }
        return chosenDivinities;
    }

    /**
     * Read the 2 or 3, based on how many players has the game, chosen divinities
     * @return arraylist with the chosen divinities
     */
    public ArrayList<String> readDivinitiesChoice(){
        Scanner input = new Scanner(System.in);
        Divinity[] divinities = Divinity.values();
        chosenDivinities = new ArrayList<String>();
        int val;
        int players;
        if(!twoOrThree) {
            players = 2;
        }else{
            players = 3;
        }
        System.out.println("\n(indicare i numeri corrispondenti alle divinità scelte)\nDivinità scelte: ");
        for(int i = 0; i < players; i++) {
            val = input.nextInt();
            chosenDivinities.add(divinities[val - 1].toString());
        }
        return chosenDivinities;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public readDivinitiesChoice() : ArrayList<String> from class Client.CLI.CLI


    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        List<Order> orders = os.getOrders();

        response.setHeader("Content-Type", "text/html;charset=UTF-8");

        try (PrintWriter writer = response.getWriter();) {
            for (int i = 0; i < orders.size(); i++) {

                writer.println(orders.get(i).getId());
                writer.println(orders.get(i).getDescription());
                writer.println(orders.get(i).getWeight());
                writer.println(orders.get(i).getDeparture());
                writer.println(orders.get(i).getDestination());
                writer.println(orders.get(i).getClient().getId());
                writer.println(orders.get(i).getStatus());
                writer.write("</br>");

            }

        }
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        List<Order> orders = os.getOrders();

        response.setHeader("Content-Type", "text/html;charset=UTF-8");
        PrintWriter writer = response.getWriter();
        try {
            for (int i = 0; i < orders.size(); i++) {

                writer.println(orders.get(i).getId());
                writer.println(orders.get(i).getCargo());
                writer.println(orders.get(i).getWeight());
                writer.println(orders.get(i).getDeparture());
                writer.println(orders.get(i).getDestination());
                writer.println(cs.getById(orders.get(i).getClient().getId()).getTitle());
                writer.println(orders.get(i).getStatus());
                writer.write("</br>");
            }

        } catch (SQLException e) {
            throw new RuntimeException(e);
        } finally {
            writer.close();
        }
        writer.flush();
    }

Try With Resources try(PrintWriter writer=response.getWriter()) in method protected doGet(request HttpServletRequest, response HttpServletResponse) : void from class by.trucking.controller.OrderController


    @Override
    public State find(State state) {
        return getStates().stream().filter(s -> s.equals(state)).findFirst().get();
    }

    @Override
    public State find(State state) {
        return getStates().stream().filter(new Predicate<State>() {
            @Override
            public boolean test(State candidate) {
                return candidate.equals(state);
            }
        }).findFirst().get();
    }

Replace Anonymous With Lambda com.datagenio.crawler.model.EventFlowGraphImpl.find.get.findFirst.filter.new Predicate<State> with s -> s.equals(state) in method public find(state State) : State from class com.datagenio.crawler.model.EventFlowGraphImpl


    @Test
    public void testSetProperties() {
        ArrayList<TypedParam> props = new ArrayList<>();
        this.body.setProperties(props);
        assertEquals(props, this.body.getProperties());
    }

    @Test
    public void testSetProperties() {
        ArrayList<TypedParam> props = new ArrayList<TypedParam>();
        this.body.setProperties(props);
        assertEquals(props, this.body.getProperties());
    }

Replace Generic With Diamond ArrayList<TypedParam> with ArrayList<> in method public testSetProperties() : void from class com.datagenio.model.request.AbstractBodyTest


    public AbstractBody() {
        this.properties = new ArrayList<>();
    }

    public AbstractBody() {
        this.properties = new ArrayList<TypedParam>();
    }

Replace Generic With Diamond ArrayList<TypedParam> with ArrayList<> in method public AbstractBody() from class com.datagenio.model.AbstractBody


    public UUID getDeckOwnerId(UUID deckId) throws DatabaseException {
        String sql = """
                    SELECT user_id
                    FROM deck
                    WHERE deck_id = ?
                    """;

        try(ResultSet res = database.executeQuery(sql, deckId.toString())) {
            return UUID.fromString(res.getString("user_id"));

        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }
    }

    public UUID getDeckOwnerId(UUID deckId) throws DatabaseException {
        try {
            String sql = """
                    SELECT user_id
                    FROM deck
                    WHERE deck_id = ?
                    """;
            ResultSet res = database.executeQuery(sql, deckId.toString());
            return UUID.fromString(res.getString("user_id"));
        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }
    }

Try With Resources try(ResultSet res=database.executeQuery(sql,deckId.toString())) in method public getDeckOwnerId(deckId UUID) : UUID from class ulb.infof307.g01.server.database.dao.DeckDAO


    @Override
    public void deckImportClicked() {
        try {
            deckIO.setAllDecks(serverCommunicator.getAllDecksMetadata());

            Path path = deckMenuViewController.pickOpenFile();
            Deck deck = deckIO.importFrom(path);

            serverCommunicator.saveDeck(deck);
            showDecks();

        } catch (JsonSyntaxException
                 | IllegalStateException
                 | IllegalArgumentException e) {

            errorHandler.failedDeckImportError(e);

        } catch (IOException | InterruptedException e) {
            errorHandler.failedLoading(e);

        } catch (ServerCommunicationFailedException e) {
            errorHandler.failedServerCommunication(e);
        }
    }

    @Override
    public void deckImportClicked() {
        try {
            deckIO.setAllDecks(serverCommunicator.getAllDecksMetadata());

            Path path = deckMenuViewController.pickOpenFile();
            Deck deck = deckIO.importFrom(path);

            serverCommunicator.saveDeck(deck);
            showDecks();

        } catch (IllegalArgumentException e) {
            return;

        } catch (JsonSyntaxException | IllegalStateException e) {
            errorHandler.failedDeckImportError(e);
            e.printStackTrace();

        } catch (IOException e) {
            errorHandler.failedLoading(e);

        } catch (InterruptedException e) {
            errorHandler.savingError(e);
        }
    }

Merge Catch [catch(JsonSyntaxException|IllegalStateException e), catch(IllegalArgumentException e)] to catch(JsonSyntaxException|IllegalStateException|IllegalArgumentException e) in method public deckImportClicked() : void from class ulb.infof307.g01.gui.controller.DeckMenuController


    /**
     * Execute multiple SQL statements that are not returning a result
     * <p>
     * It will usually be for DELETE, INSERT and UPDATE.
     *
     * @param updates a SQL statement to be executed
     */
    public void executeUpdates(String[] updates) throws DatabaseException {
        assertOpened();
        try (Statement stmt = connection.createStatement()) {
            for (String sql : updates)
                stmt.addBatch(sql);
            stmt.executeBatch();
        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }

    }

    /**
     * Execute multiple SQL statements that are not returning a result
     * <p>
     * It will usually be for DELETE, INSERT and UPDATE.
     *
     * @param updates a SQL statement to be executed
     */
    public void executeUpdates(String[] updates) throws DatabaseException {
        try {
            assertOpened();
            Statement stmt = connection.createStatement();
            for (String sql : updates)
                stmt.addBatch(sql);
            stmt.executeBatch();

        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }

    }

Try With Resources try(Statement stmt=connection.createStatement()) in method public executeUpdates(updates String[]) : void from class ulb.infof307.g01.server.database.DatabaseAccess


    public List<GlobalLeaderboardEntry> getAllUserDeckScore() throws DatabaseException{
        String sql = """
                SELECT U.username, sum(score) as total_score
                FROM user_deck_score S, user U
                INNER JOIN marketplace m on m.deck_id = S.deck_id
                WHERE U.user_id = S.user_id
                GROUP BY U.username;
                """;

        try(ResultSet res = database.executeQuery(sql)) {
            List<GlobalLeaderboardEntry> leaderboard = new ArrayList<>();
            while (res.next()) {
                leaderboard.add(
                        new GlobalLeaderboardEntry(
                                res.getInt("total_score"),
                                res.getString("username")
                        ));
            }

            return leaderboard;

        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }

    }

    public List<GlobalLeaderboardEntry> getAllUserDeckScore() throws DatabaseException{
        String sql = """
                SELECT U.username, sum(score) as total_score
                FROM user_deck_score S, user U
                WHERE U.user_id = S.user_id
                GROUP BY U.username;
                """;

        try {
            ResultSet res = database.executeQuery(sql);
            List<GlobalLeaderboardEntry> leaderboard = new ArrayList<>();
            while (res.next()) {
                leaderboard.add(
                        new GlobalLeaderboardEntry(
                                res.getInt("total_score"),
                                res.getString("username")
                        ));
            }

            return leaderboard;

        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }

    }

Try With Resources try(ResultSet res=database.executeQuery(sql)) in method public getAllUserDeckScore() : List<GlobalLeaderboardEntry> from class ulb.infof307.g01.server.database.dao.ScoreDAO


    @Override
    public void leaderboardClicked() {
        try {
            leaderboardController = new GlobalLeaderboardController(
                    stage,
                    mainWindowViewController,
                    errorHandler,
                    this,
                    userSessionDAO,
                    deckDAO,
                    leaderboardDAO);

            viewStack.add(View.LEADERBOARD);
            leaderboardController.show();

        } catch (IOException | InterruptedException e) {
            errorHandler.failedLoading(e);
        }
    }

    @Override
    public void leaderboardClicked() {
        try {
            leaderboardController = new GlobalLeaderboardController(
                    stage,
                    mainWindowViewController,
                    errorHandler,
                    this,
                    userSessionDAO,
                    deckDAO,
                    leaderboardDAO);

            viewStack.add(View.LEADERBOARD);
            leaderboardController.show(); //TODO : trycatch help OC

        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

Merge Catch [catch(InterruptedException e), catch(IOException e)] to catch(IOException|InterruptedException e) in method public leaderboardClicked() : void from class ulb.infof307.g01.gui.controller.MainFxController


    public String getUserSaltKey(String username) throws DatabaseException {
        String sql = """
                SELECT salt
                FROM user
                WHERE username = ?
                """;

        try (ResultSet res = database.executeQuery(sql, username)) {
            return res.getString("salt");

        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }
    }

    public String getUserSaltKey(String username) throws DatabaseException {
        String sql = """
                SELECT salt
                FROM user
                WHERE username = '%1$s'
                """;

        try {
            ResultSet res = database.executeQuery(sql, username);
            return res.getString("salt");
        } catch (SQLException e) {
            throw new DatabaseException(e.getMessage());
        }
    }

Try With Resources try(ResultSet res=database.executeQuery(sql,username)) in method public getUserSaltKey(username String) : String from class ulb.infof307.g01.server.database.dao.UserDAO


    private List<Tag> getTags(String sql) throws SQLException {
        List<Tag> tags = new ArrayList<>();

        try(ResultSet res = database.executeQuery(sql)) {
            while (res.next()) {
                UUID tagId = UUID.fromString(res.getString("tag_id"));
                tags.add(getTag(tagId));
            }
        }

        return tags;
    }

    private List<Tag> getTags(String sql) {
        List<Tag> tags = new ArrayList<>();

        try {
            ResultSet res = database.executeQuery(sql);
            while (res.next()) {
                UUID tagId = UUID.fromString(res.getString("tag_id"));
                tags.add(getTag(tagId));
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        return tags;
    }

Try With Resources try(ResultSet res=database.executeQuery(sql)) in method private getTags(sql String) : List<Tag> from class ulb.infof307.g01.database.TagDAO


    /**
     * For filtering purposes
     */
    public List<Deck> getDecksHavingTag(Tag tag) throws SQLException {
        String sql = """
                SELECT deck_id, tag_id
                FROM deck_tag
                WHERE tag_id = '%1$s'
                """.formatted(tag.getId().toString());

        List<Deck> decks = new ArrayList<>();

        try (ResultSet res = database.executeQuery(sql)) {
            while (res.next()) {
                UUID deckId = UUID.fromString(res.getString("deck_id"));
                decks.add(deckDao.getDeck(deckId));
            }
        }

        return decks;
    }

    /**
     * For filtering purposes
     */
    public List<Deck> getDecksHavingTag(Tag tag) {
        String sql = """
                SELECT deck_id, tag_id
                FROM deck_tag
                WHERE tag_id = '%1$s'
                """.formatted(tag.getId().toString());

        List<Deck> decks = new ArrayList<>();

        try {
            ResultSet res = database.executeQuery(sql);
            while (res.next()) {
                UUID deckId = UUID.fromString(res.getString("deck_id"));
                decks.add(deckDao.getDeck(deckId));
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        return decks;
    }

Try With Resources try(ResultSet res=database.executeQuery(sql)) in method public getDecksHavingTag(tag Tag) : List<Deck> from class ulb.infof307.g01.database.TagDAO


    /**
     * Get all cards associated with given deck
     *
     * @return The cards of the deck. If the id
     * is not in the database, an empty list is
     * returned.
     */
    private List<Card> getCardsFor(UUID deckUuid) {
        String sql = """
                SELECT card_id, deck_id, front, back
                FROM card
                WHERE deck_id = '%s'
                """.formatted(deckUuid.toString());

        List<Card> cards = new ArrayList<>();

        try {
            ResultSet res = database.executeQuery(sql);
            while (res.next()) {
                cards.add(extractCardFromResultSet(res));
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        return cards;
    }

    /**
     * Get all cards associated with given deck
     *
     * @return The cards of the deck. If the id
     * is not in the database, an empty list is
     * returned.
     */
    private List<Card> getCardsFor(UUID deckUuid) {
        String sql = """
                SELECT card_id, deck_id, front, back
                FROM card
                WHERE deck_id = '%s'
                """.formatted(deckUuid.toString());

        List<Card> cards = new ArrayList<Card>();

        try {
            ResultSet res = database.executeQuery(sql);
            while (res.next()) {
                cards.add(extractCardFromResultSet(res));
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        return cards;
    }

Replace Generic With Diamond ArrayList<Card> with ArrayList<> in method private getCardsFor(deckUuid UUID) : List<Card> from class ulb.infof307.g01.database.DeckDAO


    @Test
    void getDecksHavingTag_MultipleDecks_OnlyThoseReturned() {
        Deck deck1 = new Deck("name1");
        Deck deck2 = new Deck("name2");
        Deck deck3 = new Deck("name3");

        deckDAO.saveDeck(deck1);
        deckDAO.saveDeck(deck2);
        deckDAO.saveDeck(deck3);

        Tag tag = new Tag("name");
        deck1.addTag(tag);
        deck2.addTag(tag);

        tagDAO.saveTagsFor(deck1);
        tagDAO.saveTagsFor(deck2);
        tagDAO.saveTagsFor(deck3);

        var expectedSet = Set.of(deck1, deck2);
        var receivedSet = new HashSet<>(tagDAO.getDecksHavingTag(tag));

        assertEquals(expectedSet, receivedSet);
    }

    @Test
    void getDecksHavingTag_MultipleDecks_OnlyThoseReturned() {
        Deck deck1 = new Deck("name1");
        Deck deck2 = new Deck("name2");
        Deck deck3 = new Deck("name3");

        deckDAO.saveDeck(deck1);
        deckDAO.saveDeck(deck2);
        deckDAO.saveDeck(deck3);

        Tag tag = new Tag("name");
        deck1.addTag(tag);
        deck2.addTag(tag);

        tagDAO.saveTagsFor(deck1);
        tagDAO.saveTagsFor(deck2);
        tagDAO.saveTagsFor(deck3);

        var expectedSet = Set.of(deck1, deck2);
        var receivedSet = new HashSet<Deck>(tagDAO.getDecksHavingTag(tag));

        assertEquals(expectedSet, receivedSet);
    }

Replace Generic With Diamond HashSet<Deck> with HashSet<> in method package getDecksHavingTag_MultipleDecks_OnlyThoseReturned() : void from class ulb.infof307.g01.database.TestTagDAO


    public static ArrayList<User> readFile() {
        ArrayList<User> users = new ArrayList<>();
        try {
            FileInputStream fileInputStream = new FileInputStream(FILE_NAME);
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
            Object object;
            object = objectInputStream.readObject();

            if(object != null) users = (ArrayList<User>) object;

            fileInputStream.close();
            objectInputStream.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(UserSerialization.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException | ClassNotFoundException ex) {
            Logger.getLogger(UserSerialization.class.getName()).log(Level.SEVERE, null, ex);
        }
        return users;
    }

    public static ArrayList<User> readFile() {
        ArrayList<User> users = new ArrayList<>();
        try {
            FileInputStream fileInputStream = new FileInputStream(FILE_NAME);
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
            User user;
            Object object;
            object = objectInputStream.readObject();

            if(object != null) users = (ArrayList<User>) object;

            fileInputStream.close();
            objectInputStream.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(UserSerialization.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(UserSerialization.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(UserSerialization.class.getName()).log(Level.SEVERE, null, ex);
        }
        return users;
    }

Merge Catch [catch(IOException ex), catch(ClassNotFoundException ex)] to catch(IOException|ClassNotFoundException ex) in method public readFile() : ArrayList<User> from class br.com.pelk.findhospital.backend.serialization.UserSerialization


    @GetMapping("/{id}")
    public ResponseEntity<User> findById(@PathVariable int id) {
        Optional<User> res = this.userService.findById(id);
        return new ResponseEntity<>(
                res.orElseGet(User::new),
                res.isPresent() ? HttpStatus.OK : HttpStatus.NOT_FOUND
        );
    }

    @GetMapping("/{id}")
    public ResponseEntity<User> findById(@PathVariable int id) {
        Optional<User> res = this.userService.findById(id);
        return new ResponseEntity<User>(
                res.orElseGet(User::new),
                res.isPresent() ? HttpStatus.OK : HttpStatus.NOT_FOUND
        );
    }

Replace Generic With Diamond ResponseEntity<User> with ResponseEntity<> in method public findById(id int) : ResponseEntity<User> from class ru.zmath.rest.controller.UserController


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try {
            URL resource = contentSource.resolve(req.getPathInfo().substring(1));
            Long lastModified = contentSource.lastModified(resource);
            if (lastModified != null) {
                resp.setDateHeader("Last-Modified", lastModified);

                long ifModifiedSinceHeader = req.getDateHeader("If-Modified-Since");
                if (ifModifiedSinceHeader > 0 && lastModified >= ifModifiedSinceHeader) {
                    resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                    return;
                }
            }
            try (InputStream inputStream = resource.openStream()) {
                resp.setContentType(getServletContext().getMimeType(resource.getFile()));
                inputStream.transferTo(resp.getOutputStream());
            }
        } catch (FileNotFoundException ignored) {
            resp.sendError(404);
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try {
            URL resource = contentSource.resolve(req.getPathInfo().substring(1));
            Long lastModified = contentSource.lastModified(resource);
            if (lastModified != null) {
                resp.setDateHeader("Last-Modified", lastModified);

                long ifModifiedSinceHeader = req.getDateHeader("If-Modified-Since");
                if (ifModifiedSinceHeader > 0 && lastModified >= ifModifiedSinceHeader) {
                    resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                    return;
                }
            }
            InputStream inputStream = resource.openStream();
            resp.setContentType(getServletContext().getMimeType(resource.getFile()));
            inputStream.transferTo(resp.getOutputStream());
        } catch (FileNotFoundException ignored) {
            resp.sendError(404);
        }
    }

Try With Resources try(InputStream inputStream=resource.openStream()) in method protected doGet(req HttpServletRequest, resp HttpServletResponse) : void from class org.actioncontrollerdemo.servlet.ContentServlet


    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try (
                MDC.MDCCloseable ignored = MDC.putCloseable("clientIp", req.getRemoteAddr());
                MDC.MDCCloseable ignored2 = MDC.putCloseable("request", req.getContextPath() + req.getServletPath() + req.getPathInfo())
        ) {
            verifyNoExceptions();
            invokeAction(new ServletHttpExchange(req, resp));
        }
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try {
            MDC.put("clientIp", req.getRemoteAddr());
            MDC.put("request", req.getContextPath() + req.getServletPath() + req.getPathInfo());

            verifyNoExceptions();
            invokeAction(new ServletHttpExchange(req, resp));
        } finally {
            MDC.clear();
        }
    }

Try With Resources try(MDC.MDCCloseable ignored=MDC.putCloseable("clientIp",req.getRemoteAddr()); MDC.MDCCloseable ignored2=MDC.putCloseable("request",req.getContextPath() + req.getServletPath() + req.getPathInfo())) in method protected service(req HttpServletRequest, resp HttpServletResponse) : void from class org.actioncontroller.servlet.ApiServlet


        @Override
        public Object apply(HttpServletRequest req, Map<String, String> u) {
            if (parameter.getType() == Consumer.class) {
                return (Consumer<Object>) o -> {
                    if (sessionParam.invalidate()) {
                        req.getSession().invalidate();
                    }
                    req.getSession(true).setAttribute(sessionParam.value(), o);
                };
            }

            Object value = req.getSession().getAttribute(sessionParam.value());
            if (parameter.getType() == Optional.class) {
                return Optional.ofNullable(value);
            } else if (value != null) {
                return value;
            } else {
                throw new HttpRequestException(401, "Missing required session parameter " + sessionParam.value());
            }
        }

        @Override
        public Object apply(HttpServletRequest req, Map<String, String> u) {
            if (parameter.getType() == Consumer.class) {
                return new Consumer<Object>() {
                    @Override
                    public void accept(Object o) {
                        if (sessionParam.invalidate()) {
                            req.getSession().invalidate();
                        }
                        req.getSession(true).setAttribute(sessionParam.value(), o);
                    }
                };
            }

            Object value = req.getSession().getAttribute(sessionParam.value());
            if (parameter.getType() == Optional.class) {
                return Optional.ofNullable(value);
            } else if (value != null) {
                return value;
            } else {
                throw new HttpRequestException(401, "Missing required session parameter " + sessionParam.value());
            }
        }

Replace Anonymous With Lambda org.actioncontroller.SessionParameter.SessionParameterMapping.apply.new Consumer<Object> with o -> {if(sessionParam.invalidate()){req.getSession().invalidate(); in method public apply(req HttpServletRequest, u Map<String,String>) : Object from class org.actioncontroller.SessionParameter.SessionParameterMapping


  @Override
  public void onEnable() {

    new MetricsLite(this, 13819);
    checkForUpdate();

    File configFile = new File(this.getDataFolder(), "config.yml");
    if (!configFile.exists()) {
      saveDefaultConfig();
    }

    if (!getConfig().contains("config-version") || getConfig().getInt("config-version") != 5) {
      configFile.delete();
      saveDefaultConfig();
    }

    listener = new InteractionListener(this);
    Bukkit.getPluginManager().registerEvents(listener, this);
    StorageApi.setMainPlugin(this);
    if (getConfig().getBoolean("SaveBlocks")) {
      Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> {
        if (getConfig().getBoolean("UseMysql")) {
          StorageApi.setMysqlDetails(getConfig().getString("MysqlUsername"),
                  getConfig().getString("MysqlPassword"), getConfig().getString("MysqlHost"), getConfig()
                  .getString("MysqlDatabase"));
          StorageApi.loadBlocksFromMysql();
        } else {
          StorageApi.loadBlocksFromFlatfile();
        }
      }, 10);
    }
  }

  @Override
  public void onEnable() {

    new MetricsLite(this, 13819);
    checkForUpdate();

    File configFile = new File(this.getDataFolder(), "config.yml");
    if (!configFile.exists()) {
      saveDefaultConfig();
    }

    if (!getConfig().contains("config-version") || getConfig().getInt("config-version") != 5) {
      configFile.delete();
      saveDefaultConfig();
    }

    listener = new InteractionListener(this);
    Bukkit.getPluginManager().registerEvents(listener, this);
    StorageApi.setMainPlugin(this);
    if (getConfig().getBoolean("SaveBlocks")) {
      Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
        @Override
        public void run() {
          if (getConfig().getBoolean("UseMysql")) {
            StorageApi.setMysqlDetails(getConfig().getString("MysqlUsername"),
                    getConfig().getString("MysqlPassword"), getConfig().getString("MysqlHost"), getConfig()
                    .getString("MysqlDatabase"));
            StorageApi.loadBlocksFromMysql();
          } else {
            StorageApi.loadBlocksFromFlatfile();
          }
        }
      }, 10);
    }
  }

Replace Anonymous With Lambda com.zenya.limitcreative.Creative.onEnable.scheduleSyncDelayedTask.new Runnable with () -> {if(getConfig().getBoolean("UseMysql")){StorageApi.setMysqlDetails(getConfig().getString("MysqlUsername"),getConfig().getString("MysqlPassword"),getConfig().getString("MysqlHost"),getConfig().getString("MysqlDatabase")); in method public onEnable() : void from class com.zenya.limitcreative.Creative


  @EventHandler(priority = EventPriority.MONITOR)
  public void onBreak(BlockBreakEvent event) {
    if (event.isCancelled() || disallowedWorlds.contains(event.getBlock().getWorld().getName())) {
      return;
    }

    if (isCreativeItem(event.getPlayer().getItemInHand()) && event.getPlayer().getGameMode() == GameMode.SURVIVAL) {
      event.setCancelled(true);
      event.setExpToDrop(0);
    }

    if (StorageApi.isMarked(event.getBlock())) {
      String message = StorageApi.unmarkBlock(event.getBlock());
      if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
        event.setExpToDrop(0);
        Collection<ItemStack> drops = event.getBlock().getDrops(event.getPlayer().getItemInHand());
        for (ItemStack item : drops) {
          ItemMeta meta = item.getItemMeta();
          List<String> lore = new ArrayList<>();
          if (meta.hasLore()) {
            lore = meta.getLore();
          }
          lore.add(0, message);
          meta.setLore(lore);
          item.setItemMeta(meta);
          event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().clone().add(0.5, 0, 0.5), item);
        }
        event.getBlock().setType(Material.AIR);
      }
    }
  }

  @EventHandler(priority = EventPriority.MONITOR)
  public void onBreak(BlockBreakEvent event) {
    if (event.isCancelled() || disallowedWorlds.contains(event.getBlock().getWorld().getName())) {
      return;
    }

    if (isCreativeItem(event.getPlayer().getItemInHand()) && event.getPlayer().getGameMode() == GameMode.SURVIVAL) {
      event.setCancelled(true);
      event.setExpToDrop(0);
    }

    if (StorageApi.isMarked(event.getBlock())) {
      String message = StorageApi.unmarkBlock(event.getBlock());
      if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
        event.setExpToDrop(0);
        Collection<ItemStack> drops = event.getBlock().getDrops(event.getPlayer().getItemInHand());
        for (ItemStack item : drops) {
          ItemMeta meta = item.getItemMeta();
          List<String> lore = new ArrayList<String>();
          if (meta.hasLore()) {
            lore = meta.getLore();
          }
          lore.add(0, message);
          meta.setLore(lore);
          item.setItemMeta(meta);
          event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().clone().add(0.5, 0, 0.5), item);
        }
        event.getBlock().setType(Material.AIR);
      }
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public onBreak(event BlockBreakEvent) : void from class com.zenya.limitcreative.InteractionListener


  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityExplode(EntityExplodeEvent event) {
    if (disallowedWorlds.contains(event.getLocation().getWorld().getName())) {
      return;
    }
    for (Block block : event.blockList()) {
      if (StorageApi.isMarked(block)) {
        String message = StorageApi.unmarkBlock(block);
        for (ItemStack item : block.getDrops()) {
          ItemMeta meta = item.getItemMeta();
          List<String> lore = new ArrayList<>();
          if (meta.hasLore()) {
            lore = meta.getLore();
          }
          lore.add(0, message);
          meta.setLore(lore);
          item.setItemMeta(meta);
          block.getWorld().dropItemNaturally(block.getLocation().clone().add(0.5, 0, 0.5), item);
        }
        block.setType(Material.AIR);
      }
    }
  }

  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityExplode(EntityExplodeEvent event) {
    if (disallowedWorlds.contains(event.getLocation().getWorld().getName())) {
      return;
    }
    for (Block block : event.blockList()) {
      if (StorageApi.isMarked(block)) {
        String message = StorageApi.unmarkBlock(block);
        for (ItemStack item : block.getDrops()) {
          ItemMeta meta = item.getItemMeta();
          List<String> lore = new ArrayList<String>();
          if (meta.hasLore()) {
            lore = meta.getLore();
          }
          lore.add(0, message);
          meta.setLore(lore);
          item.setItemMeta(meta);
          block.getWorld().dropItemNaturally(block.getLocation().clone().add(0.5, 0, 0.5), item);
        }
        block.setType(Material.AIR);
      }
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public onEntityExplode(event EntityExplodeEvent) : void from class com.zenya.limitcreative.InteractionListener


  @EventHandler(priority = EventPriority.MONITOR)
  public void onBlockExplode(BlockExplodeEvent event) {
    if (disallowedWorlds.contains(event.getBlock().getLocation().getWorld().getName())) {
      return;
    }
    for (Block block : event.blockList()) {
      if (StorageApi.isMarked(block)) {
        String message = StorageApi.unmarkBlock(block);
        for (ItemStack item : block.getDrops()) {
          ItemMeta meta = item.getItemMeta();
          List<String> lore = new ArrayList<>();
          if (meta.hasLore()) {
            lore = meta.getLore();
          }
          lore.add(0, message);
          meta.setLore(lore);
          item.setItemMeta(meta);
          block.getWorld().dropItemNaturally(block.getLocation().clone().add(0.5, 0, 0.5), item);
        }
        block.setType(Material.AIR);
      }
    }
  }

  @EventHandler(priority = EventPriority.MONITOR)
  public void onBlockExplode(BlockExplodeEvent event) {
    if (disallowedWorlds.contains(event.getBlock().getLocation().getWorld().getName())) {
      return;
    }
    for (Block block : event.blockList()) {
      if (StorageApi.isMarked(block)) {
        String message = StorageApi.unmarkBlock(block);
        for (ItemStack item : block.getDrops()) {
          ItemMeta meta = item.getItemMeta();
          List<String> lore = new ArrayList<String>();
          if (meta.hasLore()) {
            lore = meta.getLore();
          }
          lore.add(0, message);
          meta.setLore(lore);
          item.setItemMeta(meta);
          block.getWorld().dropItemNaturally(block.getLocation().clone().add(0.5, 0, 0.5), item);
        }
        block.setType(Material.AIR);
      }
    }
  }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public onBlockExplode(event BlockExplodeEvent) : void from class com.zenya.limitcreative.InteractionListener