package com.ForgeEssentials.core.preloader.asm;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import cpw.mods.fml.common.asm.transformers.AccessTransformer;

public class FEAccessTransformer extends AccessTransformer
{
	private static FEAccessTransformer	instance;
	private static List<String>			mapFiles	= new LinkedList<String>();

	public FEAccessTransformer() throws IOException
	{
		super();
		instance = this;
		// add your access transformers here!
		mapFiles.add("forgeessentials_at.cfg");
		Iterator<String> it = mapFiles.iterator();
		while (it.hasNext())
		{
			String file = it.next();
			readMapFile(file);
		}

	}

	public static void addTransformerMap(String mapFileName)
	{
		if (instance == null)
		{
			mapFiles.add(mapFileName);
		}
		else
		{
			instance.readMapFile(mapFileName);
		}
	}

	private void readMapFile(String name)
	{
		System.out.println("Adding AT map: " + name);
		try
		{
			// get a method from AccessTransformer
			Method e = AccessTransformer.class.getDeclaredMethod("readMapFile", new Class[]
			{ String.class });
			e.setAccessible(true);
			// run it with the file given.
			e.invoke(this, new Object[]
			{ name });

		}
		catch (Exception ex)
		{
			throw new RuntimeException(ex);
		}
	}

}

@@ -73,120 +73,8 @@
 ion;
-%0Aimport java.lang.reflect.Method;%0Aimport java.util.Iterator;%0Aimport java.util.LinkedList;%0Aimport java.util.List;
 %0A%0Aim
@@ -199,122 +199,8 @@
 er%0A%7B
-%0A%09private static FEAccessTransformer%09instance;%0A%09private static List%3CString%3E%09%09%09mapFiles%09= new LinkedList%3CString%3E();
 %0A%0A%09p
@@ -245,18 +245,17 @@
 xception
-%0A%09
+ 
 %7B%0A%09%09supe
@@ -260,848 +260,80 @@
 per(
-);%0A%09%09instance = this;%0A%09%09// add your access transformers here!%0A%09%09mapFiles.add(%22forgeessentials_at.cfg%22);%0A%09%09Iterator%3CString%3E it = mapFiles.iterator();%0A%09%09while (it.hasNext())%0A%09%09%7B%0A%09%09%09String file = it.next();%0A%09%09%09readMapFile(file);%0A%09%09%7D%0A%0A%09%7D%0A%0A%09public static void addTransformerMap(String mapFileName)%0A%09%7B%0A%09%09if (instance == null)%0A%09%09%7B%0A%09%09%09mapFiles.add(mapFileName);%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09%09instance.readMapFile(mapFileName);%0A%09%09%7D%0A%09%7D%0A%0A%09private void readMapFile(String name)%0A%09%7B%0A%09%09System.out.println(%22Adding AT map: %22 + name);%0A%09%09try%0A%09%09%7B%0A%09%09%09// get a method from AccessTransformer%0A%09%09%09Method e = AccessTransformer.class.getDeclaredMethod(%22readMapFile%22, new Class%5B%5D%0A%09%09%09%7B String.class %7D);%0A%09%09%09e.setAccessible(true);%0A%09%09%09// run it with the file given.%0A%09%09%09e.invoke(this, new Object%5B%5D%0A%09%09%09%7B name %7D);%0A%0A%09%09%7D%0A%09%09catch (Exception ex)%0A%09%09%7B%0A%09%09%09throw new RuntimeException(ex);%0A%09%09%7D%0A%09%7D%0A
+%22forgeessentials_at.cfg%22);%0A%09%09// TODO Auto-generated constructor stub%0A%09%7D%0A%09
 %0A%7D%0A

Simplify code in AT.