Esempio n. 1
0
  private void showBuildingList(
      HashMap<String, Integer> required, String[] sList, File regionFolder, String path) {
    String materials = "";
    String sRegionFile = "";
    RegionConfig region;
    //        String[] outLines ;

    System.out.println(" ");
    System.out.println("[Construction] Resources : " + required.size());
    for (String sName : required.keySet()) {
      materials = materials + "" + sName + " ";
    }
    System.out.println(ConfigBasis.setStrleft(" ", 15) + materials);

    for (File RegionFile : regionFolder.listFiles()) {
      sRegionFile = RegionFile.getName();
      if (isInList(sRegionFile, sList)) {
        for (String itemRef : required.keySet()) {
          required.put(itemRef, 0);
        }
        region = StrongholdTools.getRegionConfig(path + "\\RegionConfig", sRegionFile);
        for (ItemStack item : region.getRequirements()) {
          required.put(item.getType().name(), item.getAmount());
        }
        materials = "";
        for (String sName : required.keySet()) {
          int value = required.get(sName);
          String sValue = String.valueOf(value);
          for (int i = 0; i < (sName.length() - 1); i++) {
            sValue = ConfigBasis.setStrleft(sValue, sName.length());
          }
          materials = materials + "" + sValue + " ";
        }
        System.out.println(ConfigBasis.setStrleft(sRegionFile.replace(".yml", ""), 15) + materials);
      }
    }
  }
Esempio n. 2
0
  @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>();
    {
    }
    ;
  }