Stream is now properly recieved

This commit is contained in:
Sekwah 2018-06-06 15:19:03 +01:00 committed by Sekwah
parent 2f9a9622db
commit e12438e10e

View File

@ -83,7 +83,7 @@ public class DataStorage {
}
if (!outFile.exists() || overwrite) {
try {
InputStream inputStream = DataStorage.class.getResourceAsStream(fileLoc);
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileLoc);
if(inputStream == null) {
return false;
}
@ -125,8 +125,10 @@ public class DataStorage {
File inFile = new File(dataFolder, location);
if (inFile.exists() && !inFile.isDirectory()) {
try {
System.out.println("OUTPUT 1");
return new FileInputStream(inFile);
} catch (FileNotFoundException e) {
System.out.println("OUTPUT 2");
e.printStackTrace();
return null;
}
@ -135,6 +137,7 @@ public class DataStorage {
copyDefaultFile(location, false);
return this.getClass().getClassLoader().getResourceAsStream(location);
} catch (NullPointerException e) {
System.out.println("OUTPUT 4");
e.printStackTrace();
AdvancedPortalsCore.getInfoLogger().logWarning("Could not load " + location + ". The file does" +
"not exist or there has been an error reading the file.");