Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public String copyMap(int teams, int maxPlayersPerTeam){
  2.  
  3. String type = teams + "x" + maxPlayersPerTeam;
  4.  
  5. File baseDir = new File(dir);
  6.  
  7. //8x1_mapname
  8.  
  9. List<File> files = new ArrayList<File>();
  10.  
  11. for(File f : baseDir.listFiles()){
  12. if(f.isDirectory()){
  13. if(f.getName().startsWith(type)){
  14. files.add(f);
  15. }
  16. }
  17. }
  18.  
  19. File mapFile = files.get(new Random().nextInt(files.size()));
  20. String MapName = mapFile.getName().split("_")[1];
  21.  
  22. //TODO CopyMap
  23.  
  24. return mapName;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement