Skip to content

Commit

Permalink
Reduce unnecessary if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
StavWasPlayZ committed Apr 23, 2024
1 parent 1bdf238 commit 8cf0bce
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,21 @@ private static void reload(final ResourceManager resourceManager) {
CACHES.clear();
}
private static void updateIsGlobalThemed(final ResourceManager resourceManager) {
isGlobalThemed = false;
final Optional<Resource> instrumentsMeta = resourceManager.getResource(INSTRUMENTS_META_LOC);

if (instrumentsMeta.isEmpty()) {
LOGGER.warn("No instrument meta found for "+INSTRUMENTS_META_LOC+"!");
} else {
try (final BufferedReader reader = instrumentsMeta.get().openAsReader()) {
isGlobalThemed = JsonParser.parseReader(reader)
.getAsJsonObject()
.get("is_global_pack")
.getAsBoolean();
} catch (Exception e) {}
LOGGER.warn("No instrument meta found for " + INSTRUMENTS_META_LOC + "!");
return;
}

try (final BufferedReader reader = instrumentsMeta.get().openAsReader()) {
isGlobalThemed = JsonParser.parseReader(reader)
.getAsJsonObject()
.get("is_global_pack")
.getAsBoolean();
} catch (Exception e) {}

if (isGlobalThemed)
LOGGER.info("Instrument global themes enabled; loading all instrument resources from "+GLOBAL_LOC);
}
Expand Down

0 comments on commit 8cf0bce

Please sign in to comment.