@@ -81,11 +81,13 @@ public void loadConfig() throws IOException, InvalidConfigurationException {
8181 }
8282
8383 List <Area3D > areas = new ArrayList <>();
84- for (String area : mapSection .getConfigurationSection ("areas" ).getKeys (false )) {
85- ConfigurationSection areaSection = mapSection .getConfigurationSection ("areas." + area );
86- Vector min = getLocation (areaSection .getConfigurationSection ("min" ));
87- Vector max = getLocation (areaSection .getConfigurationSection ("max" ));
88- areas .add (new Area3D (min , max ));
84+ if (mapSection .getConfigurationSection ("areas" ) != null ) {
85+ for (String area : mapSection .getConfigurationSection ("areas" ).getKeys (false )) {
86+ ConfigurationSection areaSection = mapSection .getConfigurationSection ("areas." + area );
87+ Vector min = getLocation (areaSection .getConfigurationSection (".min" ));
88+ Vector max = getLocation (areaSection .getConfigurationSection (".max" ));
89+ areas .add (new Area3D (min , max ));
90+ }
8991 }
9092
9193 GameMap gameMap = new GameMap (mapName , world , spawnMap , areas );
@@ -120,6 +122,7 @@ public Set<GameMap> getRandomMaps(int count) {
120122 }
121123 List <GameMap > shuffleList = new ArrayList <>(allGameMap );
122124 Collections .shuffle (shuffleList );
125+ shuffleList .removeIf (map -> !map .getHijackAreas ().isEmpty ());
123126
124127 return new HashSet <>(shuffleList .subList (0 , count ));
125128 }
@@ -145,9 +148,9 @@ public List<GameMap> getAllGameMap() {
145148 }
146149
147150 private Vector getLocation (ConfigurationSection section ) {
148- double x = section .getDouble ("x" );
149- double y = section .getDouble ("y" );
150- double z = section .getDouble ("z" );
151+ double x = section .getDouble (". x" );
152+ double y = section .getDouble (". y" );
153+ double z = section .getDouble (". z" );
151154 return new Vector (x , y , z );
152155 }
153156}
0 commit comments