mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
quick-e2e: Add EulaService to handle EULA acceptance and update Main class logic
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package de.oliver.quicke2e;
|
package de.oliver.quicke2e;
|
||||||
|
|
||||||
import de.oliver.quicke2e.config.Configuration;
|
import de.oliver.quicke2e.config.Configuration;
|
||||||
|
import de.oliver.quicke2e.eula.EulaService;
|
||||||
import de.oliver.quicke2e.paper.PaperDownloadService;
|
import de.oliver.quicke2e.paper.PaperDownloadService;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
@@ -17,7 +18,12 @@ public class Main {
|
|||||||
);
|
);
|
||||||
|
|
||||||
PaperDownloadService paper = new PaperDownloadService();
|
PaperDownloadService paper = new PaperDownloadService();
|
||||||
paper.downloadServerFile(config.type(), config.version(), config.build());
|
// paper.downloadServerFile(config.type(), config.version(), config.build());
|
||||||
|
|
||||||
|
EulaService eula = new EulaService();
|
||||||
|
if (config.eula()) {
|
||||||
|
eula.setEulaToTrue(String.format("servers/%s_%s_%s/eula.txt", config.type(), config.version(), config.build()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package de.oliver.quicke2e.eula;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class EulaService {
|
||||||
|
|
||||||
|
public boolean setEulaToTrue(String path) {
|
||||||
|
Path eulaPath = Path.of(path);
|
||||||
|
try {
|
||||||
|
Files.writeString(eulaPath, "eula=true");
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user