public static List<SiegeableData> readList( FileConfiguration Source, FileConfiguration Target, String Node, List<SiegeableData> Default) { Debugger.Write("Reading SiegableData List From Node:" + Node, Debugger.DebugLevel.Verbose); List<?> testcontents = Source.getList(Node); List<String> retrievelist = Source.getStringList(Node); // getStringList() will return an empty String ArrayList, but will not return null // if there are in fact no elements. if (testcontents == null) { // fill the string list with the contents of the passed default values. retrievelist = new ArrayList<String>(); for (SiegeableData sd : Default) { retrievelist.add(sd.toString()); // add the string representation. } } // we set the defaults to the string list, and then parse it after, rather than just setting the // default and // breaking out because we want ot save those defaults to the configuration node in question. List<SiegeableData> result = new ArrayList<SiegeableData>(); for (String iterate : retrievelist) { result.add(new SiegeableData(iterate)); } Target.set(Node, retrievelist); return result; }
public static boolean CheckList(List<SiegeableData> list, Material testmat) { for (SiegeableData loopdata : list) { if (loopdata.doesMatch(testmat)) return true; } return false; }
public static float getListPower(List<SiegeableData> list, Material testmat) { for (SiegeableData loopdata : list) { if (loopdata.doesMatch(testmat)) loopdata.getRequiredBlastPower(); } return -1; }