feat: update some code with Java 21 newest methods
This commit is contained in:
parent
eb23580bc4
commit
81b1c8275f
3 changed files with 4 additions and 4 deletions
|
@ -27,7 +27,7 @@ public class RandomNameFetcher {
|
|||
final String[] values = line.split("\n");
|
||||
records.add(Arrays.asList(values));
|
||||
}
|
||||
return records.get(new Random().nextInt(records.size() - 1)).get(0);
|
||||
return records.get(new Random().nextInt(records.size() - 1)).getFirst();
|
||||
} catch (IOException e) {
|
||||
instance.getLogger().severe("Unable to fetch random names.");
|
||||
return "Ineanto";
|
||||
|
|
|
@ -106,10 +106,10 @@ public class I18N {
|
|||
return new Translation(null, toTranslate);
|
||||
} else if (name != null && (lore == null || lore.isEmpty())) {
|
||||
// Valid name, empty lore
|
||||
return new Translation(toTranslate.get(0), new ArrayList<>(Collections.emptyList()));
|
||||
return new Translation(toTranslate.getFirst(), new ArrayList<>(Collections.emptyList()));
|
||||
} else {
|
||||
// Valid name, valid lore
|
||||
return new Translation(toTranslate.get(0), new ArrayList<>(toTranslate.subList(1, toTranslate.size())));
|
||||
return new Translation(toTranslate.getFirst(), new ArrayList<>(toTranslate.subList(1, toTranslate.size())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CustomLocaleMigrator implements Migrator {
|
|||
try {
|
||||
Files.copy(customLocale.getFile().toPath(), backupFile.toPath());
|
||||
if (customLocale.getFile().delete()) {
|
||||
customLocale.dumpIntoFile(Locale.ENGLISH);
|
||||
CustomLocale.dumpIntoFile(Locale.ENGLISH);
|
||||
}
|
||||
instance.getLogger().info("Successfully migrated the custom locale.");
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in a new issue