Hey everyone, I'm working with some YML files to store data about certain maps and to access this data I made a yml for "registering" a map so the data can be used. However, a value that should be returning the number of registered maps returns zero. Here is the method: Code (Text): public int getTotalArenas() { Bukkit.broadcastMessage("Number of Arenas: " + tagConfiguration.getInt("Number of Arenas") + ""); return tagConfiguration.getInt("Number of Arenas"); } Here is the line from the yml: Spoiler Number of Arenas:1
You should not use spaces but rather a - with no upper case for YAML configuration syntax. Code (Text): number-of-arenas: 1
You can uses spaces in YAML keys (even GriefPrevention uses spaces in some of it's keys). The problem is you don't have a space after the colon, so it's not registering as a key: value pair in the configuration map.
@BillyGalbreath @Synapz Hey, so I'm having another integer that is returning 0 in a new config. Code: Code (Text): public int getMapPack() { return arenaConfiguration.getInt("map-pack"); } Line in config: Spoiler map-pack: 1
Never mind everyone, as it turns out I wasn't getting the correct config file because of another error in the code.