/** * Save player progress to disk. * * @throws IOException */ private void saveExplorers() throws IOException { final Map<String, Object> output = new HashMap<String, Object>(); for (Entry<String, PlayerProgress> e : explorers.entrySet()) { output.put(e.getKey(), e.getValue().toMap()); } explorersYml.save(output); }
/** * Save route data to disk. * * @throws IOException */ private void saveExplorations() throws IOException { final Map<String, Object> output = new HashMap<String, Object>(); for (Entry<String, Route> e : routes.entrySet()) { output.put(e.getKey(), e.getValue().toMap()); } explorationsYml.save(output); }
@SuppressWarnings("unchecked") private void loadSigns() { ArrayList<Object> signsArray = (ArrayList<Object>) signsYml.load(); signs = new HashSet<Object[]>(); if (signsArray == null) { getLogger().warning("Using empty signs list"); } else { for (Object a : signsArray) { signs.add(((ArrayList<Object>) a).toArray()); } } }
@SuppressWarnings("unchecked") private void loadExplorers() { explorers = Collections.synchronizedMap(new HashMap<String, PlayerProgress>()); Map<String, Object> inputMap = (Map<String, Object>) explorersYml.load(); if (inputMap == null) { getLogger().warning("Using empty explorers list"); } else { for (Entry<String, Object> e : inputMap.entrySet()) { Object v = e.getValue(); explorers.put(e.getKey(), new PlayerProgress((Map<String, Object>) v)); } } }
@SuppressWarnings("unchecked") private void loadRoutes() { Map<String, Object> inputMap = new HashMap<String, Object>(); inputMap = (Map<String, Object>) explorationsYml.load(); routes = Collections.synchronizedMap(new HashMap<String, Route>()); if (inputMap != null) { for (Entry<String, Object> e : inputMap.entrySet()) { Object v = e.getValue(); String routeName = e.getKey(); routes.put(routeName, new Route((Map<String, Object>) v)); } } }
/** * Save sign locations to disk. * * @throws IOException */ private void saveSigns() throws IOException { signsYml.save(signs.toArray()); }