Fixed: nullable patches
This commit is contained in:
@@ -37,7 +37,13 @@ public class PatchPreLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
for(File patch : Objects.requireNonNull(patches.listFiles((dir, name) -> name.endsWith(".jar")))) {
|
if(!patches.exists() && !patches.mkdir()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final File[] files = patches.listFiles((dir, name) -> name.endsWith(".jar"));
|
||||||
|
if(files != null) {
|
||||||
|
for (File patch : files) {
|
||||||
try {
|
try {
|
||||||
final URLClassLoader mainLoader = new URLClassLoader(new URL[]{patch.toURL()});
|
final URLClassLoader mainLoader = new URLClassLoader(new URL[]{patch.toURL()});
|
||||||
final JSONObject description = new JSONObject(new String(mainLoader.getResourceAsStream("patch.json").readAllBytes()));
|
final JSONObject description = new JSONObject(new String(mainLoader.getResourceAsStream("patch.json").readAllBytes()));
|
||||||
@@ -61,3 +67,4 @@ public class PatchPreLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user