replace with clean stream calls
This commit is contained in:
parent
09ab1e6477
commit
2f95176cf0
@ -186,11 +186,9 @@ public final class VillagerOptimizer extends JavaPlugin {
|
|||||||
Files.createDirectories(langDirectory.toPath());
|
Files.createDirectories(langDirectory.toPath());
|
||||||
final Pattern langPattern = Pattern.compile("([a-z]{1,3}_[a-z]{1,3})(\\.yml)", Pattern.CASE_INSENSITIVE);
|
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))
|
return Stream.concat(pluginJar.stream().map(ZipEntry::getName), Arrays.stream(langDirectory.listFiles()).map(File::getName))
|
||||||
.map(name -> {
|
.map(langPattern::matcher)
|
||||||
final Matcher matcher = langPattern.matcher(name);
|
.filter(Matcher::find)
|
||||||
return matcher.find() ? matcher.group(1) : null;
|
.map(matcher -> matcher.group(1))
|
||||||
})
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.collect(Collectors.toCollection(TreeSet::new));
|
.collect(Collectors.toCollection(TreeSet::new));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logger.error("Failed querying for available translations!", t);
|
logger.error("Failed querying for available translations!", t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user