Compare commits
10 Commits
v1.0.0-alp
...
v1.1.0-alp
Author | SHA1 | Date | |
---|---|---|---|
998b901687 | |||
21737b7549 | |||
c88e90b5b5 | |||
a3a8e4f377 | |||
5ac22babab | |||
46bb3a9e29 | |||
cf0d1f7fff | |||
6ba2397e40 | |||
2476e379e5 | |||
5ed0236888 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,7 +14,6 @@
|
|||||||
.mtj.tmp/
|
.mtj.tmp/
|
||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.jar
|
|
||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
*.zip
|
*.zip
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Minecraft-Server-Launcher
|
# Minecraft-Server-Launcher
|
||||||
I originally created this software in 2013 using AutoIt. Since I am now learning Java, and I have wanted to rewrite it for a long time, I am trying to recreate it in Java. It is currently missing mostly everything, but it's nothing a lot of work can't fix.
|
I originally created this software in 2013 using AutoIt. Since I am now learning Java, I have recreated it in Java.
|
||||||
The original version can be found at: https://knarcraft.net/Downloads/Bungeeminecraftserverlauncher/
|
The original version can be found at: https://knarcraft.net/Downloads/Bungeeminecraftserverlauncher/
|
||||||
Its goal is to do everything the original does, just better. The original is 1595 lines of code repetition and dirty code. I had no prior programming experience when I first started working on the original, which is why it became such a mess.
|
Its goal is to do everything the original does, just better. The original is 1595 lines of code repetition and dirty code. I had no prior programming experience when I first started working on the original, which is why it became such a mess.
|
||||||
|
|
||||||
|
2
config/currentversion.csv
Normal file
2
config/currentversion.csv
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
alpha
|
||||||
|
1.1.0
|
|
@ -2,7 +2,7 @@ Vanilla;Latest,1.12.2,1.11.2,1.10.2,1.9.4,1.8.9,1.7.10,1.6.4,1.5.2,1.4.7,1.3.2,1
|
|||||||
Snapshot;Latest;https://launchermeta.mojang.com/mc/game/version_manifest.json;"snapshot":";";https://s3.amazonaws.com/Minecraft.Download/versions/;/minecraft_server.
|
Snapshot;Latest;https://launchermeta.mojang.com/mc/game/version_manifest.json;"snapshot":";";https://s3.amazonaws.com/Minecraft.Download/versions/;/minecraft_server.
|
||||||
SpongeVanilla;1.12.2,1.11.2,1.10.2,1.8.9;https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/;/spongevanilla-
|
SpongeVanilla;1.12.2,1.11.2,1.10.2,1.8.9;https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/;/spongevanilla-
|
||||||
Bungee;Latest;https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/;Artifacts of BungeeCord #; ;http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar;
|
Bungee;Latest;https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/;Artifacts of BungeeCord #; ;http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar;
|
||||||
Spigot;1.12.2,1.11.2,1.10.2,1.9.4,1.9.4,1.8.8,1.7.10,1.6.4,1.5.2,1.4.7;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/Spigot/
|
Spigot;1.13.1,1.12.2,1.11.2,1.10.2,1.9.4,1.9.4,1.8.8,1.7.10,1.6.4,1.5.2,1.4.7;https://static.knarcraft.net/public/jars/
|
||||||
MCPCplus;1.6.4,1.6.2,1.5.2,1.4.7;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/MCPC+/
|
MCPCplus;1.6.4,1.6.2,1.5.2,1.4.7;https://static.knarcraft.net/public/jars/
|
||||||
Craftbukkit;1.12.2,1.11.2,1.10.2,1.9.4,1.8.8,1.7.10,1.6.4,1.5.2,1.4.6,1.3.2,1.2.5,1.1,1.0;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/Bukkit/
|
Craftbukkit;1.13.1,1.12.2,1.11.2,1.10.2,1.9.4,1.8.8,1.7.10,1.6.4,1.5.2,1.4.6,1.3.2,1.2.5,1.1,1.0;https://static.knarcraft.net/public/jars/
|
||||||
Custom;;
|
Custom;;
|
Can't render this file because it contains an unexpected character in line 1 and column 156.
|
BIN
lib/gson-2.8.5.jar
Normal file
BIN
lib/gson-2.8.5.jar
Normal file
Binary file not shown.
@ -1,3 +1,4 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
|
Class-Path: gson-2.8.5.jar
|
||||||
Main-Class: net.knarcraft.serverlauncher.Main
|
Main-Class: net.knarcraft.serverlauncher.Main
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package net.knarcraft.serverlauncher;
|
package net.knarcraft.serverlauncher;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import net.knarcraft.serverlauncher.profile.Collection;
|
import net.knarcraft.serverlauncher.profile.Collection;
|
||||||
import net.knarcraft.serverlauncher.profile.Profile;
|
import net.knarcraft.serverlauncher.profile.Profile;
|
||||||
import net.knarcraft.serverlauncher.server.Server;
|
import net.knarcraft.serverlauncher.server.Server;
|
||||||
@ -7,13 +11,17 @@ import net.knarcraft.serverlauncher.server.ServerType;
|
|||||||
import net.knarcraft.serverlauncher.userinterface.ServerConsoles;
|
import net.knarcraft.serverlauncher.userinterface.ServerConsoles;
|
||||||
|
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.Scanner;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static net.knarcraft.serverlauncher.Shared.downloadFile;
|
||||||
|
import static net.knarcraft.serverlauncher.Shared.readFile;
|
||||||
import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
||||||
//Java 8 required.
|
//Java 8 required.
|
||||||
|
|
||||||
@ -26,48 +34,65 @@ import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
@SuppressWarnings("CanBeFinal")
|
private static String appDir;
|
||||||
public static String appDir;
|
|
||||||
private static boolean running = false;
|
private static boolean running = false;
|
||||||
|
private static final String updateChannel = "alpha";
|
||||||
|
private static final String updateURL = "https://api.knarcraft.net/minecraftserverlauncher";
|
||||||
|
|
||||||
static {
|
public static void main(String[] args) throws IOException {
|
||||||
|
checkForUpdate();
|
||||||
|
try (PrintWriter file = new PrintWriter(Main.getAppDir() + File.separator + "latestrun.log")) {
|
||||||
|
file.print("");
|
||||||
|
} catch (IOException e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
EventQueue.invokeLater(() -> {
|
||||||
|
try {
|
||||||
|
setup();
|
||||||
|
new ServerConsoles();
|
||||||
|
Profile.load();
|
||||||
|
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
exec.scheduleAtFixedRate(Main::updateConsoles, 10, 500, TimeUnit.MILLISECONDS);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads all server types, so that they are ready for use
|
||||||
|
*/
|
||||||
|
private static void setup() {
|
||||||
try {
|
try {
|
||||||
appDir = String.valueOf(new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile());
|
ServerType.loadServerTypes();
|
||||||
} catch (URISyntaxException e) {
|
} catch (ConfigurationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
/**
|
||||||
EventQueue.invokeLater(() -> {
|
* Retrieves the directory the .jar file is running from
|
||||||
try {
|
*
|
||||||
setup();
|
* @return A string path
|
||||||
new ServerConsoles();
|
*/
|
||||||
Profile.load();
|
public static String getAppDir() {
|
||||||
|
if (appDir == null) {
|
||||||
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
|
try {
|
||||||
exec.scheduleAtFixedRate(Main::updateConsoles, 10, 500, TimeUnit.MILLISECONDS);
|
appDir = String.valueOf(new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile());
|
||||||
} catch (Exception e) {
|
} catch (URISyntaxException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
System.exit(1);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
return appDir;
|
||||||
private static void setup() {
|
}
|
||||||
try {
|
|
||||||
ServerType.loadServerTypes();
|
|
||||||
} catch (ConfigurationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads from server processes, and writes the output to consoles.
|
* Reads from server processes, and writes the output to consoles.
|
||||||
*/
|
*/
|
||||||
private static void updateConsoles() {
|
private static void updateConsoles() {
|
||||||
try {
|
try {
|
||||||
for (Collection collection : Profile.getCurrent().getCollections()) {
|
for (Collection collection : Profile.getCurrent().getCollections()) {
|
||||||
Server server = collection.getServer();
|
Server server = collection.getServer();
|
||||||
if (server.isEnabled() && server.getProcess() != null) {
|
if (server.isEnabled() && server.getProcess() != null) {
|
||||||
@ -94,7 +119,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
running = runningNew;
|
running = runningNew;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +129,7 @@ public class Main {
|
|||||||
* @return Is at least one server running?
|
* @return Is at least one server running?
|
||||||
*/
|
*/
|
||||||
private static boolean serversRunning() {
|
private static boolean serversRunning() {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (Collection collection : Profile.getCurrent().getCollections()) {
|
for (Collection collection : Profile.getCurrent().getCollections()) {
|
||||||
if (collection.getServer().isStarted() || (collection.getServer().getProcess() != null && collection.getServer().getProcess().isAlive())) {
|
if (collection.getServer().isStarted() || (collection.getServer().getProcess() != null && collection.getServer().getProcess().isAlive())) {
|
||||||
num++;
|
num++;
|
||||||
@ -119,11 +144,11 @@ public class Main {
|
|||||||
* @param text The text to search.
|
* @param text The text to search.
|
||||||
* @param server The server which sent the text.
|
* @param server The server which sent the text.
|
||||||
*/
|
*/
|
||||||
private static void updatePlayerList(String text, Server server) {
|
private static void updatePlayerList(String text, Server server) {
|
||||||
if (!server.getTypeName().equals("Bungee")) {
|
if (!server.getTypeName().equals("Bungee")) {
|
||||||
String joinedPlayer = getPlayer(text, true);
|
String joinedPlayer = getPlayer(text, true);
|
||||||
String leftPlayer = getPlayer(text, false);
|
String leftPlayer = getPlayer(text, false);
|
||||||
if (!joinedPlayer.equals("")) {
|
if (!joinedPlayer.equals("")) {
|
||||||
if (!server.hasPlayer(joinedPlayer)) {
|
if (!server.hasPlayer(joinedPlayer)) {
|
||||||
server.addPlayer(joinedPlayer);
|
server.addPlayer(joinedPlayer);
|
||||||
}
|
}
|
||||||
@ -144,7 +169,7 @@ public class Main {
|
|||||||
*/
|
*/
|
||||||
private static String getPlayer(String text, boolean joined) {
|
private static String getPlayer(String text, boolean joined) {
|
||||||
String playerName;
|
String playerName;
|
||||||
if (joined) {
|
if (joined) {
|
||||||
playerName = stringBetween(text, "[Server thread/INFO]: ", " joined the game");
|
playerName = stringBetween(text, "[Server thread/INFO]: ", " joined the game");
|
||||||
if (playerName.equals("")) {
|
if (playerName.equals("")) {
|
||||||
playerName = stringBetween(text, "UUID of player ", " is ");
|
playerName = stringBetween(text, "UUID of player ", " is ");
|
||||||
@ -157,4 +182,84 @@ public class Main {
|
|||||||
}
|
}
|
||||||
return playerName;
|
return playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a newer version is available
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private static void checkForUpdate() throws IOException {
|
||||||
|
Scanner file;
|
||||||
|
try {
|
||||||
|
file = new Scanner(new File("config/currentversion.csv"));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
file = new Scanner(Main.class.getResourceAsStream("/config/currentversion.csv"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String oldType = file.nextLine();
|
||||||
|
String oldVer = file.nextLine();
|
||||||
|
|
||||||
|
String data = readFile(updateURL);
|
||||||
|
JsonObject jsonObject = new JsonParser().parse(data).getAsJsonObject();
|
||||||
|
String latest = jsonObject.getAsJsonObject("latest").get(updateChannel).getAsString();
|
||||||
|
|
||||||
|
if (!oldType.equals(updateChannel) || !oldVer.equals(latest)) {
|
||||||
|
String dir = getAppDir() + File.separator;
|
||||||
|
JsonArray versionList = jsonObject.getAsJsonArray("versions");
|
||||||
|
String url = "";
|
||||||
|
for (JsonElement elem : versionList) {
|
||||||
|
JsonObject obj = elem.getAsJsonObject();
|
||||||
|
String ver = obj.get("id").getAsString();
|
||||||
|
String type = obj.get("type").getAsString();
|
||||||
|
if (ver.equals(latest) && type.equals(updateChannel)) {
|
||||||
|
url = obj.get("url").getAsString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (downloadFile(url, new File(dir + "update.jar").toPath())) {
|
||||||
|
doUpdate(dir);
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"An update is available, but could not be downloaded.",
|
||||||
|
"Update available",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void doUpdate(String dir) {
|
||||||
|
int answer = JOptionPane.showConfirmDialog(
|
||||||
|
null,
|
||||||
|
"An update is available. Do you want to update?",
|
||||||
|
"Update available",
|
||||||
|
JOptionPane.YES_NO_OPTION
|
||||||
|
);
|
||||||
|
if (answer == JOptionPane.YES_NO_OPTION) {
|
||||||
|
if (new File (dir + "Minecraft-Server-Launcher.jar").renameTo(new File(dir + "Old.jar"))) {
|
||||||
|
if (new File(dir + "update.jar").renameTo(new File (dir + "Minecraft-Server-Launcher.jar"))) {
|
||||||
|
if (new File(dir + "Old.jar").delete()) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"Update finished. Please run the software again.",
|
||||||
|
"Update complete",
|
||||||
|
JOptionPane.INFORMATION_MESSAGE
|
||||||
|
);
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!new File(dir + "Old.jar").renameTo(new File (dir + "Minecraft-Server-Launcher.jar"))) {
|
||||||
|
System.out.println("Shit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
null,
|
||||||
|
"Could not replace the main .jar with the downloaded .jar.",
|
||||||
|
"Update failed",
|
||||||
|
JOptionPane.ERROR_MESSAGE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package net.knarcraft.serverlauncher.profile;
|
package net.knarcraft.serverlauncher.profile;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import net.knarcraft.serverlauncher.server.AdvancedServerType;
|
import net.knarcraft.serverlauncher.server.AdvancedServerType;
|
||||||
import net.knarcraft.serverlauncher.server.Server;
|
import net.knarcraft.serverlauncher.server.Server;
|
||||||
import net.knarcraft.serverlauncher.server.ServerType;
|
import net.knarcraft.serverlauncher.server.ServerType;
|
||||||
@ -32,9 +35,9 @@ public class Profile {
|
|||||||
private static final ArrayList<Profile> profiles = new ArrayList<>();
|
private static final ArrayList<Profile> profiles = new ArrayList<>();
|
||||||
private static Profile current;
|
private static Profile current;
|
||||||
private static GUI gui;
|
private static GUI gui;
|
||||||
private static final String profilesDir = Main.appDir + File.separator + "files";
|
private static final String profilesDir = Main.getAppDir() + File.separator + "files";
|
||||||
private static final String profilesFile = Main.appDir + File.separator + "files" + File.separator + "Profiles.txt";
|
private static final String profilesFile = Main.getAppDir() + File.separator + "files" + File.separator + "Profiles.txt";
|
||||||
private static final String jarDir = Main.appDir + File.separator + "files" + File.separator + "Jars" + File.separator;
|
private static final String jarDir = Main.getAppDir() + File.separator + "files" + File.separator + "Jars" + File.separator;
|
||||||
|
|
||||||
private final ArrayList<Collection> collections;
|
private final ArrayList<Collection> collections;
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -139,6 +142,11 @@ public class Profile {
|
|||||||
this.downloadJars = value;
|
this.downloadJars = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current profile to the profile with a certain name.
|
||||||
|
*
|
||||||
|
* @param name The name of the profile
|
||||||
|
*/
|
||||||
public static void setCurrent(String name) {
|
public static void setCurrent(String name) {
|
||||||
for (Profile profile : profiles) {
|
for (Profile profile : profiles) {
|
||||||
if (profile.name.equals(name)) {
|
if (profile.name.equals(name)) {
|
||||||
@ -362,8 +370,10 @@ public class Profile {
|
|||||||
"Error",
|
"Error",
|
||||||
JOptionPane.ERROR_MESSAGE
|
JOptionPane.ERROR_MESSAGE
|
||||||
);
|
);
|
||||||
throw new FileNotFoundException("Unable to save to the profiles file.");
|
} else {
|
||||||
|
System.out.println("Unable to save to file. Try running the software as an administrator.");
|
||||||
}
|
}
|
||||||
|
throw new FileNotFoundException("Unable to save to the profiles file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -456,6 +466,12 @@ public class Profile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a profile, and creates a profile with the data.
|
||||||
|
*
|
||||||
|
* @param profileData The data of the new profile
|
||||||
|
* @return The new profile
|
||||||
|
*/
|
||||||
private static Profile parseProfile(String[] profileData) {
|
private static Profile parseProfile(String[] profileData) {
|
||||||
return new Profile(
|
return new Profile(
|
||||||
profileData[0],
|
profileData[0],
|
||||||
@ -465,6 +481,12 @@ public class Profile {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a server, and creates a new collection.
|
||||||
|
*
|
||||||
|
* @param profile The profile which to add the collection
|
||||||
|
* @param serverData The data to parse
|
||||||
|
*/
|
||||||
private static void parseServer(Profile profile, String[] serverData) {
|
private static void parseServer(Profile profile, String[] serverData) {
|
||||||
profile.collections.add(new Collection(
|
profile.collections.add(new Collection(
|
||||||
serverData[0],
|
serverData[0],
|
||||||
@ -480,6 +502,11 @@ public class Profile {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads all jars to the program directory.
|
||||||
|
*
|
||||||
|
* @throws IOException On version file failure or folder creation failure
|
||||||
|
*/
|
||||||
public static void downloadJars() throws IOException {
|
public static void downloadJars() throws IOException {
|
||||||
if (!new File(jarDir).exists() && !new File(jarDir).mkdirs()) {
|
if (!new File(jarDir).exists() && !new File(jarDir).mkdirs()) {
|
||||||
JOptionPane.showMessageDialog(
|
JOptionPane.showMessageDialog(
|
||||||
@ -490,146 +517,83 @@ public class Profile {
|
|||||||
);
|
);
|
||||||
throw new FileNotFoundException("Unable to create jars folder");
|
throw new FileNotFoundException("Unable to create jars folder");
|
||||||
}
|
}
|
||||||
downloadSimple("Spigot");
|
|
||||||
downloadSimple("Craftbukkit");
|
|
||||||
downloadSimple("MCPCplus");
|
|
||||||
downloadMixed("Vanilla");
|
|
||||||
downloadMixed("Snapshot");
|
|
||||||
downloadSponge();
|
|
||||||
downloadBungee();
|
|
||||||
gui.setStatus("Finished downloading jars");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void downloadSimple(String typeName) throws FileNotFoundException {
|
|
||||||
ServerType type = ServerType.getByName(typeName);
|
|
||||||
String url = Objects.requireNonNull(type).getDownloadURL();
|
|
||||||
String name = type.getName();
|
|
||||||
Boolean success;
|
|
||||||
for (String version : type.getVersions()) {
|
|
||||||
File file = new File(jarDir + type.getName() + version + ".jar");
|
|
||||||
if (!file.isFile()) {
|
|
||||||
Path filePath = Paths.get(jarDir + type.getName() + version + ".jar");
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
success = downloadFile(url + name + version + ".jar", filePath);
|
|
||||||
if (!success) {
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
throw new FileNotFoundException("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void downloadMixed(String typeName) throws IOException {
|
|
||||||
AdvancedServerType type = (AdvancedServerType) ServerType.getByName(typeName);
|
|
||||||
String url = Objects.requireNonNull(type).getDownloadURL();
|
|
||||||
String name = type.getName();
|
|
||||||
String versionText;
|
|
||||||
String newestVersion;
|
|
||||||
Boolean success;
|
|
||||||
for (String version : type.getVersions()) {
|
|
||||||
File file = new File(jarDir + type.getName() + version + ".jar");
|
|
||||||
Path filePath = Paths.get(jarDir + type.getName() + version + ".jar");
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
if (version.equals("Latest")) {
|
|
||||||
try {
|
|
||||||
versionText = readFile(type.getVersionURL());
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IOException("Error reading: " + type.getVersionURL());
|
|
||||||
}
|
|
||||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
|
||||||
if (!file.isFile() || !newestVersion.equals(getVersion(name))) {
|
|
||||||
success = downloadFile(
|
|
||||||
url + newestVersion + type.getDownloadURLPart() + newestVersion + ".jar",
|
|
||||||
filePath
|
|
||||||
);
|
|
||||||
setVersion(name, newestVersion);
|
|
||||||
if (!success) {
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
throw new FileNotFoundException("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!file.isFile()) {
|
|
||||||
success = downloadFile(url + version + type.getDownloadURLPart() + version + ".jar", filePath);
|
|
||||||
if (!success) {
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
throw new FileNotFoundException("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void downloadSponge() throws IOException {
|
|
||||||
AdvancedServerType type = (AdvancedServerType) ServerType.getByName("SpongeVanilla");
|
|
||||||
String url = Objects.requireNonNull(type).getDownloadURL();
|
|
||||||
String name = type.getName();
|
|
||||||
String versionText;
|
|
||||||
String newestVersion;
|
|
||||||
Boolean success;
|
|
||||||
for (String version : type.getVersions()) {
|
|
||||||
File file = new File(jarDir + name + version + ".jar");
|
|
||||||
Path filePath = Paths.get(jarDir + name + version + ".jar");
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
versionText = readFile(type.getVersionURL() + version);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IOException("Error reading: " + type.getVersionURL());
|
|
||||||
}
|
|
||||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
|
||||||
if (!file.isFile()) {
|
|
||||||
success = downloadFile(
|
|
||||||
url + newestVersion + type.getDownloadURLPart() + newestVersion + ".jar",
|
|
||||||
filePath
|
|
||||||
);
|
|
||||||
if (!success) {
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
throw new FileNotFoundException("Error downloading: " + name + version + ".jar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void downloadBungee() throws IOException {
|
|
||||||
AdvancedServerType type = (AdvancedServerType) ServerType.getByName("Bungee");
|
|
||||||
String url = Objects.requireNonNull(type).getDownloadURL();
|
|
||||||
String name = type.getName();
|
|
||||||
String versionText;
|
|
||||||
String newestVersion;
|
|
||||||
Boolean success;
|
|
||||||
File file = new File(jarDir + type.getName() + ".jar");
|
|
||||||
Path filePath = Paths.get(jarDir + type.getName() + ".jar");
|
|
||||||
if (gui != null) {
|
|
||||||
gui.setStatus("Downloading: " + name + ".jar");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
versionText = readFile(type.getVersionURL());
|
downloadAll();
|
||||||
} catch (IOException e) {
|
printToGui("Finished downloading jars");
|
||||||
throw new IOException("Error reading: " + type.getVersionURL());
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new FileNotFoundException("One or more downloads failed: " + e.getMessage());
|
||||||
}
|
}
|
||||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
}
|
||||||
if (!file.isFile() || !newestVersion.equals(getVersion(name))) {
|
|
||||||
success = downloadFile(url, filePath);
|
/**
|
||||||
setVersion(name, newestVersion);
|
* Prints something to the gui status field if the gui exists
|
||||||
if (!success) {
|
* Otherwise it prints to the console
|
||||||
if (gui != null) {
|
*
|
||||||
gui.setStatus("Error downloading: " + name + ".jar");
|
* @param str The string to show the user
|
||||||
|
*/
|
||||||
|
private static void printToGui(String str) {
|
||||||
|
if (gui != null) {
|
||||||
|
gui.setStatus(str);
|
||||||
|
} else {
|
||||||
|
System.out.println(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads jar files for all possible server versions.
|
||||||
|
*
|
||||||
|
* @throws IOException If a jar fails to download.
|
||||||
|
*/
|
||||||
|
private static void downloadAll() throws IOException {
|
||||||
|
for (ServerType type : ServerType.getServerTypes()) {
|
||||||
|
String url = Objects.requireNonNull(type).getDownloadURL(), name = type.getName(), newestVersion;
|
||||||
|
AdvancedServerType advType = type instanceof AdvancedServerType ? (AdvancedServerType) type : null;
|
||||||
|
for (String version : type.getVersions()) {
|
||||||
|
Boolean success;
|
||||||
|
printToGui("Downloading: " + name + version + ".jar");
|
||||||
|
File file = new File(jarDir + type.getName() + version + ".jar");
|
||||||
|
Path filePath = Paths.get(jarDir + type.getName() + version + ".jar");
|
||||||
|
switch (type.getName()) {
|
||||||
|
case "Vanilla":
|
||||||
|
case "Snapshot":
|
||||||
|
if (version.equals("Latest")) {
|
||||||
|
String versionText = readFile(Objects.requireNonNull(advType).getVersionURL());
|
||||||
|
JsonObject jsonObject = new JsonParser().parse(versionText).getAsJsonObject();
|
||||||
|
String latest = jsonObject.getAsJsonObject("latest").get("release").getAsString();
|
||||||
|
JsonElement ver = jsonObject.getAsJsonArray("versions").get(0);
|
||||||
|
String versionFile = ver.getAsJsonObject().get("url").getAsString();
|
||||||
|
|
||||||
|
versionText = readFile(versionFile);
|
||||||
|
jsonObject = new JsonParser().parse(versionText).getAsJsonObject();
|
||||||
|
String jarFile = jsonObject.getAsJsonObject("downloads").getAsJsonObject("server").get("url").getAsString();
|
||||||
|
|
||||||
|
setVersion(name, latest);
|
||||||
|
success = (file.isFile() && latest.equals(getVersion(name))) || downloadFile(jarFile, filePath);
|
||||||
|
} else {
|
||||||
|
success = file.isFile() || downloadFile(url + version + Objects.requireNonNull(advType).getDownloadURLPart() + version + ".jar", filePath);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Spigot":
|
||||||
|
case "Craftbukkit":
|
||||||
|
case "MCPCplus":
|
||||||
|
success = file.isFile() || downloadFile(url + name + version + ".jar", filePath);
|
||||||
|
break;
|
||||||
|
case "SpongeVanilla":
|
||||||
|
newestVersion = stringBetween(readFile(Objects.requireNonNull(advType).getVersionURL() + version), advType.getSrcStart(), advType.getSrcEnd());
|
||||||
|
success = file.isFile() || downloadFile(url + newestVersion + advType.getDownloadURLPart() + newestVersion + ".jar", filePath);
|
||||||
|
break;
|
||||||
|
case "Bungee":
|
||||||
|
newestVersion = stringBetween(readFile(Objects.requireNonNull(advType).getVersionURL()), advType.getSrcStart(), advType.getSrcEnd());
|
||||||
|
setVersion(name, newestVersion);
|
||||||
|
success = (file.isFile() && newestVersion.equals(getVersion(name))) || downloadFile(url, filePath);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
if (!success) {
|
||||||
|
printToGui("Error downloading: " + name + version + ".jar");
|
||||||
|
throw new FileNotFoundException("Error downloading: " + name + version + ".jar");
|
||||||
}
|
}
|
||||||
throw new FileNotFoundException("Error downloading: " + name + ".jar");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,19 @@
|
|||||||
package net.knarcraft.serverlauncher.server;
|
package net.knarcraft.serverlauncher.server;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import net.knarcraft.serverlauncher.Main;
|
import net.knarcraft.serverlauncher.Main;
|
||||||
import net.knarcraft.serverlauncher.profile.Collection;
|
import net.knarcraft.serverlauncher.profile.Collection;
|
||||||
import net.knarcraft.serverlauncher.profile.Profile;
|
import net.knarcraft.serverlauncher.profile.Profile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static net.knarcraft.serverlauncher.Shared.downloadFile;
|
import static net.knarcraft.serverlauncher.Shared.*;
|
||||||
import static net.knarcraft.serverlauncher.Shared.readFile;
|
|
||||||
import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +28,7 @@ public class Server {
|
|||||||
private static final String[] ramList = {
|
private static final String[] ramList = {
|
||||||
"512M", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G", "9G", "10G","11G", "12G", "13G", "14G", "15G", "16G"
|
"512M", "1G", "2G", "3G", "4G", "5G", "6G", "7G", "8G", "9G", "10G","11G", "12G", "13G", "14G", "15G", "16G"
|
||||||
};
|
};
|
||||||
private static final String jarDir = Main.appDir + File.separator + "files" + File.separator + "Jars" + File.separator;
|
private static final String jarDir = Main.getAppDir() + File.separator + "files" + File.separator + "Jars" + File.separator;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private String path;
|
private String path;
|
||||||
@ -275,6 +278,7 @@ public class Server {
|
|||||||
this.downloadJar();
|
this.downloadJar();
|
||||||
Profile.getGUI().setStatus("File downloaded");
|
Profile.getGUI().setStatus("File downloaded");
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
Profile.getGUI().setStatus("Error: Jar file not found");
|
Profile.getGUI().setStatus("Error: Jar file not found");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
this.started = false;
|
this.started = false;
|
||||||
@ -293,9 +297,9 @@ public class Server {
|
|||||||
ProcessBuilder builder;
|
ProcessBuilder builder;
|
||||||
String serverPath;
|
String serverPath;
|
||||||
if (Profile.getCurrent().getDownloadJars() && !type.getName().equals("Custom")) {
|
if (Profile.getCurrent().getDownloadJars() && !type.getName().equals("Custom")) {
|
||||||
serverPath = "\"" + jarDir + this.getType() + "\"";
|
serverPath = jarDir + this.getType();
|
||||||
} else {
|
} else {
|
||||||
serverPath = "\"" + this.path + File.separator + this.getType() + "\"";
|
serverPath = this.path + File.separator + this.getType();
|
||||||
}
|
}
|
||||||
builder = new ProcessBuilder(
|
builder = new ProcessBuilder(
|
||||||
"java",
|
"java",
|
||||||
@ -351,12 +355,7 @@ public class Server {
|
|||||||
AdvancedServerType type;
|
AdvancedServerType type;
|
||||||
File file = new File(this.path + File.separator + this.getType());
|
File file = new File(this.path + File.separator + this.getType());
|
||||||
Path filePath = Paths.get(this.path + File.separator + this.getType());
|
Path filePath = Paths.get(this.path + File.separator + this.getType());
|
||||||
String versionText;
|
String versionText, newestVersion, url = this.type.getDownloadURL(), name = this.type.getName(), ver = this.serverVersion;
|
||||||
String newestVersion;
|
|
||||||
String url = this.type.getDownloadURL();
|
|
||||||
String name = this.type.getName();
|
|
||||||
String ver = this.serverVersion;
|
|
||||||
boolean success;
|
|
||||||
switch (this.type.getName()) {
|
switch (this.type.getName()) {
|
||||||
case "Custom":
|
case "Custom":
|
||||||
if (!file.isFile()) {
|
if (!file.isFile()) {
|
||||||
@ -366,11 +365,8 @@ public class Server {
|
|||||||
case "Spigot":
|
case "Spigot":
|
||||||
case "Craftbukkit":
|
case "Craftbukkit":
|
||||||
case "MCPCplus":
|
case "MCPCplus":
|
||||||
if (!file.isFile()) {
|
if (!(file.isFile() || downloadFile(url + name + ver + ".jar", filePath))) {
|
||||||
success = downloadFile(url + name + ver + ".jar", filePath);
|
throw new FileNotFoundException("Jar file could not be downloaded.");
|
||||||
if (!success) {
|
|
||||||
throw new FileNotFoundException("Jar file could not be downloaded.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "Vanilla":
|
case "Vanilla":
|
||||||
@ -382,23 +378,30 @@ public class Server {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new FileNotFoundException("Version file could not be downloaded.");
|
throw new FileNotFoundException("Version file could not be downloaded.");
|
||||||
}
|
}
|
||||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
JsonObject jsonObject = new JsonParser().parse(versionText).getAsJsonObject();
|
||||||
if (!file.isFile() || !newestVersion.equals(this.getVersion(name))) {
|
String latest = jsonObject.getAsJsonObject("latest").get("release").getAsString();
|
||||||
success = downloadFile(
|
JsonElement verElem = jsonObject.getAsJsonArray("versions").get(0);
|
||||||
url + newestVersion + type.getDownloadURLPart() + newestVersion + ".jar",
|
String versionFile = verElem.getAsJsonObject().get("url").getAsString();
|
||||||
filePath
|
|
||||||
);
|
try {
|
||||||
this.setVersion(name, newestVersion);
|
versionText = readFile(versionFile);
|
||||||
if (!success) {
|
} catch (IOException e) {
|
||||||
|
throw new FileNotFoundException("Version file could not be downloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file.isFile() || !latest.equals(this.getVersion(name))) {
|
||||||
|
this.setVersion(name, latest);
|
||||||
|
|
||||||
|
jsonObject = new JsonParser().parse(versionText).getAsJsonObject();
|
||||||
|
String jarFile = jsonObject.getAsJsonObject("downloads").getAsJsonObject("server").get("url").getAsString();
|
||||||
|
|
||||||
|
if (!downloadFile(jarFile, filePath)) {
|
||||||
throw new FileNotFoundException("Jar file could not be downloaded.");
|
throw new FileNotFoundException("Jar file could not be downloaded.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!file.isFile()) {
|
if (!(file.isFile() || downloadFile(url + ver + type.getDownloadURLPart() + ver + ".jar", filePath))) {
|
||||||
success = downloadFile(url + ver + type.getDownloadURLPart() + ver + ".jar", filePath);
|
throw new FileNotFoundException("Jar file could not be downloaded.");
|
||||||
if (!success) {
|
|
||||||
throw new FileNotFoundException("Jar file could not be downloaded.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -411,12 +414,8 @@ public class Server {
|
|||||||
}
|
}
|
||||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
||||||
if (!file.isFile() || !newestVersion.equals(this.getVersion(name))) {
|
if (!file.isFile() || !newestVersion.equals(this.getVersion(name))) {
|
||||||
success = downloadFile(
|
|
||||||
url + newestVersion + type.getDownloadURLPart() + newestVersion + ".jar",
|
|
||||||
filePath
|
|
||||||
);
|
|
||||||
this.setVersion(name, newestVersion);
|
this.setVersion(name, newestVersion);
|
||||||
if (!success) {
|
if (!downloadFile(url + newestVersion + type.getDownloadURLPart() + newestVersion + ".jar", filePath)) {
|
||||||
throw new FileNotFoundException("Jar file could not be downloaded.");
|
throw new FileNotFoundException("Jar file could not be downloaded.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,9 +429,8 @@ public class Server {
|
|||||||
}
|
}
|
||||||
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
newestVersion = stringBetween(versionText, type.getSrcStart(), type.getSrcEnd());
|
||||||
if (!file.isFile() || !newestVersion.equals(this.getVersion(name))) {
|
if (!file.isFile() || !newestVersion.equals(this.getVersion(name))) {
|
||||||
success = downloadFile(url, filePath);
|
|
||||||
this.setVersion(name, newestVersion);
|
this.setVersion(name, newestVersion);
|
||||||
if (!success) {
|
if (!downloadFile(url, filePath)) {
|
||||||
throw new FileNotFoundException("Jar file could not be downloaded.");
|
throw new FileNotFoundException("Jar file could not be downloaded.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,11 @@ public class ServerType {
|
|||||||
return serverTypes;
|
return serverTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of all server types' names.
|
||||||
|
*
|
||||||
|
* @return A list of strings
|
||||||
|
*/
|
||||||
public static String[] getTypeNames() {
|
public static String[] getTypeNames() {
|
||||||
ArrayList<ServerType> types = ServerType.getServerTypes();
|
ArrayList<ServerType> types = ServerType.getServerTypes();
|
||||||
String[] serverTypes = new String[types.size()];
|
String[] serverTypes = new String[types.size()];
|
||||||
@ -51,6 +56,12 @@ public class ServerType {
|
|||||||
return serverTypes;
|
return serverTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a server type by name.
|
||||||
|
*
|
||||||
|
* @param name Then name of the server type
|
||||||
|
* @return A ServerType
|
||||||
|
*/
|
||||||
public static ServerType getByName(String name) {
|
public static ServerType getByName(String name) {
|
||||||
for (ServerType serverType : serverTypes) {
|
for (ServerType serverType : serverTypes) {
|
||||||
if (serverType.getName().equals(name)) {
|
if (serverType.getName().equals(name)) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.knarcraft.serverlauncher.userinterface;
|
package net.knarcraft.serverlauncher.userinterface;
|
||||||
|
|
||||||
|
import net.knarcraft.serverlauncher.Main;
|
||||||
import net.knarcraft.serverlauncher.profile.Collection;
|
import net.knarcraft.serverlauncher.profile.Collection;
|
||||||
import net.knarcraft.serverlauncher.server.Server;
|
import net.knarcraft.serverlauncher.server.Server;
|
||||||
import net.knarcraft.serverlauncher.profile.Profile;
|
import net.knarcraft.serverlauncher.profile.Profile;
|
||||||
@ -93,6 +94,11 @@ public class GUI implements ActionListener {
|
|||||||
*/
|
*/
|
||||||
public void setStatus(String text) {
|
public void setStatus(String text) {
|
||||||
this.lblStatuslabel.setText(text);
|
this.lblStatuslabel.setText(text);
|
||||||
|
try (PrintWriter file = new PrintWriter(new FileWriter(Main.getAppDir() + File.separator + "latestrun.log", true))) {
|
||||||
|
file.println(text);
|
||||||
|
} catch (IOException e ) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -546,7 +552,7 @@ public class GUI implements ActionListener {
|
|||||||
} else if (e.getSource() == chckbxmntmDownloadJars) {
|
} else if (e.getSource() == chckbxmntmDownloadJars) {
|
||||||
downloadJars();
|
downloadJars();
|
||||||
} else if (e.getSource() == mntmErrors) {
|
} else if (e.getSource() == mntmErrors) {
|
||||||
goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Info/");
|
goToURL("https://archive.knarcraft.net/BungeeMinecraftServerLauncherInfo/");
|
||||||
} else if (e.getSource() == mntmSetup) {
|
} else if (e.getSource() == mntmSetup) {
|
||||||
JOptionPane.showMessageDialog(
|
JOptionPane.showMessageDialog(
|
||||||
null,
|
null,
|
||||||
@ -555,7 +561,7 @@ public class GUI implements ActionListener {
|
|||||||
JOptionPane.INFORMATION_MESSAGE
|
JOptionPane.INFORMATION_MESSAGE
|
||||||
);
|
);
|
||||||
} else if (e.getSource() == mntmManualUpdate) {
|
} else if (e.getSource() == mntmManualUpdate) {
|
||||||
goToURL("https://knarcraft.net/Downloads/Bungeeminecraftserverlauncher/");
|
goToURL("https://git.knarcraft.net/EpicKnarvik97/Minecraft-Server-Launcher");
|
||||||
} else if (e.getSource() == mntmRunInBackground) {
|
} else if (e.getSource() == mntmRunInBackground) {
|
||||||
JOptionPane.showMessageDialog(
|
JOptionPane.showMessageDialog(
|
||||||
null,
|
null,
|
||||||
@ -585,7 +591,7 @@ public class GUI implements ActionListener {
|
|||||||
JOptionPane.INFORMATION_MESSAGE
|
JOptionPane.INFORMATION_MESSAGE
|
||||||
);
|
);
|
||||||
} else if (e.getSource() == mntmStory) {
|
} else if (e.getSource() == mntmStory) {
|
||||||
goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Story/");
|
goToURL("https://archive.knarcraft.net/BungeeminecraftserverlauncherStory/");
|
||||||
} else if (e.getSource() == btnStartServer) {
|
} else if (e.getSource() == btnStartServer) {
|
||||||
try {
|
try {
|
||||||
Profile.getCurrent().save();
|
Profile.getCurrent().save();
|
||||||
|
@ -38,7 +38,7 @@ public class ServerTab implements ActionListener {
|
|||||||
this.chckbxEnabled.setSelected(enabled);
|
this.chckbxEnabled.setSelected(enabled);
|
||||||
this.serverTypes.setSelectedItem(typeName);
|
this.serverTypes.setSelectedItem(typeName);
|
||||||
this.serverTypes();
|
this.serverTypes();
|
||||||
this.serverTypes.setSelectedItem(serverVersion);
|
this.serverVersions.setSelectedItem(serverVersion);
|
||||||
this.maxRam.setSelectedItem(maxRam);
|
this.maxRam.setSelectedItem(maxRam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import net.knarcraft.serverlauncher.profile.Profile;
|
import net.knarcraft.serverlauncher.profile.Profile;
|
||||||
import net.knarcraft.serverlauncher.server.ServerType;
|
import net.knarcraft.serverlauncher.server.ServerType;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import net.knarcraft.serverlauncher.profile.Profile;
|
import net.knarcraft.serverlauncher.profile.Profile;
|
||||||
import net.knarcraft.serverlauncher.server.ServerType;
|
import net.knarcraft.serverlauncher.server.ServerType;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
import static net.knarcraft.serverlauncher.Shared.stringBetween;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class Tests {
|
public class Tests {
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user