Hey everyone, I'm having problems with my yml file. I'm trying to put in spawn locations, 12 of them, into a config but I it stops the yml from being loaded. Yml data: Code (Text): Spawn-Location 1: 20.5, 131, -59.5, 0, 0 Spawn-Location 2: -59.5, 131, 20.5, -90, 0 Error in console: Spoiler Caused by: org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here in 'string', line 9, column 59: ... 31, 20.5, -90, 0Spawn-Location 3: 0
You are mapping the coords, you probably want to edit that though. Make the config like: Code (Text): Spawn: LOC1: X: Y: Z: Pitch: Yaw: LOC2: ... and do on
YAML thinks they are paths, when you are defining a string. Code (YAML): Spawn-Location1: '20.5, 131, -59.5, 0, 0' Spawn-Location2: '-59.5, 131, 20.5, -90, 0' Additionally as stated above it might be better to break up the info.
@NormaalBart @WAS Okay I tried this: Code (Text): Spawn: Loc-1: X: 20.5 Y: 131 Z: -59.5 Yaw: 0 Pitch: 0 Loc-2: X: -59.5 Y: 131 Z: 20.5 Yaw: -90 Pitch: 0 Loc-3: X: -59.5 Y: 131 Z: -59.5 Yaw: -45 Pitch: 0 Loc-4: X: -19.5 Y: 131 Z: 60.5 Yaw: -180 Pitch: 0 Loc-5: X: 60.5 Y: 131 Z: -19.5 Yaw: 90 Pitch: 0 Loc-6: X: 60.5 Y: 131 Z: 60.5 Yaw: 135 Pitch: 0 Loc-7: X: 60.5 Y: 131 Z: 20.5 Yaw: 90 Pitch: 0 Loc-8: X: -59.5 Y: 131 Z: -19.5 Yaw: -90 Pitch: 0 Loc-9: X: 20.5 Y: 131 Z: 60.5 Yaw: -180 Pitch: 0 Loc-10: X: -19.5 Y: 131 Z: -59.5 Yaw: 0 Pitch: 0 Loc-11: X: 60.5 Y: 131 Z: -59.5 Yaw: 45 Pitch: 0 Loc-12: X: -59.5 Y: 131 Z: 60.5 Yaw: -135 Pitch: 0 But it still errors out: Spoiler Caused by: org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here in 'string', line 301, column 10: Pitch: 0 Also I did it the other way with chest locations and that never errors out. Its only the spawn locations.
Paste your YAML into http://yaml-online-parser.appspot.com/ to make sure it's valid. You should be using org.bukkit.configuration.file.YamlConfiguration instead of SnakeYAML too.
@WAS @megamichiel @NormaalBart @Sweepyoface Okay I solved that error but now part of the yml is returning null. This is the code for getting the value: Code (Text): public World getWorld() { String s = arenaConfiguration.getString("World-Name"); return Bukkit.getWorld(s); } Here is the line in the YML Spoiler World-Name: RomanEmpire
Most likely because the world is null. Try to debug it Edit The arenaConfiguration can also be null, try that also
@NormaalBart Yes the world is returning null. I just can't figure out how to figure that out. Edit: Never mind another part of the config was causing arenaConfiguration to be null. Thanks for the help!