	private void updateNpcSkillData(L2PcInstance activeChar, int npcId, int skillId, int level)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			L2Skill skillData = SkillTable.getInstance().getInfo(skillId, level);
			if (skillData == null)
			{
				activeChar.sendMessage("Could not update npc skill: not existing skill id with that level!");
				showNpcSkillEdit(activeChar, npcId, skillId);
				return;
			}

			if (skillData.getLevel() != level)
			{
				activeChar.sendMessage("Skill id with requested level doesn't exist! Skill level not changed.");
				showNpcSkillEdit(activeChar, npcId, skillId);
				return;
			}

			int updated = 0;
			if(Config.CUSTOM_NPC_SKILLS_TABLE)
			{
				PreparedStatement statement2 = con.prepareStatement("UPDATE `custom_npcskills` SET `level`=? WHERE `npcid`=? AND `skillid`=?");
				statement2.setInt(1, level);
				statement2.setInt(2, npcId);
				statement2.setInt(3, skillId);

				updated = statement2.executeUpdate();
				statement2.close();
			}
			if(updated == 0)
			{
				PreparedStatement statement = con.prepareStatement("UPDATE `npcskills` SET `level`=? WHERE `npcid`=? AND `skillid`=?");
				statement.setInt(1, level);
				statement.setInt(2, npcId);
				statement.setInt(3, skillId);

				statement.execute();
				statement.close();
			}
			reloadNpcSkillList(npcId);

			showNpcSkillList(activeChar, npcId, 0);
			activeChar.sendMessage("Updated skill id " + skillId + " for npc id " + npcId + " to level " + level + ".");
		}
		catch (Exception e)
		{
			activeChar.sendMessage("Could not update npc skill!");
			_log.warning("Error while updating npc skill (" + npcId + ", " + skillId + ", " + level + "): " + e);
		}
	}

	private void updateNpcSkillData(L2PcInstance activeChar, int npcId, int skillId, int level)
	{
		Connection con = null;
		try
		{
			L2Skill skillData = SkillTable.getInstance().getInfo(skillId, level);
			if (skillData == null)
			{
				activeChar.sendMessage("Could not update npc skill: not existing skill id with that level!");
				showNpcSkillEdit(activeChar, npcId, skillId);
				return;
			}

			if (skillData.getLevel() != level)
			{
				activeChar.sendMessage("Skill id with requested level doesn't exist! Skill level not changed.");
				showNpcSkillEdit(activeChar, npcId, skillId);
				return;
			}

			con = L2DatabaseFactory.getInstance().getConnection();
			int updated = 0;
			if(Config.CUSTOM_NPC_SKILLS_TABLE)
			{
				PreparedStatement statement2 = con.prepareStatement("UPDATE `custom_npcskills` SET `level`=? WHERE `npcid`=? AND `skillid`=?");
				statement2.setInt(1, level);
				statement2.setInt(2, npcId);
				statement2.setInt(3, skillId);

				updated = statement2.executeUpdate();
				statement2.close();
			}
			if(updated == 0)
			{
				PreparedStatement statement = con.prepareStatement("UPDATE `npcskills` SET `level`=? WHERE `npcid`=? AND `skillid`=?");
				statement.setInt(1, level);
				statement.setInt(2, npcId);
				statement.setInt(3, skillId);

				statement.execute();
				statement.close();
			}
			reloadNpcSkillList(npcId);

			showNpcSkillList(activeChar, npcId, 0);
			activeChar.sendMessage("Updated skill id " + skillId + " for npc id " + npcId + " to level " + level + ".");
		}
		catch (Exception e)
		{
			activeChar.sendMessage("Could not update npc skill!");
			_log.warning("Error while updating npc skill (" + npcId + ", " + skillId + ", " + level + "): " + e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private updateNpcSkillData(activeChar L2PcInstance, npcId int, skillId int, level int) : void from class handlers.admincommandhandlers.AdminEditNpc


	private void addNpcSkillData(L2PcInstance activeChar, int npcId, int skillId, int level)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			// skill check
			L2Skill skillData = SkillTable.getInstance().getInfo(skillId, level);
			if (skillData == null)
			{
				activeChar.sendMessage("Could not add npc skill: not existing skill id with that level!");
				showNpcSkillAdd(activeChar, npcId);
				return;
			}

			if (Config.CUSTOM_NPC_SKILLS_TABLE)
			{
				PreparedStatement statement = con.prepareStatement("INSERT INTO `custom_npcskills`(`npcid`, `skillid`, `level`) VALUES(?,?,?)");
				statement.setInt(1, npcId);
				statement.setInt(2, skillId);
				statement.setInt(3, level);
				statement.execute();
				statement.close();
			}
			else
			{
				PreparedStatement statement = con.prepareStatement("INSERT INTO `npcskills`(`npcid`, `skillid`, `level`) VALUES(?,?,?)");
				statement.setInt(1, npcId);
				statement.setInt(2, skillId);
				statement.setInt(3, level);
				statement.execute();
				statement.close();
			}

			reloadNpcSkillList(npcId);

			showNpcSkillList(activeChar, npcId, 0);
			activeChar.sendMessage("Added skill " + skillId + "-" + level + " to npc id " + npcId + ".");
		}
		catch (Exception e)
		{
			activeChar.sendMessage("Could not add npc skill!");
			_log.warning("Error while adding a npc skill (" + npcId + ", " + skillId + ", " + level + "): " + e);
		}
	}

	private void addNpcSkillData(L2PcInstance activeChar, int npcId, int skillId, int level)
	{
		Connection con = null;
		try
		{
			// skill check
			L2Skill skillData = SkillTable.getInstance().getInfo(skillId, level);
			if (skillData == null)
			{
				activeChar.sendMessage("Could not add npc skill: not existing skill id with that level!");
				showNpcSkillAdd(activeChar, npcId);
				return;
			}

			con = L2DatabaseFactory.getInstance().getConnection();

			if (Config.CUSTOM_NPC_SKILLS_TABLE)
			{
				PreparedStatement statement = con.prepareStatement("INSERT INTO `custom_npcskills`(`npcid`, `skillid`, `level`) VALUES(?,?,?)");
				statement.setInt(1, npcId);
				statement.setInt(2, skillId);
				statement.setInt(3, level);
				statement.execute();
				statement.close();
			}
			else
			{
				PreparedStatement statement = con.prepareStatement("INSERT INTO `npcskills`(`npcid`, `skillid`, `level`) VALUES(?,?,?)");
				statement.setInt(1, npcId);
				statement.setInt(2, skillId);
				statement.setInt(3, level);
				statement.execute();
				statement.close();
			}

			reloadNpcSkillList(npcId);

			showNpcSkillList(activeChar, npcId, 0);
			activeChar.sendMessage("Added skill " + skillId + "-" + level + " to npc id " + npcId + ".");
		}
		catch (Exception e)
		{
			activeChar.sendMessage("Could not add npc skill!");
			_log.warning("Error while adding a npc skill (" + npcId + ", " + skillId + ", " + level + "): " + e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private addNpcSkillData(activeChar L2PcInstance, npcId int, skillId int, level int) : void from class handlers.admincommandhandlers.AdminEditNpc


	private void deleteNpcSkillData(L2PcInstance activeChar, int npcId, int skillId)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			if (npcId > 0)
			{
				int updated = 0;
				if (Config.CUSTOM_NPC_SKILLS_TABLE)
				{
					PreparedStatement statement = con.prepareStatement("DELETE FROM `custom_npcskills` WHERE `npcid`=? AND `skillid`=?");
					statement.setInt(1, npcId);
					statement.setInt(2, skillId);
					updated = statement.executeUpdate();
					statement.close();
				}
				if (updated == 0)
				{
					PreparedStatement statement2 = con.prepareStatement("DELETE FROM `npcskills` WHERE `npcid`=? AND `skillid`=?");
					statement2.setInt(1, npcId);
					statement2.setInt(2, skillId);
					statement2.execute();
					statement2.close();
				}

				reloadNpcSkillList(npcId);

				showNpcSkillList(activeChar, npcId, 0);
				activeChar.sendMessage("Deleted skill id " + skillId + " from npc id " + npcId + ".");
			}
		}
		catch (Exception e)
		{
			activeChar.sendMessage("Could not delete npc skill!");
			_log.warning("Error while deleting npc skill (" + npcId + ", " + skillId + "): " + e);
		}
	}

	private void deleteNpcSkillData(L2PcInstance activeChar, int npcId, int skillId)
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();

			if (npcId > 0)
			{
				int updated = 0;
				if (Config.CUSTOM_NPC_SKILLS_TABLE)
				{
					PreparedStatement statement = con.prepareStatement("DELETE FROM `custom_npcskills` WHERE `npcid`=? AND `skillid`=?");
					statement.setInt(1, npcId);
					statement.setInt(2, skillId);
					updated = statement.executeUpdate();
					statement.close();
				}
				if (updated == 0)
				{
					PreparedStatement statement2 = con.prepareStatement("DELETE FROM `npcskills` WHERE `npcid`=? AND `skillid`=?");
					statement2.setInt(1, npcId);
					statement2.setInt(2, skillId);
					statement2.execute();
					statement2.close();
				}

				reloadNpcSkillList(npcId);

				showNpcSkillList(activeChar, npcId, 0);
				activeChar.sendMessage("Deleted skill id " + skillId + " from npc id " + npcId + ".");
			}
		}
		catch (Exception e)
		{
			activeChar.sendMessage("Could not delete npc skill!");
			_log.warning("Error while deleting npc skill (" + npcId + ", " + skillId + "): " + e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private deleteNpcSkillData(activeChar L2PcInstance, npcId int, skillId int) : void from class handlers.admincommandhandlers.AdminEditNpc


	private void reloadNpcSkillList(int npcId)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			L2NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);

			L2Skill skillData = null;
			if (npcData.getSkills() != null)
				npcData.getSkills().clear();

			// without race
			PreparedStatement statement = con.prepareStatement("SELECT `skillid`, `level` FROM `npcskills` WHERE `npcid`=? AND `skillid` <> 4416");
			statement.setInt(1, npcId);
			ResultSet skillDataList = statement.executeQuery();

			while (skillDataList.next())
			{
				int idval = skillDataList.getInt("skillid");
				int levelval = skillDataList.getInt("level");
				skillData = SkillTable.getInstance().getInfo(idval, levelval);
				if (skillData != null)
					npcData.addSkill(skillData);
			}
			skillDataList.close();
			statement.close();

			if (Config.CUSTOM_NPC_SKILLS_TABLE)
			{
				PreparedStatement statement2 = con.prepareStatement("SELECT `skillid`, `level` FROM `npcskills` WHERE `npcid`=? AND `skillid` <> 4416");
				statement2.setInt(1, npcId);
				ResultSet skillDataList2 = statement2.executeQuery();

				while (skillDataList2.next())
				{
					int idval = skillDataList2.getInt("skillid");
					int levelval = skillDataList2.getInt("level");
					skillData = SkillTable.getInstance().getInfo(idval, levelval);
					if (skillData != null)
						npcData.addSkill(skillData);
				}
				skillDataList2.close();
				statement2.close();
			}
		}
		catch (Exception e)
		{
			_log.warning("Error while reloading npc skill list (" + npcId + "): " + e);
		}
	}

	private void reloadNpcSkillList(int npcId)
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			L2NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);

			L2Skill skillData = null;
			if (npcData.getSkills() != null)
				npcData.getSkills().clear();

			// without race
			PreparedStatement statement = con.prepareStatement("SELECT `skillid`, `level` FROM `npcskills` WHERE `npcid`=? AND `skillid` <> 4416");
			statement.setInt(1, npcId);
			ResultSet skillDataList = statement.executeQuery();

			while (skillDataList.next())
			{
				int idval = skillDataList.getInt("skillid");
				int levelval = skillDataList.getInt("level");
				skillData = SkillTable.getInstance().getInfo(idval, levelval);
				if (skillData != null)
					npcData.addSkill(skillData);
			}
			skillDataList.close();
			statement.close();

			if (Config.CUSTOM_NPC_SKILLS_TABLE)
			{
				PreparedStatement statement2 = con.prepareStatement("SELECT `skillid`, `level` FROM `npcskills` WHERE `npcid`=? AND `skillid` <> 4416");
				statement2.setInt(1, npcId);
				ResultSet skillDataList2 = statement2.executeQuery();

				while (skillDataList2.next())
				{
					int idval = skillDataList2.getInt("skillid");
					int levelval = skillDataList2.getInt("level");
					skillData = SkillTable.getInstance().getInfo(idval, levelval);
					if (skillData != null)
						npcData.addSkill(skillData);
				}
				skillDataList2.close();
				statement2.close();
			}
		}
		catch (Exception e)
		{
			_log.warning("Error while reloading npc skill list (" + npcId + "): " + e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private reloadNpcSkillList(npcId int) : void from class handlers.admincommandhandlers.AdminEditNpc


	private void handleRepair(String command)
	{
		String[] parts = command.split(" ");
		if (parts.length != 2)
		{
			return;
		}

		String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement(cmd);
			statement.setString(1, parts[1]);
			statement.execute();
			statement.close();

			statement = con.prepareStatement("SELECT charId FROM characters where char_name=?");
			statement.setString(1, parts[1]);
			ResultSet rset = statement.executeQuery();
			int objId = 0;
			if (rset.next())
			{
				objId = rset.getInt(1);
			}

			rset.close();
			statement.close();

			if (objId == 0)
			{
				con.close();
				return;
			}

			//connection = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
			statement.setInt(1, objId);
			statement.execute();
			statement.close();

			//connection = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
			statement.setInt(1, objId);
			statement.execute();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "could not repair char:", e);
		}
	}

	private void handleRepair(String command)
	{
		String[] parts = command.split(" ");
		if (parts.length != 2)
		{
			return;
		}

		String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement(cmd);
			statement.setString(1, parts[1]);
			statement.execute();
			statement.close();

			statement = con.prepareStatement("SELECT charId FROM characters where char_name=?");
			statement.setString(1, parts[1]);
			ResultSet rset = statement.executeQuery();
			int objId = 0;
			if (rset.next())
			{
				objId = rset.getInt(1);
			}

			rset.close();
			statement.close();

			if (objId == 0)
			{
				con.close();
				return;
			}

			//connection = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
			statement.setInt(1, objId);
			statement.execute();
			statement.close();

			//connection = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
			statement.setInt(1, objId);
			statement.execute();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "could not repair char:", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private handleRepair(command String) : void from class handlers.admincommandhandlers.AdminRepairChar


private void showquestmenu(L2PcInstance target, L2PcInstance actor, String[] val)
	{
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			ResultSet rs;
			PreparedStatement req;
			int ID = target.getObjectId();

			TextBuilder replyMSG = new TextBuilder("");
			NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

			if (val[0].equals("full"))
			{
				replyMSG.append("

Full Quest List for "+target.getName()+" (ID:"+ID+")
");
				req = con.prepareStatement("SELECT DISTINCT name FROM character_quests WHERE charId='" + ID +"' ORDER by name");
				req.execute();
				rs = req.getResultSet();
				while(rs.next()) replyMSG.append("
"+rs.getString(1)+"
");
				replyMSG.append("
");
			}
			else if (val[0].equals("name"))
			{
				String[] states = {"CREATED","STARTED","COMPLETED"};
				String state = states[target.getQuestState(val[1]).getState()];
				replyMSG.append("Character: "+target.getName()+"
Quest: "+val[1]+"
State: "+state+"

");
				replyMSG.append("

Var	Value	New Value
");
				req = con.prepareStatement("SELECT var,value FROM character_quests WHERE charId='" + ID +"' and name='"+val[1]+"'");
				req.execute();
				rs = req.getResultSet();
				while(rs.next()){
					String var_name = rs.getString(1);
					if (var_name.equals("<state>"))
					{
						continue;
					}
					replyMSG.append("
"+var_name+"	"+rs.getString(2)+"	<edit var=\"var"+var_name+"\" width=80 height=15>	<button value=\"Set\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" "+var_name+" $var"+var_name+"\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	<button value=\"Del\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" "+var_name+" delete\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
				}
				replyMSG.append("

Repeatable quest:	Unrepeatable quest:
");
				replyMSG.append("
<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" state COMLETED 1\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	");
				replyMSG.append("<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" state COMLETED 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
				replyMSG.append("

Delete Quest from DB:
<button value=\"Quest Delete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" state DELETE\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
				replyMSG.append("");
			}
			else if (val[0].equals("var"))
			{
				replyMSG.append("Character: "+target.getName()+"
Quests with state: "+val[1]+"
");
				replyMSG.append("
");
				req = con.prepareStatement("SELECT DISTINCT name FROM character_quests WHERE charId='" + ID +"' and var='<state>' and value='"+val[1]+"'");
				req.execute();
				rs = req.getResultSet();
				while(rs.next()) replyMSG.append("
" + rs.getString(1)+"
");
				replyMSG.append("
");
			}
			else if (val[0].equals("custom"))
			{
				boolean exqdb = true;
				boolean exqch = true;
				int qnumber = Integer.parseInt(val[1]);
				String state = null;
				String qname = null;
				QuestState qs = null;
				String[] states = {"CREATED","STARTED","COMPLETED"};

				Quest quest = QuestManager.getInstance().getQuest(qnumber);

				if (quest != null)
				{
					qname = quest.getName();
					qs = target.getQuestState(qname);
				}
				else
				{
					exqdb = false;
				}

				if (qs != null)
				{
					state = states[qs.getState()];
				}
				else { exqch = false; state = "N/A"; }

				if(exqdb)
				{
					if(exqch) {
						replyMSG.append("Character: "+target.getName()+"
Quest: "+qname+"
State: "+state+"

");
						replyMSG.append("

Var	Value	New Value
");
						req = con.prepareStatement("SELECT var,value FROM character_quests WHERE charId='" + ID +"' and name='"+qname+"'");
						req.execute();
						rs = req.getResultSet();
						while(rs.next())
						{
							String var_name = rs.getString(1);
							if (var_name.equals("<state>"))
							{
								continue;
							}
							replyMSG.append("
"+var_name+"	"+rs.getString(2)+"	<edit var=\"var"+var_name+"\" width=80 height=15>	<button value=\"Set\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" "+var_name+" $var"+var_name+"\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	<button value=\"Del\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" "+var_name+" delete\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
						}
						replyMSG.append("

Repeatable quest:	Unrepeatable quest:
");
						replyMSG.append("
<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" state COMLETED 1\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	");
						replyMSG.append("<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" state COMLETED 0\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
						replyMSG.append("

Delete Quest from DB:
<button value=\"Quest Delete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" state DELETE\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
						replyMSG.append("");
					}
					else
					{
						replyMSG.append("Character: "+target.getName()+"
Quest: "+qname+"
State: "+state+"

");
						replyMSG.append("Start this Quest for player:
");
						replyMSG.append("<button value=\"Create Quest\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qnumber+" state CREATE\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">

");
						replyMSG.append("Only for Unrepeateble quests:
");
						replyMSG.append("<button value=\"Create & Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qnumber+" state CC\" width=130 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">

");
						replyMSG.append("");
					}
				}
				else
				{
					replyMSG.append("Quest with number "+qnumber+" doesn't exist!");
				}
			}
			adminReply.setHtml(replyMSG.toString());
			actor.sendPacket(adminReply);
		}
		catch (Exception e)
		{
			actor.sendMessage("Error!");
		}
	}

private void showquestmenu(L2PcInstance target, L2PcInstance actor, String[] val)
	{
		Connection con = null;
		try
		{
			ResultSet rs;
			PreparedStatement req;
			int ID = target.getObjectId();

			TextBuilder replyMSG = new TextBuilder("");
			NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
			con = L2DatabaseFactory.getInstance().getConnection();

			if (val[0].equals("full"))
			{
				replyMSG.append("

Full Quest List for "+target.getName()+" (ID:"+ID+")
");
				req = con.prepareStatement("SELECT DISTINCT name FROM character_quests WHERE charId='" + ID +"' ORDER by name");
				req.execute();
				rs = req.getResultSet();
				while(rs.next()) replyMSG.append("
"+rs.getString(1)+"
");
				replyMSG.append("
");
				L2DatabaseFactory.close(con);
			}
			else if (val[0].equals("name"))
			{
				String[] states = {"CREATED","STARTED","COMPLETED"};
				String state = states[target.getQuestState(val[1]).getState()];
				replyMSG.append("Character: "+target.getName()+"
Quest: "+val[1]+"
State: "+state+"

");
				replyMSG.append("

Var	Value	New Value
");
				req = con.prepareStatement("SELECT var,value FROM character_quests WHERE charId='" + ID +"' and name='"+val[1]+"'");
				req.execute();
				rs = req.getResultSet();
				while(rs.next()){
					String var_name = rs.getString(1);
					if (var_name.equals("<state>"))
					{
						continue;
					}
					replyMSG.append("
"+var_name+"	"+rs.getString(2)+"	<edit var=\"var"+var_name+"\" width=80 height=15>	<button value=\"Set\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" "+var_name+" $var"+var_name+"\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	<button value=\"Del\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" "+var_name+" delete\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
				}
				replyMSG.append("

Repeatable quest:	Unrepeatable quest:
");
				replyMSG.append("
<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" state COMLETED 1\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	");
				replyMSG.append("<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" state COMLETED 0\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
				replyMSG.append("

Delete Quest from DB:
<button value=\"Quest Delete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+val[1]+" state DELETE\" width=120 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
				replyMSG.append("");
				L2DatabaseFactory.close(con);
			}
			else if (val[0].equals("var"))
			{
				replyMSG.append("Character: "+target.getName()+"
Quests with state: "+val[1]+"
");
				replyMSG.append("
");
				req = con.prepareStatement("SELECT DISTINCT name FROM character_quests WHERE charId='" + ID +"' and var='<state>' and value='"+val[1]+"'");
				req.execute();
				rs = req.getResultSet();
				while(rs.next()) replyMSG.append("
" + rs.getString(1)+"
");
				replyMSG.append("
");
				L2DatabaseFactory.close(con);
			}
			else if (val[0].equals("custom"))
			{
				boolean exqdb = true;
				boolean exqch = true;
				int qnumber = Integer.parseInt(val[1]);
				String state = null;
				String qname = null;
				QuestState qs = null;
				String[] states = {"CREATED","STARTED","COMPLETED"};

				Quest quest = QuestManager.getInstance().getQuest(qnumber);

				if (quest != null)
				{
					qname = quest.getName();
					qs = target.getQuestState(qname);
				}
				else
				{
					exqdb = false;
				}

				if (qs != null)
				{
					state = states[qs.getState()];
				}
				else { exqch = false; state = "N/A"; }

				if(exqdb)
				{
					if(exqch) {
						replyMSG.append("Character: "+target.getName()+"
Quest: "+qname+"
State: "+state+"

");
						replyMSG.append("

Var	Value	New Value
");
						req = con.prepareStatement("SELECT var,value FROM character_quests WHERE charId='" + ID +"' and name='"+qname+"'");
						req.execute();
						rs = req.getResultSet();
						while(rs.next())
						{
							String var_name = rs.getString(1);
							if (var_name.equals("<state>"))
							{
								continue;
							}
							replyMSG.append("
"+var_name+"	"+rs.getString(2)+"	<edit var=\"var"+var_name+"\" width=80 height=15>	<button value=\"Set\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" "+var_name+" $var"+var_name+"\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	<button value=\"Del\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" "+var_name+" delete\" width=30 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
						}
						replyMSG.append("

Repeatable quest:	Unrepeatable quest:
");
						replyMSG.append("
<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" state COMLETED 1\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">	");
						replyMSG.append("<button value=\"Quest Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" state COMLETED 0\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">
");
						replyMSG.append("

Delete Quest from DB:
<button value=\"Quest Delete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qname+" state DELETE\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
						replyMSG.append("");
						L2DatabaseFactory.close(con);
					}
					else
					{
						replyMSG.append("Character: "+target.getName()+"
Quest: "+qname+"
State: "+state+"

");
						replyMSG.append("Start this Quest for player:
");
						replyMSG.append("<button value=\"Create Quest\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qnumber+" state CREATE\" width=100 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">

");
						replyMSG.append("Only for Unrepeateble quests:
");
						replyMSG.append("<button value=\"Create & Complete\" action=\"bypass -h admin_setcharquest "+target.getName()+" "+qnumber+" state CC\" width=130 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">

");
						replyMSG.append("");
					}
				}
				else
				{
					replyMSG.append("Quest with number "+qnumber+" doesn't exist!");
				}
			}
			adminReply.setHtml(replyMSG.toString());
			actor.sendPacket(adminReply);
		}
		catch (Exception e)
		{
			actor.sendMessage("Error!");
			//e.printStackTrace();
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private showquestmenu(target L2PcInstance, actor L2PcInstance, val String[]) : void from class handlers.admincommandhandlers.AdminShowQuests


	private void changeCharacterPosition(L2PcInstance activeChar, String name)
	{
		final int x = activeChar.getX();
		final int y = activeChar.getY();
		final int z = activeChar.getZ();
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
			statement.setInt(1, x);
			statement.setInt(2, y);
			statement.setInt(3, z);
			statement.setString(4, name);
			statement.execute();
			int count = statement.getUpdateCount();
			statement.close();
			if (count == 0)
				activeChar.sendMessage("Character not found or position unaltered.");
			else
				activeChar.sendMessage("Player's [" + name + "] position is now set to (" + x + "," + y + "," + z + ").");
		}
		catch (SQLException se)
		{
			activeChar.sendMessage("SQLException while changing offline character's position");
		}
	}

	private void changeCharacterPosition(L2PcInstance activeChar, String name)
	{
		Connection con = null;
		final int x = activeChar.getX();
		final int y = activeChar.getY();
		final int z = activeChar.getZ();
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
			statement.setInt(1, x);
			statement.setInt(2, y);
			statement.setInt(3, z);
			statement.setString(4, name);
			statement.execute();
			int count = statement.getUpdateCount();
			statement.close();
			if (count == 0)
				activeChar.sendMessage("Character not found or position unaltered.");
			else
				activeChar.sendMessage("Player's [" + name + "] position is now set to (" + x + "," + y + "," + z + ").");
		}
		catch (SQLException se)
		{
			activeChar.sendMessage("SQLException while changing offline character's position");
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method private changeCharacterPosition(activeChar L2PcInstance, name String) : void from class handlers.admincommandhandlers.AdminTeleport


	@Override
	public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime)
	{
		if (command.startsWith("kick"))
		{
			try
			{
				command = command.substring(5);
				L2PcInstance player = L2World.getInstance().getPlayer(command);
				if (player != null)
				{
					player.sendMessage("You are kicked by gm");
					player.logout();
					_print.println("Player kicked");
				}
			}
			catch (StringIndexOutOfBoundsException e)
			{
				_print.println("Please enter player name to kick");
			}
		}
		else if (command.startsWith("give"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(5));

			try
			{
				L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken());
				int itemId = Integer.parseInt(st.nextToken());
				int amount = Integer.parseInt(st.nextToken());

				if (player != null)
				{
					L2ItemInstance item = player.getInventory().addItem("Status-Give", itemId, amount, null, null);
					InventoryUpdate iu = new InventoryUpdate();
					iu.addItem(item);
					player.sendPacket(iu);
					SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2);
					sm.addItemName(itemId);
					sm.addItemNumber(amount);
					player.sendPacket(sm);
					_print.println("ok");
					GMAudit.auditGMAction("Telnet Admin", "Give Item", player.getName(), "item: " + itemId + " amount: " + amount);
				}
				else
				{
					_print.println("Player not found");
				}
			}
			catch (Exception e)
			{

			}
		}
		else if (command.startsWith("enchant"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(8), " ");
			int enchant = 0, itemType = 0;

			try
			{
				L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken());
				itemType = Integer.parseInt(st.nextToken());
				enchant = Integer.parseInt(st.nextToken());

				switch (itemType)
				{
					case 1:
						itemType = Inventory.PAPERDOLL_HEAD;
						break;
					case 2:
						itemType = Inventory.PAPERDOLL_CHEST;
						break;
					case 3:
						itemType = Inventory.PAPERDOLL_GLOVES;
						break;
					case 4:
						itemType = Inventory.PAPERDOLL_FEET;
						break;
					case 5:
						itemType = Inventory.PAPERDOLL_LEGS;
						break;
					case 6:
						itemType = Inventory.PAPERDOLL_RHAND;
						break;
					case 7:
						itemType = Inventory.PAPERDOLL_LHAND;
						break;
					case 8:
						itemType = Inventory.PAPERDOLL_LEAR;
						break;
					case 9:
						itemType = Inventory.PAPERDOLL_REAR;
						break;
					case 10:
						itemType = Inventory.PAPERDOLL_LFINGER;
						break;
					case 11:
						itemType = Inventory.PAPERDOLL_RFINGER;
						break;
					case 12:
						itemType = Inventory.PAPERDOLL_NECK;
						break;
					case 13:
						itemType = Inventory.PAPERDOLL_UNDER;
						break;
					case 14:
						itemType = Inventory.PAPERDOLL_CLOAK;
						break;
					case 15:
						itemType = Inventory.PAPERDOLL_BELT;
						break;
					default:
						itemType = 0;
				}

				if (enchant > 65535)
					enchant = 65535;
				else if (enchant < 0)
					enchant = 0;

				boolean success = false;

				if (player != null && itemType > 0)
				{
					success = setEnchant(player, enchant, itemType);
					if (success)
						_print.println("Item enchanted successfully.");
				}
				else if (!success)
					_print.println("Item failed to enchant.");
			}
			catch (Exception e)
			{

			}
		}
		else if (command.startsWith("jail"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(5));
			try
			{
				String name = st.nextToken();
				L2PcInstance playerObj = L2World.getInstance().getPlayer(name);
				int delay = 0;
				try
				{
					delay = Integer.parseInt(st.nextToken());
				}
				catch (NumberFormatException nfe)
				{
				}
				catch (NoSuchElementException nsee)
				{
				}
				// L2PcInstance playerObj = L2World.getInstance().getPlayer(player);

				if (playerObj != null)
				{
					playerObj.setPunishLevel(L2PcInstance.PunishLevel.JAIL, delay);
					_print.println("Character " + playerObj.getName() + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!"));
				}
				else
				{
					try (Connection con = L2DatabaseFactory.getInstance().getConnection())
					{
						PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
						statement.setInt(1, -114356);
						statement.setInt(2, -249645);
						statement.setInt(3, -2984);
						statement.setInt(4, L2PcInstance.PunishLevel.JAIL.value());
						statement.setLong(5, delay * 60000L);
						statement.setString(6, name);

						statement.execute();
						int count = statement.getUpdateCount();
						statement.close();

						if (count == 0)
							_print.println("Character not found!");
						else
							_print.println("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!"));
					}
					catch (SQLException se)
					{
						_print.println("SQLException while jailing player");
						if (Config.DEBUG)
							se.printStackTrace();
					}
				}
			}
			catch (NoSuchElementException nsee)
			{
				_print.println("Specify a character name.");
			}
			catch (Exception e)
			{
				if (Config.DEBUG)
					e.printStackTrace();
			}
		}
		else if (command.startsWith("unjail"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(7));
			try
			{
				String name = st.nextToken();
				L2PcInstance playerObj = L2World.getInstance().getPlayer(name);

				if (playerObj != null)
				{
					playerObj.setPunishLevel(L2PcInstance.PunishLevel.NONE, 0);
					_print.println("Character " + playerObj.getName() + " removed from jail");
				}
				else
				{
					try (Connection con = L2DatabaseFactory.getInstance().getConnection())
					{
						PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
						statement.setInt(1, 17836);
						statement.setInt(2, 170178);
						statement.setInt(3, -3507);
						statement.setInt(4, 0);
						statement.setLong(5, 0);
						statement.setString(6, name);

						statement.execute();
						int count = statement.getUpdateCount();
						statement.close();

						if (count == 0)
							_print.println("Character not found!");
						else
							_print.println("Character " + name + " set free.");
					}
					catch (SQLException se)
					{
						_print.println("SQLException while jailing player");
						if (Config.DEBUG)
							se.printStackTrace();
					}
				}
			}
			catch (NoSuchElementException nsee)
			{
				_print.println("Specify a character name.");
			}
			catch (Exception e)
			{
				if (Config.DEBUG)
					e.printStackTrace();
			}
		}
		return false;
	}

	@Override
	public boolean useCommand(String command, PrintWriter _print, Socket _cSocket, int _uptime)
	{
		if (command.startsWith("kick"))
		{
			try
			{
				command = command.substring(5);
				L2PcInstance player = L2World.getInstance().getPlayer(command);
				if (player != null)
				{
					player.sendMessage("You are kicked by gm");
					player.logout();
					_print.println("Player kicked");
				}
			}
			catch (StringIndexOutOfBoundsException e)
			{
				_print.println("Please enter player name to kick");
			}
		}
		else if (command.startsWith("give"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(5));

			try
			{
				L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken());
				int itemId = Integer.parseInt(st.nextToken());
				int amount = Integer.parseInt(st.nextToken());

				if (player != null)
				{
					L2ItemInstance item = player.getInventory().addItem("Status-Give", itemId, amount, null, null);
					InventoryUpdate iu = new InventoryUpdate();
					iu.addItem(item);
					player.sendPacket(iu);
					SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2);
					sm.addItemName(itemId);
					sm.addItemNumber(amount);
					player.sendPacket(sm);
					_print.println("ok");
					GMAudit.auditGMAction("Telnet Admin", "Give Item", player.getName(), "item: " + itemId + " amount: " + amount);
				}
				else
				{
					_print.println("Player not found");
				}
			}
			catch (Exception e)
			{

			}
		}
		else if (command.startsWith("enchant"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(8), " ");
			int enchant = 0, itemType = 0;

			try
			{
				L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken());
				itemType = Integer.parseInt(st.nextToken());
				enchant = Integer.parseInt(st.nextToken());

				switch (itemType)
				{
					case 1:
						itemType = Inventory.PAPERDOLL_HEAD;
						break;
					case 2:
						itemType = Inventory.PAPERDOLL_CHEST;
						break;
					case 3:
						itemType = Inventory.PAPERDOLL_GLOVES;
						break;
					case 4:
						itemType = Inventory.PAPERDOLL_FEET;
						break;
					case 5:
						itemType = Inventory.PAPERDOLL_LEGS;
						break;
					case 6:
						itemType = Inventory.PAPERDOLL_RHAND;
						break;
					case 7:
						itemType = Inventory.PAPERDOLL_LHAND;
						break;
					case 8:
						itemType = Inventory.PAPERDOLL_LEAR;
						break;
					case 9:
						itemType = Inventory.PAPERDOLL_REAR;
						break;
					case 10:
						itemType = Inventory.PAPERDOLL_LFINGER;
						break;
					case 11:
						itemType = Inventory.PAPERDOLL_RFINGER;
						break;
					case 12:
						itemType = Inventory.PAPERDOLL_NECK;
						break;
					case 13:
						itemType = Inventory.PAPERDOLL_UNDER;
						break;
					case 14:
						itemType = Inventory.PAPERDOLL_CLOAK;
						break;
					case 15:
						itemType = Inventory.PAPERDOLL_BELT;
						break;
					default:
						itemType = 0;
				}

				if (enchant > 65535)
					enchant = 65535;
				else if (enchant < 0)
					enchant = 0;

				boolean success = false;

				if (player != null && itemType > 0)
				{
					success = setEnchant(player, enchant, itemType);
					if (success)
						_print.println("Item enchanted successfully.");
				}
				else if (!success)
					_print.println("Item failed to enchant.");
			}
			catch (Exception e)
			{

			}
		}
		else if (command.startsWith("jail"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(5));
			try
			{
				String name = st.nextToken();
				L2PcInstance playerObj = L2World.getInstance().getPlayer(name);
				int delay = 0;
				try
				{
					delay = Integer.parseInt(st.nextToken());
				}
				catch (NumberFormatException nfe)
				{
				}
				catch (NoSuchElementException nsee)
				{
				}
				// L2PcInstance playerObj = L2World.getInstance().getPlayer(player);

				if (playerObj != null)
				{
					playerObj.setPunishLevel(L2PcInstance.PunishLevel.JAIL, delay);
					_print.println("Character " + playerObj.getName() + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!"));
				}
				else
				{
					Connection con = null;
					try
					{
						con = L2DatabaseFactory.getInstance().getConnection();

						PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
						statement.setInt(1, -114356);
						statement.setInt(2, -249645);
						statement.setInt(3, -2984);
						statement.setInt(4, L2PcInstance.PunishLevel.JAIL.value());
						statement.setLong(5, delay * 60000L);
						statement.setString(6, name);

						statement.execute();
						int count = statement.getUpdateCount();
						statement.close();

						if (count == 0)
							_print.println("Character not found!");
						else
							_print.println("Character " + name + " jailed for " + (delay > 0 ? delay + " minutes." : "ever!"));
					}
					catch (SQLException se)
					{
						_print.println("SQLException while jailing player");
						if (Config.DEBUG)
							se.printStackTrace();
					}
					finally
					{
						L2DatabaseFactory.close(con);
					}
				}
			}
			catch (NoSuchElementException nsee)
			{
				_print.println("Specify a character name.");
			}
			catch (Exception e)
			{
				if (Config.DEBUG)
					e.printStackTrace();
			}
		}
		else if (command.startsWith("unjail"))
		{
			StringTokenizer st = new StringTokenizer(command.substring(7));
			try
			{
				String name = st.nextToken();
				L2PcInstance playerObj = L2World.getInstance().getPlayer(name);

				if (playerObj != null)
				{
					playerObj.setPunishLevel(L2PcInstance.PunishLevel.NONE, 0);
					_print.println("Character " + playerObj.getName() + " removed from jail");
				}
				else
				{
					Connection con = null;
					try
					{
						con = L2DatabaseFactory.getInstance().getConnection();

						PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
						statement.setInt(1, 17836);
						statement.setInt(2, 170178);
						statement.setInt(3, -3507);
						statement.setInt(4, 0);
						statement.setLong(5, 0);
						statement.setString(6, name);

						statement.execute();
						int count = statement.getUpdateCount();
						statement.close();

						if (count == 0)
							_print.println("Character not found!");
						else
							_print.println("Character " + name + " set free.");
					}
					catch (SQLException se)
					{
						_print.println("SQLException while jailing player");
						if (Config.DEBUG)
							se.printStackTrace();
					}
					finally
					{
						L2DatabaseFactory.close(con);
					}
				}
			}
			catch (NoSuchElementException nsee)
			{
				_print.println("Specify a character name.");
			}
			catch (Exception e)
			{
				if (Config.DEBUG)
					e.printStackTrace();
			}
		}
		return false;
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method public useCommand(command String, _print PrintWriter, _cSocket Socket, _uptime int) : boolean from class handlers.telnethandlers.PlayerHandler


	@Override
	public boolean useUserCommand(int id, L2PcInstance activeChar)
	{
		if (id != COMMAND_IDS[0] && id != COMMAND_IDS[1] && id != COMMAND_IDS[2])
			return false;

		L2Clan clan = activeChar.getClan();

		if (clan == null)
		{
			activeChar.sendMessage("You are not in a clan.");
			return false;
		}

		SystemMessage sm;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			PreparedStatement statement;

			if (id == 88)
			{
				// Attack List
				activeChar.sendPacket(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON);
				statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 not in (select clan1 from clan_wars where clan2=?)");
				statement.setInt(1, clan.getClanId());
				statement.setInt(2, clan.getClanId());
			}
			else if (id == 89)
			{
				// Under Attack List
				activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
				statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan2=? and clan_id=clan1 and clan1 not in (select clan2 from clan_wars where clan1=?)");
				statement.setInt(1, clan.getClanId());
				statement.setInt(2, clan.getClanId());
			}
			else
				// ID = 90
			{
				// War List
				activeChar.sendPacket(SystemMessageId.WAR_LIST);
				statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 in (select clan1 from clan_wars where clan2=?)");
				statement.setInt(1, clan.getClanId());
				statement.setInt(2, clan.getClanId());
			}

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				String clanName = rset.getString("clan_name");
				int ally_id = rset.getInt("ally_id");

				if (ally_id > 0)
				{
					// Target With Ally
					sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
					sm.addString(clanName);
					sm.addString(rset.getString("ally_name"));
				}
				else
				{
					// Target Without Ally
					sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS);
					sm.addString(clanName);
				}

				activeChar.sendPacket(sm);
			}

			activeChar.sendPacket(SystemMessageId.FRIEND_LIST_FOOTER);

			rset.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
		}

		return true;
	}

	@Override
	public boolean useUserCommand(int id, L2PcInstance activeChar)
	{
		if (id != COMMAND_IDS[0] && id != COMMAND_IDS[1] && id != COMMAND_IDS[2])
			return false;

		L2Clan clan = activeChar.getClan();

		if (clan == null)
		{
			activeChar.sendMessage("You are not in a clan.");
			return false;
		}

		SystemMessage sm;
		java.sql.Connection con = null;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement;

			if (id == 88)
			{
				// Attack List
				activeChar.sendPacket(SystemMessageId.CLANS_YOU_DECLARED_WAR_ON);
				statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 not in (select clan1 from clan_wars where clan2=?)");
				statement.setInt(1, clan.getClanId());
				statement.setInt(2, clan.getClanId());
			}
			else if (id == 89)
			{
				// Under Attack List
				activeChar.sendPacket(SystemMessageId.CLANS_THAT_HAVE_DECLARED_WAR_ON_YOU);
				statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan2=? and clan_id=clan1 and clan1 not in (select clan2 from clan_wars where clan1=?)");
				statement.setInt(1, clan.getClanId());
				statement.setInt(2, clan.getClanId());
			}
			else
				// ID = 90
			{
				// War List
				activeChar.sendPacket(SystemMessageId.WAR_LIST);
				statement = con.prepareStatement("select clan_name,clan_id,ally_id,ally_name from clan_data,clan_wars where clan1=? and clan_id=clan2 and clan2 in (select clan1 from clan_wars where clan2=?)");
				statement.setInt(1, clan.getClanId());
				statement.setInt(2, clan.getClanId());
			}

			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				String clanName = rset.getString("clan_name");
				int ally_id = rset.getInt("ally_id");

				if (ally_id > 0)
				{
					// Target With Ally
					sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_ALLIANCE);
					sm.addString(clanName);
					sm.addString(rset.getString("ally_name"));
				}
				else
				{
					// Target Without Ally
					sm = SystemMessage.getSystemMessage(SystemMessageId.S1_NO_ALLI_EXISTS);
					sm.addString(clanName);
				}

				activeChar.sendPacket(sm);
			}

			activeChar.sendPacket(SystemMessageId.FRIEND_LIST_FOOTER);

			rset.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		return true;
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method public useUserCommand(id int, activeChar L2PcInstance) : boolean from class handlers.usercommandhandlers.ClanWarsList


	public boolean engage(L2PcInstance activeChar)
	{
		if (activeChar.getTarget() == null)
		{
			activeChar.sendMessage("You have no one targeted.");
			return false;
		}
		else if (!(activeChar.getTarget() instanceof L2PcInstance))
		{
			activeChar.sendMessage("You can only ask another player to engage you.");
			return false;
		}
		else if (activeChar.getPartnerId() != 0)
		{
			activeChar.sendMessage("You are already engaged.");
			if (Config.L2JMOD_WEDDING_PUNISH_INFIDELITY)
			{
				activeChar.startAbnormalEffect(AbnormalEffect.BIG_HEAD); // give player a Big Head
				// lets recycle the sevensigns debuffs
				int skillId;

				int skillLevel = 1;

				if (activeChar.getLevel() > 40)
				{
					skillLevel = 2;
				}

				if (activeChar.isMageClass())
				{
					skillId = 4362;
				}
				else
				{
					skillId = 4361;
				}

				final L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel);
				if (activeChar.getFirstEffect(skill) == null)
				{
					skill.getEffects(activeChar, activeChar);
					final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
					sm.addSkillName(skill);
					activeChar.sendPacket(sm);
				}
			}
			return false;
		}
		final L2PcInstance ptarget = (L2PcInstance) activeChar.getTarget();
		// check if player target himself
		if (ptarget.getObjectId() == activeChar.getObjectId())
		{
			activeChar.sendMessage("Is there something wrong with you, are you trying to go out with youself?");
			return false;
		}

		if (ptarget.isMarried())
		{
			activeChar.sendMessage("Player already married.");
			return false;
		}

		if (ptarget.isEngageRequest())
		{
			activeChar.sendMessage("Player already asked by someone else.");
			return false;
		}

		if (ptarget.getPartnerId() != 0)
		{
			activeChar.sendMessage("Player already engaged with someone else.");
			return false;
		}

		if ((ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex()) && !Config.L2JMOD_WEDDING_SAMESEX)
		{
			activeChar.sendMessage("Gay marriage is not allowed on this server!");
			return false;
		}

		// check if target has player on friendlist
		boolean FoundOnFriendList = false;
		int objectId;
		try (Connection con = L2DatabaseFactory.getInstance().getConnection())
		{
			final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
			statement.setInt(1, ptarget.getObjectId());
			final ResultSet rset = statement.executeQuery();
			while (rset.next())
			{
				objectId = rset.getInt("friendId");
				if (objectId == activeChar.getObjectId())
				{
					FoundOnFriendList = true;
				}
			}
			statement.close();
		}
		catch (Exception e)
		{
			_log.warning("could not read friend data:" + e);
		}

		if (!FoundOnFriendList)
		{
			activeChar.sendMessage("The player you want to ask is not on your friends list, you must first be on each others friends list before you choose to engage.");
			return false;
		}

		ptarget.setEngageRequest(true, activeChar.getObjectId());
		// $s1
		ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.S1.getId()).addString(activeChar.getName() + " is asking to engage you. Do you want to start a new relationship?");
		ptarget.sendPacket(dlg);
		return true;
	}

	public boolean engage(L2PcInstance activeChar)
	{
		if (activeChar.getTarget() == null)
		{
			activeChar.sendMessage("You have no one targeted.");
			return false;
		}
		else if (!(activeChar.getTarget() instanceof L2PcInstance))
		{
			activeChar.sendMessage("You can only ask another player to engage you.");
			return false;
		}
		else if (activeChar.getPartnerId() != 0)
		{
			activeChar.sendMessage("You are already engaged.");
			if (Config.L2JMOD_WEDDING_PUNISH_INFIDELITY)
			{
				activeChar.startAbnormalEffect(AbnormalEffect.BIG_HEAD); // give player a Big Head
				// lets recycle the sevensigns debuffs
				int skillId;

				int skillLevel = 1;

				if (activeChar.getLevel() > 40)
				{
					skillLevel = 2;
				}

				if (activeChar.isMageClass())
				{
					skillId = 4362;
				}
				else
				{
					skillId = 4361;
				}

				final L2Skill skill = SkillTable.getInstance().getInfo(skillId, skillLevel);
				if (activeChar.getFirstEffect(skill) == null)
				{
					skill.getEffects(activeChar, activeChar);
					final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
					sm.addSkillName(skill);
					activeChar.sendPacket(sm);
				}
			}
			return false;
		}
		final L2PcInstance ptarget = (L2PcInstance) activeChar.getTarget();
		// check if player target himself
		if (ptarget.getObjectId() == activeChar.getObjectId())
		{
			activeChar.sendMessage("Is there something wrong with you, are you trying to go out with youself?");
			return false;
		}

		if (ptarget.isMarried())
		{
			activeChar.sendMessage("Player already married.");
			return false;
		}

		if (ptarget.isEngageRequest())
		{
			activeChar.sendMessage("Player already asked by someone else.");
			return false;
		}

		if (ptarget.getPartnerId() != 0)
		{
			activeChar.sendMessage("Player already engaged with someone else.");
			return false;
		}

		if ((ptarget.getAppearance().getSex() == activeChar.getAppearance().getSex()) && !Config.L2JMOD_WEDDING_SAMESEX)
		{
			activeChar.sendMessage("Gay marriage is not allowed on this server!");
			return false;
		}

		// check if target has player on friendlist
		boolean FoundOnFriendList = false;
		int objectId;
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
			statement.setInt(1, ptarget.getObjectId());
			final ResultSet rset = statement.executeQuery();
			while (rset.next())
			{
				objectId = rset.getInt("friendId");
				if (objectId == activeChar.getObjectId())
				{
					FoundOnFriendList = true;
				}
			}
			statement.close();
		}
		catch (Exception e)
		{
			_log.warning("could not read friend data:" + e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		if (!FoundOnFriendList)
		{
			activeChar.sendMessage("The player you want to ask is not on your friends list, you must first be on each others friends list before you choose to engage.");
			return false;
		}

		ptarget.setEngageRequest(true, activeChar.getObjectId());
		// $s1
		ConfirmDlg dlg = new ConfirmDlg(SystemMessageId.S1.getId()).addString(activeChar.getName() + " is asking to engage you. Do you want to start a new relationship?");
		ptarget.sendPacket(dlg);
		return true;
	}

Try With Resources try(Connection con=L2DatabaseFactory.getInstance().getConnection()) in method public engage(activeChar L2PcInstance) : boolean from class handlers.voicedcommandhandlers.Wedding


	public Keltas(int id, String name, String descr)
	{
		super(id, name, descr);

		addKillId(KELTAS);
		addSpawnId(KELTAS);

		spawnedMonsters = new FastList<>();
	}

	public Keltas(int id, String name, String descr)
	{
		super(id, name, descr);

		addKillId(KELTAS);
		addSpawnId(KELTAS);

		spawnedMonsters = new FastList<L2Spawn>();
	}

Replace Generic With Diamond FastList<L2Spawn> with FastList<> in method public Keltas(id int, name String, descr String) from class ai.individual.Keltas


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if (((target == null || target == activeChar || target.isAlikeDead()) && skill.getCastRange() >= 0) || (!(target instanceof L2Attackable || target instanceof L2Playable)))
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		final L2Character origin;
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));
		final int radius = skill.getSkillRadius();

		if (skill.getCastRange() >= 0)
		{
			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena))
				return _emptyTargetList;

			if (onlyFirst)
				return new L2Character[] { target };

			origin = target;
			targetList.add(origin); // Add target to target list
		}
		else
			origin = activeChar;

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable))
				continue;

			if (obj == origin)
				continue;

			if (Util.checkIfInRange(radius, origin, obj, true))
			{
				if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}

		if (targetList.isEmpty())
			return _emptyTargetList;

		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if (((target == null || target == activeChar || target.isAlikeDead()) && skill.getCastRange() >= 0) || (!(target instanceof L2Attackable || target instanceof L2Playable)))
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		final L2Character origin;
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));
		final int radius = skill.getSkillRadius();

		if (skill.getCastRange() >= 0)
		{
			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena))
				return _emptyTargetList;

			if (onlyFirst)
				return new L2Character[] { target };

			origin = target;
			targetList.add(origin); // Add target to target list
		}
		else
			origin = activeChar;

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable))
				continue;

			if (obj == origin)
				continue;

			if (Util.checkIfInRange(radius, origin, obj, true))
			{
				if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}

		if (targetList.isEmpty())
			return _emptyTargetList;

		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetArea


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if ((!(target instanceof L2Attackable)) || !target.isDead())
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		if (onlyFirst)
			return new L2Character[] { target };

		targetList.add(target);

		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final int radius = skill.getSkillRadius();
		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable) || !Util.checkIfInRange(radius, target, obj, true))
				continue;

			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
				continue;

			targetList.add(obj);
		}

		if (targetList.isEmpty())
			return _emptyTargetList;
		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if ((!(target instanceof L2Attackable)) || !target.isDead())
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		if (onlyFirst)
			return new L2Character[] { target };

		targetList.add(target);

		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final int radius = skill.getSkillRadius();
		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable) || !Util.checkIfInRange(radius, target, obj, true))
				continue;

			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
				continue;

			targetList.add(obj);
		}

		if (targetList.isEmpty())
			return _emptyTargetList;
		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetAreaCorpseMob


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final L2PcInstance sourcePlayer = activeChar.getActingPlayer();

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());

		if (skill.getSkillType() == L2SkillType.DUMMY)
		{
			if (onlyFirst)
				return new L2Character[] { activeChar };

			targetList.add(activeChar);
			for (L2Character obj : objs)
			{
				if (!(obj == activeChar || obj == sourcePlayer || obj instanceof L2Npc || obj instanceof L2Attackable))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}
		else
		{
			for (L2Character obj : objs)
			{
				if (obj instanceof L2Attackable || obj instanceof L2Playable)
				{
					if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
						continue;

					if (onlyFirst)
						return new L2Character[] { obj };

					if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
						break;
					targetList.add(obj);
				}
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final L2PcInstance sourcePlayer = activeChar.getActingPlayer();

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());

		if (skill.getSkillType() == L2SkillType.DUMMY)
		{
			if (onlyFirst)
				return new L2Character[] { activeChar };

			targetList.add(activeChar);
			for (L2Character obj : objs)
			{
				if (!(obj == activeChar || obj == sourcePlayer || obj instanceof L2Npc || obj instanceof L2Attackable))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}
		else
		{
			for (L2Character obj : objs)
			{
				if (obj instanceof L2Attackable || obj instanceof L2Playable)
				{
					if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
						continue;

					if (onlyFirst)
						return new L2Character[] { obj };

					if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
						break;
					targetList.add(obj);
				}
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetAura


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		// Go through the L2Character _knownList
		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());
		for (L2Character obj : objs)
		{
			if (obj instanceof L2Attackable && obj.isDead())
			{
				if (onlyFirst)
					return new L2Character[] { obj };

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		// Go through the L2Character _knownList
		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());
		for (L2Character obj : objs)
		{
			if (obj instanceof L2Attackable && obj.isDead())
			{
				if (onlyFirst)
					return new L2Character[] { obj };

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetAuraCorpseMob


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if (((target == null || target == activeChar || target.isAlikeDead()) && skill.getCastRange() >= 0) || (!(target instanceof L2Attackable || target instanceof L2Playable)))
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		final L2Character origin;
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));
		final int radius = skill.getSkillRadius();

		if (skill.getCastRange() >= 0)
		{
			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena))
				return _emptyTargetList;

			if (onlyFirst)
				return new L2Character[] { target };

			origin = target;
			targetList.add(origin); // Add target to target list
		}
		else
			origin = activeChar;

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable))
				continue;

			if (obj == origin)
				continue;

			if (Util.checkIfInRange(radius, origin, obj, true))
			{
				if (!obj.isBehind(activeChar))
					continue;

				if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}

		if (targetList.isEmpty())
			return _emptyTargetList;

		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if (((target == null || target == activeChar || target.isAlikeDead()) && skill.getCastRange() >= 0) || (!(target instanceof L2Attackable || target instanceof L2Playable)))
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		final L2Character origin;
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));
		final int radius = skill.getSkillRadius();

		if (skill.getCastRange() >= 0)
		{
			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena))
				return _emptyTargetList;

			if (onlyFirst)
				return new L2Character[] { target };

			origin = target;
			targetList.add(origin); // Add target to target list
		}
		else
			origin = activeChar;

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable))
				continue;

			if (obj == origin)
				continue;

			if (Util.checkIfInRange(radius, origin, obj, true))
			{
				if (!obj.isBehind(activeChar))
					continue;

				if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}

		if (targetList.isEmpty())
			return _emptyTargetList;

		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetBehindArea


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final L2PcInstance sourcePlayer = activeChar.getActingPlayer();

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());

		if (skill.getSkillType() == L2SkillType.DUMMY)
		{
			if (onlyFirst)
				return new L2Character[] { activeChar };

			targetList.add(activeChar);
			for (L2Character obj : objs)
			{
				if (!(obj == activeChar || obj == sourcePlayer || obj instanceof L2Npc || obj instanceof L2Attackable))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;
				targetList.add(obj);
			}
		}
		else
		{
			for (L2Character obj : objs)
			{
				if (obj instanceof L2Attackable || obj instanceof L2Playable)
				{

					if (!obj.isBehind(activeChar))
						continue;

					if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
						continue;

					if (onlyFirst)
						return new L2Character[] { obj };

					if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
						break;
					targetList.add(obj);
				}
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final L2PcInstance sourcePlayer = activeChar.getActingPlayer();

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());

		if (skill.getSkillType() == L2SkillType.DUMMY)
		{
			if (onlyFirst)
				return new L2Character[] { activeChar };

			targetList.add(activeChar);
			for (L2Character obj : objs)
			{
				if (!(obj == activeChar || obj == sourcePlayer || obj instanceof L2Npc || obj instanceof L2Attackable))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;
				targetList.add(obj);
			}
		}
		else
		{
			for (L2Character obj : objs)
			{
				if (obj instanceof L2Attackable || obj instanceof L2Playable)
				{

					if (!obj.isBehind(activeChar))
						continue;

					if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
						continue;

					if (onlyFirst)
						return new L2Character[] { obj };

					if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
						break;
					targetList.add(obj);
				}
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetBehindAura


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if (activeChar instanceof L2Npc)
		{
			// for buff purposes, returns friendly mobs nearby and mob itself
			final L2Npc npc = (L2Npc) activeChar;
			if (npc.getFactionId() == null || npc.getFactionId().isEmpty())
			{
				return new L2Character[] { activeChar };
			}
			final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values();
			for (L2Object newTarget : objs)
			{
				if (newTarget instanceof L2Npc && npc.getFactionId().equals(((L2Npc) newTarget).getFactionId()))
				{
					if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true))
						continue;
					if (((L2Npc) newTarget).getFirstEffect(skill) != null)
						continue;
					targetList.add((L2Npc) newTarget);
					break;
				}
			}
			if (targetList.isEmpty())
				targetList.add(npc);
		}
		else
			return _emptyTargetList;
		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if (activeChar instanceof L2Npc)
		{
			// for buff purposes, returns friendly mobs nearby and mob itself
			final L2Npc npc = (L2Npc) activeChar;
			if (npc.getFactionId() == null || npc.getFactionId().isEmpty())
			{
				return new L2Character[] { activeChar };
			}
			final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values();
			for (L2Object newTarget : objs)
			{
				if (newTarget instanceof L2Npc && npc.getFactionId().equals(((L2Npc) newTarget).getFactionId()))
				{
					if (!Util.checkIfInRange(skill.getCastRange(), activeChar, newTarget, true))
						continue;
					if (((L2Npc) newTarget).getFirstEffect(skill) != null)
						continue;
					targetList.add((L2Npc) newTarget);
					break;
				}
			}
			if (targetList.isEmpty())
				targetList.add(npc);
		}
		else
			return _emptyTargetList;
		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetClanMember


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if (target != null && target.isDead())
		{
			final L2PcInstance player;
			if (activeChar instanceof L2PcInstance)
				player = (L2PcInstance) activeChar;
			else
				player = null;

			final L2PcInstance targetPlayer;
			if (target instanceof L2PcInstance)
				targetPlayer = (L2PcInstance) target;
			else
				targetPlayer = null;

			final L2PetInstance targetPet;
			if (target instanceof L2PetInstance)
				targetPet = (L2PetInstance) target;
			else
				targetPet = null;

			if (player != null && (targetPlayer != null || targetPet != null))
			{
				boolean condGood = true;

				if (skill.getSkillType() == L2SkillType.RESURRECT)
				{
					if (targetPlayer != null)
					{
						// check target is not in a active siege zone
						if (targetPlayer.isInsideZone(L2Character.ZONE_SIEGE) && !targetPlayer.isInSiege())
						{
							condGood = false;
							activeChar.sendPacket(SystemMessageId.CANNOT_BE_RESURRECTED_DURING_SIEGE);
						}

						if (targetPlayer.isFestivalParticipant()) // Check to see if the current player target is in a festival.
						{
							condGood = false;
							activeChar.sendMessage("You may not resurrect participants in a festival.");
						}
						if (targetPlayer.isReviveRequested())
						{
							if (targetPlayer.isRevivingPet())
								player.sendPacket(SystemMessageId.MASTER_CANNOT_RES); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
							else
								player.sendPacket(SystemMessageId.RES_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
							condGood = false;
						}
					}
					else if (targetPet != null)
					{
						if (targetPet.getOwner() != player)
						{
							if (targetPet.getOwner().isReviveRequested())
							{
								if (targetPet.getOwner().isRevivingPet())
									player.sendPacket(SystemMessageId.RES_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
								else
									player.sendPacket(SystemMessageId.CANNOT_RES_PET2); // A pet cannot be resurrected while it's owner is in the process of resurrecting.
								condGood = false;
							}
						}
					}
				}

				if (condGood)
				{
					if (!onlyFirst)
					{
						targetList.add(target);
						return targetList.toArray(new L2Object[targetList.size()]);
					}
					return new L2Character[] { target };
				}
			}
		}
		activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
		return _emptyTargetList;
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if (target != null && target.isDead())
		{
			final L2PcInstance player;
			if (activeChar instanceof L2PcInstance)
				player = (L2PcInstance) activeChar;
			else
				player = null;

			final L2PcInstance targetPlayer;
			if (target instanceof L2PcInstance)
				targetPlayer = (L2PcInstance) target;
			else
				targetPlayer = null;

			final L2PetInstance targetPet;
			if (target instanceof L2PetInstance)
				targetPet = (L2PetInstance) target;
			else
				targetPet = null;

			if (player != null && (targetPlayer != null || targetPet != null))
			{
				boolean condGood = true;

				if (skill.getSkillType() == L2SkillType.RESURRECT)
				{
					if (targetPlayer != null)
					{
						// check target is not in a active siege zone
						if (targetPlayer.isInsideZone(L2Character.ZONE_SIEGE) && !targetPlayer.isInSiege())
						{
							condGood = false;
							activeChar.sendPacket(SystemMessageId.CANNOT_BE_RESURRECTED_DURING_SIEGE);
						}

						if (targetPlayer.isFestivalParticipant()) // Check to see if the current player target is in a festival.
						{
							condGood = false;
							activeChar.sendMessage("You may not resurrect participants in a festival.");
						}
						if (targetPlayer.isReviveRequested())
						{
							if (targetPlayer.isRevivingPet())
								player.sendPacket(SystemMessageId.MASTER_CANNOT_RES); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
							else
								player.sendPacket(SystemMessageId.RES_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
							condGood = false;
						}
					}
					else if (targetPet != null)
					{
						if (targetPet.getOwner() != player)
						{
							if (targetPet.getOwner().isReviveRequested())
							{
								if (targetPet.getOwner().isRevivingPet())
									player.sendPacket(SystemMessageId.RES_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
								else
									player.sendPacket(SystemMessageId.CANNOT_RES_PET2); // A pet cannot be resurrected while it's owner is in the process of resurrecting.
								condGood = false;
							}
						}
					}
				}

				if (condGood)
				{
					if (!onlyFirst)
					{
						targetList.add(target);
						return targetList.toArray(new L2Object[targetList.size()]);
					}
					return new L2Character[] { target };
				}
			}
		}
		activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
		return _emptyTargetList;
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetCorpsePlayer


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if (((target == null || target == activeChar || target.isAlikeDead()) && skill.getCastRange() >= 0) || (!(target instanceof L2Attackable || target instanceof L2Playable)))
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		final L2Character origin;
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));
		final int radius = skill.getSkillRadius();

		if (skill.getCastRange() >= 0)
		{
			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena))
				return _emptyTargetList;

			if (onlyFirst)
				return new L2Character[] { target };

			origin = target;
			targetList.add(origin); // Add target to target list
		}
		else
			origin = activeChar;

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable))
				continue;

			if (obj == origin)
				continue;

			if (Util.checkIfInRange(radius, origin, obj, true))
			{
				if (!obj.isInFrontOf(activeChar))
					continue;

				if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}

		if (targetList.isEmpty())
			return _emptyTargetList;

		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if (((target == null || target == activeChar || target.isAlikeDead()) && skill.getCastRange() >= 0) || (!(target instanceof L2Attackable || target instanceof L2Playable)))
		{
			activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
			return _emptyTargetList;
		}

		final L2Character origin;
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));
		final int radius = skill.getSkillRadius();

		if (skill.getCastRange() >= 0)
		{
			if (!L2Skill.checkForAreaOffensiveSkills(activeChar, target, skill, srcInArena))
				return _emptyTargetList;

			if (onlyFirst)
				return new L2Character[] { target };

			origin = target;
			targetList.add(origin); // Add target to target list
		}
		else
			origin = activeChar;

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharacters();
		for (L2Character obj : objs)
		{
			if (!(obj instanceof L2Attackable || obj instanceof L2Playable))
				continue;

			if (obj == origin)
				continue;

			if (Util.checkIfInRange(radius, origin, obj, true))
			{
				if (!obj.isInFrontOf(activeChar))
					continue;

				if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;

				targetList.add(obj);
			}
		}

		if (targetList.isEmpty())
			return _emptyTargetList;

		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetFrontArea


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final L2PcInstance sourcePlayer = activeChar.getActingPlayer();

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());

		if (skill.getSkillType() == L2SkillType.DUMMY)
		{
			if (onlyFirst)
				return new L2Character[] { activeChar };

			targetList.add(activeChar);
			for (L2Character obj : objs)
			{
				if (!(obj == activeChar || obj == sourcePlayer || obj instanceof L2Npc || obj instanceof L2Attackable))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;
				targetList.add(obj);
			}
		}
		else
		{
			for (L2Character obj : objs)
			{
				if (obj instanceof L2Attackable || obj instanceof L2Playable)
				{

					if (!obj.isInFrontOf(activeChar))
						continue;

					if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
						continue;

					if (onlyFirst)
						return new L2Character[] { obj };

					if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
						break;
					targetList.add(obj);
				}
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		final boolean srcInArena = (activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE));

		final L2PcInstance sourcePlayer = activeChar.getActingPlayer();

		final Collection<L2Character> objs = activeChar.getKnownList().getKnownCharactersInRadius(skill.getSkillRadius());

		if (skill.getSkillType() == L2SkillType.DUMMY)
		{
			if (onlyFirst)
				return new L2Character[] { activeChar };

			targetList.add(activeChar);
			for (L2Character obj : objs)
			{
				if (!(obj == activeChar || obj == sourcePlayer || obj instanceof L2Npc || obj instanceof L2Attackable))
					continue;

				if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
					break;
				targetList.add(obj);
			}
		}
		else
		{
			for (L2Character obj : objs)
			{
				if (obj instanceof L2Attackable || obj instanceof L2Playable)
				{

					if (!obj.isInFrontOf(activeChar))
						continue;

					if (!L2Skill.checkForAreaOffensiveSkills(activeChar, obj, skill, srcInArena))
						continue;

					if (onlyFirst)
						return new L2Character[] { obj };

					if (skill.getMaxTargets() > -1 && targetList.size() >= skill.getMaxTargets())
						break;
					targetList.add(obj);
				}
			}
		}
		return targetList.toArray(new L2Character[targetList.size()]);
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetFrontAura


	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<>();
		if (!(target instanceof L2DoorInstance) && !(target instanceof L2ChestInstance))
		{
			return _emptyTargetList;
		}

		if (!onlyFirst)
		{
			targetList.add(target);
			return targetList.toArray(new L2Object[targetList.size()]);
		}
		return new L2Character[] { target };
	}

	@Override
	public L2Object[] getTargetList(L2Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
	{
		List<L2Character> targetList = new FastList<L2Character>();
		if (!(target instanceof L2DoorInstance) && !(target instanceof L2ChestInstance))
		{
			return _emptyTargetList;
		}

		if (!onlyFirst)
		{
			targetList.add(target);
			return targetList.toArray(new L2Object[targetList.size()]);
		}
		return new L2Character[] { target };
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getTargetList(skill L2Skill, activeChar L2Character, onlyFirst boolean, target L2Character) : L2Object[] from class handlers.targethandlers.TargetUnlockable


	private void startRoom(int managerId)
	{
		_activeRooms.put(managerId, true);

		if (DOORS.containsKey(managerId))
		{
			int[] doorList = DOORS.get(managerId);
			DoorTable.getInstance().getDoor(doorList[0]).closeMe();
		}

		if (SPAWNS.containsKey(managerId))
		{
			int[][] spawnList = SPAWNS.get(managerId);
			List<L2Npc> spawned = new FastList<>();
			for (int[] spawn : spawnList)
			{
				L2Npc spawnedNpc = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false);
				spawned.add(spawnedNpc);
			}
			if (!spawned.isEmpty())
			{
				_spawns.put(managerId, spawned);
			}
		}
	}

	private void startRoom(int managerId)
	{
		_activeRooms.put(managerId, true);

		if (DOORS.containsKey(managerId))
		{
			int[] doorList = DOORS.get(managerId);
			DoorTable.getInstance().getDoor(doorList[0]).closeMe();
		}

		if (SPAWNS.containsKey(managerId))
		{
			int[][] spawnList = SPAWNS.get(managerId);
			List<L2Npc> spawned = new FastList<L2Npc>();
			for (int[] spawn : spawnList)
			{
				L2Npc spawnedNpc = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false);
				spawned.add(spawnedNpc);
			}
			if (!spawned.isEmpty())
			{
				_spawns.put(managerId, spawned);
			}
		}
	}

Replace Generic With Diamond FastList<L2Npc> with FastList<> in method private startRoom(managerId int) : void from class hellbound.TowerOfNaia.TowerOfNaia


	protected void runEmeraldSquare(CCWorld world)
	{
		world.status = 3;

		Map<L2Npc, Boolean> spawnList = new FastMap<>();
		for (int[] spawn : EMERALD_SPAWNS)
		{
			L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.instanceId);
			spawnList.put(mob, false);
		}
		world.npcList2.put(0, spawnList);
	}

	protected void runEmeraldSquare(CCWorld world)
	{
		world.status = 3;

		Map<L2Npc, Boolean> spawnList = new FastMap<L2Npc, Boolean>();
		for (int[] spawn : EMERALD_SPAWNS)
		{
			L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.instanceId);
			spawnList.put(mob, false);
		}
		world.npcList2.put(0, spawnList);
	}

Replace Generic With Diamond FastMap<L2Npc,Boolean> with FastMap<> in method protected runEmeraldSquare(world CCWorld) : void from class instances.CrystalCaverns.CrystalCaverns


	protected void runEmeraldRooms(CCWorld world, int[][] spawnList, int room)
	{
		Map<L2Npc, Boolean> spawned = new FastMap<>();
		for (int[] spawn : spawnList)
		{
			L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.instanceId);
			spawned.put(mob, false);
		}
		if (room == 1) // spawn Lahm
			addSpawn(32359, 142110, 139896, -11888, 8033, false, 0, false, world.instanceId);
		world.npcList2.put(room, spawned);
		world.roomsStatus[room - 1] = 1;
	}

	protected void runEmeraldRooms(CCWorld world, int[][] spawnList, int room)
	{
		Map<L2Npc, Boolean> spawned = new FastMap<L2Npc, Boolean>();
		for (int[] spawn : spawnList)
		{
			L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.instanceId);
			spawned.put(mob, false);
		}
		if (room == 1) // spawn Lahm
			addSpawn(32359, 142110, 139896, -11888, 8033, false, 0, false, world.instanceId);
		world.npcList2.put(room, spawned);
		world.roomsStatus[room - 1] = 1;
	}

Replace Generic With Diamond FastMap<L2Npc,Boolean> with FastMap<> in method protected runEmeraldRooms(world CCWorld, spawnList int[][], room int) : void from class instances.CrystalCaverns.CrystalCaverns


	protected void runSteamRooms(CCWorld world, int[][] spawnList, int status)
	{
		world.status = status;

		Map<L2Npc, Boolean> spawned = new FastMap<>();
		for (int[] spawn : spawnList)
		{
			L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.instanceId);
			spawned.put(mob, false);
		}
		world.npcList2.put(0, spawned);
	}

	protected void runSteamRooms(CCWorld world, int[][] spawnList, int status)
	{
		world.status = status;

		Map<L2Npc, Boolean> spawned = new FastMap<L2Npc, Boolean>();
		for (int[] spawn : spawnList)
		{
			L2Npc mob = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false, world.instanceId);
			spawned.put(mob, false);
		}
		world.npcList2.put(0, spawned);
	}

Replace Generic With Diamond FastMap<L2Npc,Boolean> with FastMap<> in method protected runSteamRooms(world CCWorld, spawnList int[][], status int) : void from class instances.CrystalCaverns.CrystalCaverns


	@Override
	public String onSpawn(L2Npc npc)
	{
		if (Util.contains(mobs1, npc.getNpcId()))
		{
			FastList<L2Playable> result = new FastList<>();
			Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
			for (L2Object obj : objs)
			{
				if ((obj instanceof L2PcInstance) || (obj instanceof L2PetInstance))
				{
					if (Util.checkIfInRange(npc.getAggroRange(), npc, obj, true) && !((L2Character) obj).isDead())
					{
						result.add((L2Playable) obj);
					}
				}
			}
			if (!result.isEmpty() && (result.size() != 0))
			{
				Object[] characters = result.toArray();
				for (Object obj : characters)
				{
					L2Playable target = (L2Playable) (obj instanceof L2PcInstance ? obj : ((L2Summon) obj).getOwner());
					if ((target.getActiveWeaponInstance() != null) && !npc.isInCombat() && (npc.getTarget() == null))
					{
						npc.setTarget(target);
						npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), messages[0]));
						switch (npc.getNpcId())
						{
							case 22124:
							case 22126:
							case 22127:
							{
								L2Skill skill = SkillTable.getInstance().getInfo(4589, 8);
								npc.doCast(skill);
								break;
							}
							default:
							{
								npc.setIsRunning(true);
								((L2Attackable) npc).addDamageHate(target, 0, 999);
								npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
								break;
							}
						}
					}
				}
			}
		}
		return super.onSpawn(npc);
	}

	@Override
	public String onSpawn(L2Npc npc)
	{
		if (Util.contains(mobs1, npc.getNpcId()))
		{
			FastList<L2Playable> result = new FastList<L2Playable>();
			Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
			for (L2Object obj : objs)
			{
				if ((obj instanceof L2PcInstance) || (obj instanceof L2PetInstance))
				{
					if (Util.checkIfInRange(npc.getAggroRange(), npc, obj, true) && !((L2Character) obj).isDead())
					{
						result.add((L2Playable) obj);
					}
				}
			}
			if (!result.isEmpty() && (result.size() != 0))
			{
				Object[] characters = result.toArray();
				for (Object obj : characters)
				{
					L2Playable target = (L2Playable) (obj instanceof L2PcInstance ? obj : ((L2Summon) obj).getOwner());
					if ((target.getActiveWeaponInstance() != null) && !npc.isInCombat() && (npc.getTarget() == null))
					{
						npc.setTarget(target);
						npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getNpcId(), messages[0]));
						switch (npc.getNpcId())
						{
							case 22124:
							case 22126:
							case 22127:
							{
								L2Skill skill = SkillTable.getInstance().getInfo(4589, 8);
								npc.doCast(skill);
								break;
							}
							default:
							{
								npc.setIsRunning(true);
								((L2Attackable) npc).addDamageHate(target, 0, 999);
								npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
								break;
							}
						}
					}
				}
			}
		}
		return super.onSpawn(npc);
	}

Replace Generic With Diamond FastList<L2Playable> with FastList<> in method public onSpawn(npc L2Npc) : String from class ai.group_template.Monastery


	public L2Character getRandomTarget(L2Npc npc)
	{
		FastList<L2Character> result = new FastList<>();
		Collection<L2Character> objs = npc.getKnownList().getKnownCharacters();
		{
			for (L2Character cha : objs)
			{
				if ((cha instanceof L2PcInstance) || (cha instanceof L2Summon) || (cha instanceof L2DecoyInstance))
				{
					if (Util.checkIfInRange(5000, npc, cha, true) && !cha.isDead() && !cha.isGM())
					{
						result.add(cha);
					}
				}
			}
		}
		if (!result.isEmpty() && (result.size() != 0))
		{
			Object[] characters = result.toArray();
			return (L2Character) characters[getRandom(characters.length)];
		}
		return null;
	}

	public L2Character getRandomTarget(L2Npc npc)
	{
		FastList<L2Character> result = new FastList<L2Character>();
		Collection<L2Character> objs = npc.getKnownList().getKnownCharacters();
		{
			for (L2Character cha : objs)
			{
				if ((cha instanceof L2PcInstance) || (cha instanceof L2Summon) || (cha instanceof L2DecoyInstance))
				{
					if (Util.checkIfInRange(5000, npc, cha, true) && !cha.isDead() && !cha.isGM())
					{
						result.add(cha);
					}
				}
			}
		}
		if (!result.isEmpty() && (result.size() != 0))
		{
			Object[] characters = result.toArray();
			return (L2Character) characters[getRandom(characters.length)];
		}
		return null;
	}

Replace Generic With Diamond FastList<L2Character> with FastList<> in method public getRandomTarget(npc L2Npc) : L2Character from class ai.individual.Valakas