Skip to content

Commit

Permalink
perf(bukkit): Early return if no files to load
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Oct 3, 2024
1 parent ecb174f commit 5321a67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public List<String> allow() {
.filter(Files::isRegularFile)
.map(Path::toFile)
.collect(Collectors.toList());
if (files.isEmpty()) return Collections.emptyList();

files.parallelStream()
.forEach(file -> {
Expand All @@ -47,7 +48,7 @@ public List<String> allow() {
LOGGER.severe("Error reading file: " + file.getName());
}
});
if (!files.isEmpty()) LOGGER.info("Loaded " + files.size() + " external allow file(s).");
LOGGER.info("Loaded " + files.size() + " external allow file(s). " + "Total words: " + totalList.size());
} catch (IOException e) {
LOGGER.severe("Error occurred while loading external allow files: " + e.getMessage());
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public List<String> deny() {
.filter(Files::isRegularFile)
.map(Path::toFile)
.collect(Collectors.toList());
if (files.isEmpty()) return Collections.emptyList();

files.parallelStream()
.forEach(file -> {
Expand All @@ -47,7 +48,7 @@ public List<String> deny() {
LOGGER.severe("Error reading file: " + file.getName());
}
});
if (!files.isEmpty()) LOGGER.info("Loaded " + files.size() + " external deny file(s).");
LOGGER.info("Loaded " + files.size() + " external deny file(s). " + "Total words: " + totalList.size());
} catch (IOException e) {
LOGGER.severe("Error occurred while loading external deny files: " + e.getMessage());
return Collections.emptyList();
Expand Down

0 comments on commit 5321a67

Please sign in to comment.