mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Actually throw the interrupted exception if interrupted while loading
This commit is contained in:
parent
29e18506c1
commit
a79ddace71
@ -135,6 +135,8 @@ public void load(Collection<File> sources) throws IOException, InterruptedExcept
|
||||
public void load(File... sources) throws InterruptedException {
|
||||
try (CombinedFileAccess combinedSources = new CombinedFileAccess()){
|
||||
for (int i = 0; i < sources.length; i++) {
|
||||
if (Thread.interrupted()) throw new InterruptedException();
|
||||
|
||||
File file = sources[i];
|
||||
try {
|
||||
combinedSources.addFileAccess(FileAccess.of(file));
|
||||
@ -152,6 +154,8 @@ public void load(File... sources) throws InterruptedException {
|
||||
Collection<String> namespaces = sourcesAccess.listFolders("assets");
|
||||
int i = 0;
|
||||
for (String namespaceRoot : namespaces) {
|
||||
if (Thread.interrupted()) throw new InterruptedException();
|
||||
|
||||
i++;
|
||||
|
||||
//load blockstates
|
||||
@ -160,10 +164,7 @@ public void load(File... sources) throws InterruptedException {
|
||||
|
||||
Collection<String> blockstateFiles = sourcesAccess.listFiles(namespaceRoot + "/blockstates", true);
|
||||
for (String blockstateFile : blockstateFiles) {
|
||||
if (Thread.interrupted()) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
if (Thread.interrupted()) throw new InterruptedException();
|
||||
|
||||
String filename = FileAccess.getFileName(blockstateFile);
|
||||
if (!filename.endsWith(".json")) continue;
|
||||
|
Loading…
Reference in New Issue
Block a user