コード例 #1
0
  private void showBuildingAllowed(
      HashMap<String, Integer> superRef, String[] sList, File regionFolder, String path) {
    String superRefs = "";
    String sRegionFile = "";
    RegionConfig region;
    //        String[] outLines ;

    System.out.println(" ");
    System.out.println("[Construction] Build allowed : " + superRef.size());
    for (String sName : superRef.keySet()) {
      superRefs = superRefs + "" + sName + " ";
    }
    System.out.println(ConfigBasis.setStrleft("", 15) + superRefs);
    for (File RegionFile : regionFolder.listFiles()) {
      sRegionFile = RegionFile.getName();
      if (isInList(sRegionFile, sList)) {
        for (String itemRef : superRef.keySet()) {
          superRef.put(itemRef, 0);
        }
        region = StrongholdTools.getRegionConfig(path + "\\RegionConfig", sRegionFile);
        for (String item : region.getSuperRegions()) {
          superRef.put(item, 1);
        }
        if (region.getSuperRegions().size() == 0) {
          superRef.put("Anywhere", 1);
        }
        superRefs = "  ";
        for (String sName : superRef.keySet()) {
          int value = superRef.get(sName);

          String sValue = "";
          if (value == 0) {
            sValue = " ";
          } else {
            sValue = String.valueOf(value);
          }

          for (int i = 0; i < (sName.length() - 1); i++) {
            sValue = sValue + " ";
          }
          superRefs = superRefs + "" + sValue + " ";
        }
        System.out.println(ConfigBasis.setStrleft(sRegionFile.replace(".yml", ""), 15) + superRefs);
      }
    }
  }
コード例 #2
0
  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);
      }
    }
  }
コード例 #3
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);
      }
    }
  }
コード例 #4
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>();
    {
    }
    ;
  }