1.8.8 Config path not returning the correct value

Discussion in 'Spigot Plugin Development' started by FisherGee, Jan 29, 2020.

  1. Context:
    Code (Text):
                            ConfigManager.get().set("location", blockLocation);
                            ConfigManager.get().set("chestLocked", chestLocked);
                            if(ConfigManager.get().getInt("location.x") == (blockX) && ConfigManager.get().getInt("location.y") == (blockY)){
                                System.out.println("Data exists");
                                System.out.println("Data does not exist");
    For some reason in the statement ConfigManager.get().getInt("location.x") is returning 0. However I can clearly check by printing out the values that it's 56.

    Here's what my config looks like:

    Code (Text):
      ==: org.bukkit.Location
      world: world
      x: 56.0
      y: 63.0
      z: 295.0
      pitch: 0.0
      yaw: 0.0
    chestLocked: false
  2. SteelPhoenix


    The path location.x does not exist so it returns the default value (0). You can just grab the location (Location location = config.getLocation("location"))
  3. getLocation() isn't there for me.
  4. FrostedSnowman

    Resource Staff

  5. SteelPhoenix


    It exists in the newest Spigot versions according to the Javadoc
    But like FrostedSnowman said, you can also cast it as it's still ConfigurationSerializable.