MCPcopy Create free account
hub / github.com/Neop/mudmap2 / readWorldList

Method readWorldList

src/main/java/mudmap2/backend/WorldFileList.java:294–325  ·  view source on GitHub ↗

Read available worlds file (legacy)

(File historyFile)

Source from the content-addressed store, hash-verified

292 * Read available worlds file (legacy)
293 */
294 @Deprecated
295 private static void readWorldList(File historyFile){
296 try {
297 // read from available worlds file
298 BufferedReader reader = new BufferedReader(new FileReader(historyFile));
299
300 String line;
301 while((line = reader.readLine()) != null){
302 line = line.trim();
303 if(line.startsWith("f ")){ // world file entry
304 String fileName = line.substring(2).trim();
305
306 WorldFileDefault worldFile = new WorldFileDefault(fileName);
307 if(worldFile.canRead()){ // is world file
308 String name;
309 try {
310 // get world name
311 name = worldFile.readWorldName();
312 } catch (Exception ex) {
313 Logger.getLogger(WorldManager.class.getName()).log(Level.SEVERE, null, ex);
314 // use file name if world name not found
315 name = fileName.substring(fileName.lastIndexOf('/') + 1);
316 }
317 // add found world to list
318 push(new WorldFileEntry(name, new File(fileName)));
319 }
320 }
321 }
322 } catch (FileNotFoundException ex) {} catch (IOException ex) {
323 Logger.getLogger(WorldManager.class.getName()).log(Level.SEVERE, null, ex);
324 }
325 }
326
327 public static class WorldFileEntry {
328

Callers 1

readMethod · 0.95

Calls 4

canReadMethod · 0.95
readWorldNameMethod · 0.95
pushMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected