Skip to content

Commit 7d68775

Browse files
committed
Refactor getElements method to use switch expression for improved readability
1 parent 4dc71d4 commit 7d68775

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/main/java/world/bentobox/challenges/panel/CommonPanel.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,11 @@ protected List<String> generateChallengeDescription(Challenge challenge, @Nullab
165165
// Remove any empty lines from the translated text and split it into individual lines
166166
final String finalDescription = description; // ensure it's effectively final
167167

168-
List<String> lines = Arrays.stream(returnString.replaceAll(Constants.BLANK_LINE_REGEX, "").split("\n"))
168+
return Arrays.stream(returnString.replaceAll(Constants.BLANK_LINE_REGEX, "").split("\n"))
169169
.map(line -> line.contains(Constants.PARAMETER_DESCRIPTION)
170170
? line.replace(Constants.PARAMETER_DESCRIPTION, finalDescription)
171171
: line)
172172
.collect(Collectors.toList());
173-
174-
return lines;
175173
} else {
176174
// If description is empty, pass it directly as a parameter to the translation
177175
returnString = this.user.getTranslationOrNothing(referenceKey + "lore", Constants.PARAMETER_DESCRIPTION,

0 commit comments

Comments
 (0)