private void showProductList( HashMap<String, Integer> product, String[] sList, File regionFolder, String path) { String products = ""; String sRegionFile = ""; RegionConfig region; // String[] outLines ; // REAGENTS LIST System.out.println(" "); System.out.println("[Production] Products : " + product.size()); for (String sName : product.keySet()) { products = products + "" + sName + " "; } System.out.println(ConfigBasis.setStrleft(" ", 15) + products); for (File RegionFile : regionFolder.listFiles()) { sRegionFile = RegionFile.getName(); if (isInList(sRegionFile, sList)) { for (String itemRef : product.keySet()) { product.put(itemRef, 0); } region = StrongholdTools.getRegionConfig(path + "\\RegionConfig", sRegionFile); for (ItemStack item : region.getOutput()) { product.put(item.getType().name(), item.getAmount()); } products = ""; for (String sName : product.keySet()) { int value = product.get(sName); String sValue = String.valueOf(value); for (int i = 0; i < (sName.length() - 1); i++) { // sValue = sValue + " "; sValue = ConfigBasis.setStrleft(sValue, sName.length()); } products = products + "" + sValue + " "; } System.out.println(ConfigBasis.setStrleft(sRegionFile.replace(".yml", ""), 15) + products); } } }
@Test public void getStrongholdConstructionMaterial() { // StrongholdTools shTools = new StrongholdTools(); String path = "\\GIT\\OwnPlugins\\Realms\\plugins\\HeroStronghold"; File regionFolder = new File(path, "RegionConfig"); if (!regionFolder.exists()) { System.out.println("Folder not found !"); return; } HashMap<String, Integer> required = new HashMap<String, Integer>(); HashMap<String, Integer> reagent = new HashMap<String, Integer>(); HashMap<String, Integer> superRef = new HashMap<String, Integer>(); HashMap<String, Integer> ingredient = new HashMap<String, Integer>(); HashMap<String, Integer> product = new HashMap<String, Integer>(); superRef.put("Anywhere", 0); String sRegionFile = ""; RegionConfig region; String[] sList; // sList = setStandardList(); // sList = setNetherList(); // sList = setBasisList(); // sList = setErweitertList(); // sList = setEnhancedList(); sList = new String[] { "MUSHROOM", }; System.out.println("[Stronghold] Building cost"); for (File RegionFile : regionFolder.listFiles()) { sRegionFile = RegionFile.getName(); if (isInList(sRegionFile, sList)) { region = StrongholdTools.getRegionConfig(path + "\\RegionConfig", sRegionFile); System.out.println( ConfigBasis.setStrleft(sRegionFile.replace(".yml", ""), 20) + " Cost : " + ConfigBasis.setStrright(String.valueOf(region.getMoneyRequirement()), 10)); for (ItemStack item : region.getRequirements()) { required.put(item.getType().name(), 0); } for (ItemStack item : region.getReagents()) { reagent.put(item.getType().name(), 0); } for (String item : region.getSuperRegions()) { superRef.put(item, 0); } for (ItemStack item : region.getUpkeep()) { ingredient.put(item.getType().name(), 0); } for (ItemStack item : region.getOutput()) { product.put(item.getType().name(), 0); } } } showBuildingList(required, sList, regionFolder, path); showReagentList(reagent, sList, regionFolder, path); showBuildingAllowed(superRef, sList, regionFolder, path); showIngredientList(ingredient, sList, regionFolder, path); showProductList(product, sList, regionFolder, path); // Queue<RegionType> myQueue = new Queue<RegionType>(); { } ; }