@Override public String getMapId() { return mapLoader.getMapId(); } }
/** * Order the maps */ @Override protected void sortMaps() { LastUsedHandler lastUsed = new LastUsedHandler(); List<MapLoader> mapsCopy = maps; maps = new ArrayList<>(); for (String id : lastUsed.getLastUsed()) { for (MapLoader m : mapsCopy) { if (m.getMapId() != null && m.getMapId().equals(id)) { maps.add(m); break; } } } }
@Override public MapLoader getMap(ReplayStartInformation replayStartInformation) throws MapLoadException { if (map.getMapId().equals(replayStartInformation.getMapId())) { return map; } throw new MapLoadException("No file found for " + replayStartInformation); }
/** * Checks if a map matches the search criteria * * @param m * Map * @param search * Criteria * @return true if yes, false if no */ private boolean matchesSearch(MapLoader m, String search) { if (m.getMapName().toLowerCase(Locale.ENGLISH).contains(search)) { return true; } if (m.getDescription().toLowerCase(Locale.ENGLISH).contains(search)) { return true; } return m.getMapId().toLowerCase(Locale.ENGLISH).contains(search); }
/** * Checks if a map matches the search criteria * * @param m * Map * @param search * Criteria * @return true if yes, false if no */ private boolean matchesSearch(MapLoader m, String search) { if (search.isEmpty()) { return true; } if (m.getMapName().toLowerCase(Locale.ENGLISH).contains(search)) { return true; } if (m.getDescription().toLowerCase(Locale.ENGLISH).contains(search)) { return true; } return m.getMapId().toLowerCase(Locale.ENGLISH).contains(search); }
/** * Gives the {@link MapLoader} for the map with the given id. * * @param id * The id of the map to be found. * @return Returns the corresponding {@link MapLoader}<br> * or null if no map with the given id has been found. */ public MapLoader getMapById(String id) { ArrayList<MapLoader> maps = new ArrayList<>(); maps.addAll(getFreshMaps().getItems()); maps.addAll(getSavedMaps().getItems()); for (MapLoader curr : maps) { if (curr.getMapId().equals(id)) { return curr; } } return null; }
private static void createReplayOfRemainingTasks(MapLoader newSavegame, ReplayStartInformation replayStartInformation, String newReplayFile, IGameClock gameClock) throws IOException { System.out.println("Creating new jsettlers.integration.replay file (" + newReplayFile + ")..."); ReplayStartInformation replayInfo = new ReplayStartInformation(0, newSavegame.getMapName(), newSavegame.getMapId(), replayStartInformation.getPlayerId(), replayStartInformation.getPlayerSettings() ); DataOutputStream dos = new DataOutputStream(ResourceManager.writeUserFile(newReplayFile)); replayInfo.serialize(dos); gameClock.saveRemainingTasks(dos); dos.close(); System.out.println("New jsettlers.integration.replay file successfully created!"); }
lbMapId.setText(date + " / " + value.getMapId()); lbPlayerCount.setText("Player: " + value.getMinPlayers() + " - " + value.getMaxPlayers());
mapIdLabel.setText(date + " / " + value.getMapId()); playerCountLabel.setText("Player: " + value.getMinPlayers() + " - " + value.getMaxPlayers());