Skip to content

Commit

Permalink
1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo0001 committed Jun 22, 2024
1 parent 5d240f4 commit ec28ce6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.jo0001</groupId>
<artifactId>ViaTesting</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/de/jo0001/viaTesting/core/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class Controller implements Initializable {
private final HashMap<String, String> mojangjars = new HashMap<>();

public Controller() {
System.out.println("Controller loading");
}


Expand All @@ -50,6 +49,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
new UpdateCheck().start();

try {
logger.log(Level.INFO, "Fetching Mojang data");
DownloadUtil.getVersions().forEach(e -> mcVersionsPaper.add(e.getAsString()));
JsonObject mojangData = DownloadUtil.getMojangData();
mojangData.getAsJsonArray("versions").forEach(e -> {
Expand All @@ -65,6 +65,8 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
});
} catch (IOException e) {
e.printStackTrace();
} finally {
logger.log(Level.INFO, "Finished fetching Mojang data");
}

Platform.runLater(() -> {
Expand Down
18 changes: 2 additions & 16 deletions src/main/java/de/jo0001/viaTesting/core/Downloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

public class Downloader extends Thread {
private final Controller controller;
private File root;
private File proxyRoot;
private final File root;
private final String proxySettings;
private boolean withProxy;
private String proxy;
Expand Down Expand Up @@ -51,8 +50,6 @@ public void run() {

withProxy = !proxySettings.equalsIgnoreCase("None");
if (withProxy) {
File defaultRoot = root;
//root = new File(root.getAbsolutePath() + "/Paper-Server");
downloads.add(CompletableFuture.runAsync(() -> {
try {
downloadPaperServer();
Expand All @@ -70,7 +67,6 @@ public void run() {

if (proxySettings.contains("Bungee")) {
proxy = "bungee";
//proxyRoot = new File(defaultRoot.getAbsolutePath() + "/Bungee-Server");
downloads.add(CompletableFuture.runAsync(() -> {
try {
downloadBungee();
Expand All @@ -80,8 +76,6 @@ public void run() {
}));
} else if (proxySettings.contains("Velocity")) {
proxy = "velocity";
//proxyRoot = new File(defaultRoot.getAbsolutePath() + "/Velocity-Server");

downloads.add(CompletableFuture.runAsync(() -> {
try {
downloadVelocityServer();
Expand All @@ -91,7 +85,6 @@ public void run() {
}));
} else {
proxy = "waterfall";
//proxyRoot = new File(defaultRoot.getAbsolutePath() + "/Waterfall-Server");
downloads.add(CompletableFuture.runAsync(() -> {
try {
downloadWaterfallServer();
Expand All @@ -101,10 +94,6 @@ public void run() {
}));
}

/* if (!proxySettings.contains("with Via")) {
root = new File(defaultRoot.getAbsolutePath() + "/Paper-Server");
}*/

downloads.add(CompletableFuture.runAsync(() -> {
try {
downloadVia();
Expand Down Expand Up @@ -233,19 +222,16 @@ private String getBase(String type) {
return root.getPath();
}
}

if (type.equals("plugin")) {
if (withProxy) {
return (proxySettings.contains("Via") ? getBase(proxy) : getBase("paper")) + "/plugins";
} else {
return root.getPath() + "/plugins";//todo fix
return root.getPath() + "/plugins";
}
}

if (withProxy) {
return root.getPath() + "/" + proxy + "-server";
}

return null;
}
}
2 changes: 2 additions & 0 deletions src/main/java/de/jo0001/viaTesting/util/UpdateCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public void run() {
}
}
});
} else {
logger.log(Level.INFO, "No newer version found");
}
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit ec28ce6

Please sign in to comment.