Skip to content

Commit

Permalink
replace with clean stream calls
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Mar 28, 2024
1 parent 30b5924 commit 7d959e5
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,9 @@ private SortedSet<String> getAvailableTranslations() {
Files.createDirectories(langDirectory.toPath());
final Pattern langPattern = Pattern.compile("([a-z]{1,3}_[a-z]{1,3})(\\.yml)", Pattern.CASE_INSENSITIVE);
return Stream.concat(pluginJar.stream().map(ZipEntry::getName), Arrays.stream(langDirectory.listFiles()).map(File::getName))
.map(name -> {
final Matcher matcher = langPattern.matcher(name);
return matcher.find() ? matcher.group(1) : null;
})
.filter(Objects::nonNull)
.map(langPattern::matcher)
.filter(Matcher::find)
.map(matcher -> matcher.group(1))
.collect(Collectors.toCollection(TreeSet::new));
} catch (Throwable t) {
logger.error("Failed querying for available translations!", t);
Expand Down

0 comments on commit 7d959e5

Please sign in to comment.