Changes resource loading
Some checks failed
KnarCraft/Minecraft-Server-Launcher/master There was a failure building this commit

Loads configuration and image files from resources folder
Removes duplicate resources
This commit is contained in:
2020-02-12 23:00:51 +01:00
parent f841d73e2d
commit c59cbcefbb
9 changed files with 71 additions and 46 deletions

View File

@ -6,6 +6,8 @@ import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
import static net.knarcraft.minecraftserverlauncher.Shared.getResourceAsScanner;
/**
* Contains the bare minimum to be a functional server type.
*
@ -80,11 +82,10 @@ public class ServerType {
if (serverTypes.isEmpty()) {
Scanner file;
try {
file = new Scanner(new File("config/servertypes.csv"));
file = getResourceAsScanner("servertypes.csv");
} catch (FileNotFoundException e) {
file = new Scanner(ServerType.class.getResourceAsStream("/config/servertypes.csv"));
throw new ConfigurationException("Server type configuration file is missing.");
}
while (file.hasNextLine()) {
String[] str = file.nextLine().split(";", -1);
int len = str.length;