mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Edit the default directory with Run Map Merge.bat
If no .dmm files are found there it asks for input
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
@echo off
|
||||
|
||||
java -jar ../../tools/mapmerge/MapMerge.jar
|
||||
java -jar MapMerge.jar ../../_maps/
|
||||
|
||||
pause
|
||||
Binary file not shown.
@@ -9,70 +9,87 @@ public class MapMergerMain {
|
||||
|
||||
private static Scanner input = new Scanner(System.in);
|
||||
|
||||
public static void main(String[] args) throws IOException{
|
||||
|
||||
System.out.print("Path to maps folder: ");
|
||||
Path pathToMaps = Paths.get(input.nextLine());
|
||||
public static void main(String[] mapPath) throws IOException{
|
||||
Path pathToMaps = Paths.get(mapPath[0]);
|
||||
FileFinder dmmFinder = new FileFinder("*.dmm");
|
||||
Files.walkFileTree(pathToMaps, dmmFinder);
|
||||
ArrayList<Path> foundFiles = dmmFinder.foundPaths;
|
||||
if (foundFiles.size() > 0) {
|
||||
|
||||
try{
|
||||
merge(foundFiles);
|
||||
}catch(Exception e){
|
||||
System.out.println("Something went wrong.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
System.out.println("No files were found in provided directory!");
|
||||
System.out.print("Path to maps folder: ");
|
||||
pathToMaps = Paths.get(input.nextLine());
|
||||
dmmFinder = new FileFinder("*.dmm");
|
||||
Files.walkFileTree(pathToMaps, dmmFinder);
|
||||
foundFiles = dmmFinder.foundPaths;
|
||||
try{
|
||||
merge(foundFiles);
|
||||
}catch(Exception e){
|
||||
System.out.println("Something went wrong.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void merge(ArrayList<Path> foundFiles){
|
||||
|
||||
System.out.println("How many files do you want to merge?");
|
||||
int selection1;
|
||||
System.out.println("How many files do you want to merge?");
|
||||
int selection1;
|
||||
inputCheck:while(true){
|
||||
while(!input.hasNextInt()){
|
||||
String temp = input.next();
|
||||
System.out.println(temp + " is not a valid int.");
|
||||
}
|
||||
selection1 = input.nextInt();
|
||||
if(selection1 < 0){
|
||||
System.out.println("Use a number greater than 0!");
|
||||
continue inputCheck;
|
||||
}else{
|
||||
break inputCheck;
|
||||
}
|
||||
}
|
||||
|
||||
for(int numOfFiles = selection1; numOfFiles != 0; numOfFiles--){
|
||||
|
||||
for(int num = 0;num < foundFiles.size();num++){
|
||||
System.out.println(num + ": " + foundFiles.get(num));
|
||||
}
|
||||
|
||||
System.out.print("File to use: ");
|
||||
int selection2;
|
||||
inputCheck:while(true){
|
||||
while(!input.hasNextInt()){
|
||||
String temp = input.next();
|
||||
System.out.println(temp + " is not a valid int.");
|
||||
}
|
||||
selection1 = input.nextInt();
|
||||
if(selection1 < 0){
|
||||
selection2 = input.nextInt();
|
||||
if(selection2 < 0 || selection2 >= foundFiles.size()){
|
||||
if(selection2 < 0){
|
||||
System.out.println("Use a number greater than 0!");
|
||||
}else{
|
||||
System.out.println("Use a number less than " + foundFiles.size() +"!");
|
||||
}
|
||||
continue inputCheck;
|
||||
}else{
|
||||
break inputCheck;
|
||||
}
|
||||
}
|
||||
|
||||
for(int numOfFiles = selection1; numOfFiles != 0; numOfFiles--){
|
||||
|
||||
for(int num = 0;num < foundFiles.size();num++){
|
||||
System.out.println(num + ": " + foundFiles.get(num));
|
||||
}
|
||||
|
||||
System.out.print("File to use: ");
|
||||
int selection2;
|
||||
inputCheck:while(true){
|
||||
while(!input.hasNextInt()){
|
||||
String temp = input.next();
|
||||
System.out.println(temp + " is not a valid int.");
|
||||
}
|
||||
selection2 = input.nextInt();
|
||||
if(selection2 < 0 || selection2 >= foundFiles.size()){
|
||||
if(selection2 < 0){
|
||||
System.out.println("Use a number greater than 0!");
|
||||
}else{
|
||||
System.out.println("Use a number less than " + foundFiles.size() +"!");
|
||||
}
|
||||
continue inputCheck;
|
||||
}else{
|
||||
break inputCheck;
|
||||
}
|
||||
}
|
||||
|
||||
String newMap = foundFiles.get(selection2) + "";
|
||||
String oldMap = foundFiles.get(selection2) + ".backup";
|
||||
String[] passInto = new String[4];
|
||||
passInto[0] = "-clean";
|
||||
passInto[1] = oldMap;
|
||||
passInto[2] = newMap;
|
||||
passInto[3] = newMap;
|
||||
MapPatcher.main(passInto);
|
||||
}
|
||||
|
||||
}else{
|
||||
System.out.println("No files were found!");
|
||||
String newMap = foundFiles.get(selection2) + "";
|
||||
String oldMap = foundFiles.get(selection2) + ".backup";
|
||||
String[] passInto = new String[4];
|
||||
passInto[0] = "-clean";
|
||||
passInto[1] = oldMap;
|
||||
passInto[2] = newMap;
|
||||
passInto[3] = newMap;
|
||||
MapPatcher.main(passInto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user