Skip to content

Commit

Permalink
feat: use lore translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Dec 28, 2023
1 parent 9812417 commit aa01895
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ private boolean translateItem(User user, ItemStack item, SlimefunItem sfItem) {
public String translateLore(User user, String id) {
var transl = TranslationUtils.findTranslation(
SlimefunTranslation.getRegistry().getLoreTranslations(), user, id);
if (transl.isEmpty()) {
return "";
}
return transl.get();
return transl.orElse("");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public String onPlaceholderRequest(Player p, String identifier) {
} else {
args = Arrays.copyOfRange(s, 1, s.length);
}
var transl = TranslationUtils.findTranslation(
SlimefunTranslation.getRegistry().getLoreTranslations(), user, id);
return transl.map(translation ->
ColorUtils.color(MessageFormat.format(translation, (Object[]) args))
).orElse(null);
var translation = SlimefunTranslation.getTranslationService().translateLore(user, id);
return ColorUtils.color(MessageFormat.format(translation, (Object[]) args));
}
}

0 comments on commit aa01895

Please sign in to comment.