private void showIngredientList( HashMap<String, Integer> ingredient, String[] sList, File regionFolder, String path) { String ingredients = ""; String sRegionFile = ""; RegionConfig region; // String[] outLines ; // REAGENTS LIST System.out.println(" "); System.out.println("[Production] Ingredients : " + ingredient.size()); for (String sName : ingredient.keySet()) { ingredients = ingredients + "" + sName + " "; } System.out.println(ConfigBasis.setStrleft(" ", 15) + ingredients); for (File RegionFile : regionFolder.listFiles()) { sRegionFile = RegionFile.getName(); if (isInList(sRegionFile, sList)) { for (String itemRef : ingredient.keySet()) { ingredient.put(itemRef, 0); } region = StrongholdTools.getRegionConfig(path + "\\RegionConfig", sRegionFile); for (ItemStack item : region.getUpkeep()) { ingredient.put(item.getType().name(), item.getAmount()); } ingredients = ""; for (String sName : ingredient.keySet()) { int value = ingredient.get(sName); String sValue = String.valueOf(value); for (int i = 0; i < (sName.length() - 1); i++) { // sValue = sValue + " "; sValue = ConfigBasis.setStrleft(sValue, sName.length()); } ingredients = ingredients + "" + sValue + " "; } System.out.println( ConfigBasis.setStrleft(sRegionFile.replace(".yml", ""), 15) + ingredients); } } }
@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>(); { } ; }