Config HashMaps & Converting Objects to Doubles

Discussion in 'Plugin Development' started by PQE, Feb 4, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    PQE

    So I'm pretty new to hashmaps, and the tutorial on setting up a config with them is quite confusing. Essentially in the config, a player can configure the price of a certain material, and this is where I try to grab it (for the material Gold Ore in this example):

    Code:
    Map<String, Object> hm = getConfig().getConfigurationSection("Material Prices.GoldOre.Price").getValues(true);
            int test = (int) hm.get("Price");
    
    Here is the part of my config.yml in which the hashmap is stored:
    Code:
    MaterialPrices:
      GoldOre:
        Price: 5.0
    
    I feel like I'm doiing something very wrong but I don't know what, help please.
     
  2. Offline

    I Al Istannen

Thread Status:
Not open for further replies.

Share This Page