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

Method read

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

Read history

()

Source from the content-addressed store, hash-verified

147 * Read history
148 */
149 public static void read(){
150 final File historyFile = getHistoryFile();
151 final File availableWorldsFile = getAvailableWorldsFile();
152
153 boolean success = false;
154
155 worldFileHistory.clear();
156
157 // read history
158 try {
159 if(historyFile.exists() && historyFile.canRead()){
160 readListJSON(historyFile);
161 success = true;
162 }
163 } catch (Exception ex){
164 Logger.getLogger(WorldFileList.class.getName()).log(Level.SEVERE, null, ex);
165 }
166
167 // fallback: legacy available worlds file
168 if(!success){
169 if(availableWorldsFile.exists() && availableWorldsFile.canRead()){
170 readWorldList(availableWorldsFile);
171 } else {
172 System.err.println("No world history file or not readable");
173 }
174 }
175
176 // remove nonexistant entries
177 cleanList();
178 }
179
180 /**
181 * Write history

Callers 3

testReadMethod · 0.95
testWriteMethod · 0.95
initGuiMethod · 0.95

Calls 7

getHistoryFileMethod · 0.95
readListJSONMethod · 0.95
readWorldListMethod · 0.95
cleanListMethod · 0.95
canReadMethod · 0.45
getNameMethod · 0.45

Tested by 2

testReadMethod · 0.76
testWriteMethod · 0.76